6 ms·
How to count them with less effort - no need to count over the whole map. Perhaps Google would ban you if they saw too many requests for map tiles. So, here's
by visarga 10y ago
How to count them with less effort - no need to count over the whole map. Perhaps Google would ban you if they saw too many requests for map tiles.
So, here's how to do it: sample 100-200 locations in a country. In each location, extract a tile of the map and count the circles in there. Then you need to scale the sum by the total surface of the country divided by the total surface of the sampled tiles.
- davedx 10y agoHow did you arrive at the 100-200 number?
- hantusk 10y agoThat number of samples is a good rule of thumb, to approach the normal distribution. I have heard it on several occasions, but would be happy to see someone link to a derivation for why that is so.
- oli5679 10y agoThe number of samples you want to take depends on the variance of the population and the precision with with you want to estimate the population mean (if both of these are greater you want to take a larger sample). 200 is normally sufficient, but its possible to calculate confidence intervals as a robustness check. The Central Limit Theorem states that even if your underlying distribution is not normally distributed, square_root(n)* (sample_mean - population_mean) will converge to a normal distribution with mean 0 and variance = population variance. Sample variance also gives you an unbiased estimate of population variance. This means that if n is large, you can compute confidence intervals from n and observation = [x1, x2 .. xi .. xn] 1) computing the sample mean and sample variance. sample_mean = x_bar = 1/n sum(xi) and sample_variance = 1/n-1 sum((xi- x_bar)^2) 2) computing x_bar +- square_root(sample_variance/n) Eg if sample mean is 102, sample variance is 50 and n = 200, your 95% confidence interval would be: 102 +- 1.96 *square_root(50/200) =approx [101, 103] http://mathworld.wolfram.com/SampleVariance.html http://mathworld.wolfram.com/SampleVariance.html https://en.wikipedia.org/wiki/Central_limit_theorem#Classical_CLT https://en.wikipedia.org/wiki/Central_limit_theorem#Classica... https://en.wikipedia.org/wiki/Confidence_interval#Definition https://en.wikipedia.org/wiki/Confidence_interval#Definition
- phreeza 10y agoThe problem with that is that the locations of the sites are probably very correlated, meaning that your samples will no longer be independent, and your estimate would probably be biased.
- oli5679 10y agoIf the sampling process gives you a random subset of tiles, I don't see how the estimate could be biased. Even if you have a strange distribution of circles (heavily clustered in certain geographies), the weak law of large numbers would mean that the sample mean is an unbiased estimator for population mean if your sampling process is iid (random number generation is by definition iid). https://en.wikipedia.org/wiki/Law_of_large_numbers https://en.wikipedia.org/wiki/Law_of_large_numbers I think you're confused between which restrictions apply to the sampling process versus the underlying population.
- phreeza 10y agoUgh, you are of course correct, I should not be allowed to comment on statistics before having my first coffee. I think I had some diffuse ideas about this not being a poisson processes in my head that lead me to this faulty conclusion.