# Zonal statistics (mean± StDev) from polygons with different area

I am analyzing a temperature image using a land cover map with the overall goal to prepare a barplot where I report the mean ± StDev temperature for each land cover class. To do so I assigned each pixel to a land cover class and then I estimated the mean and the standard deviation from all the pixels of each class. What troubles me though is that the number of pixels between classes is not the same, for instance class A might have 8 pxls, class B 26 pxls and class C 140 pxls. Hence the statistics I calculate correspond to different-sized populations, which doesn't feel right. Another option is to select from all classes the same number of pixels, e.g. 8; however in that case I include from class A the entire pixel population, from class B 31% of its members and from class C only ~6%, which also doesn't feel right. Hence I would like to ask for your suggestions, is this a problem and how should I approach it? What is the best-practise in such cases?

Unequal group sizes are often inevitable in observational studies. There is no general problem basing calculations of means and standard deviations on groups with different sizes. It's not usually a good idea to throw away data, so you should use all that you have. There are two things to keep in mind.

First, the reliability of your estimates will depend on the size of each group. The reliability both of the mean-value estimates, as represented by the standard errors of the means, and of the estimates of standard deviations or variances increase with the number of observations. So you should be sure to provide information about group sizes when you present your data.

Second, analysis of geographical data in this way can pose some unexpected problems. See questions tagged here with geostatistics. Pixels that are close together in space may have temperature values very similar to those of nearby pixels of a different land-cover class, while they have different temperatures than pixels of the same class that are far away. This is a spatial autocorrelation that you need to take into account.

For example, in your case the observed standard deviation among pixels for a particular land cover class may depend on the numbers of separate patches of pixels of that class, the numbers of pixels in each patch, and the distances among those patches. This becomes even more important if you are examining changes in temperature over time. You owe it to yourself and to your audience to model the data in a way that reliably demonstrates the origins of the differences that you find among the mean and standard deviation values for the different classes. Consider consulting with a statistician having experience in geo-spatial modeling.

You can report confidence intervals for your measures of mean and standard deviation. Note that the sample standard deviation should approximate your population statistic, and shouldn't be associated with your sample size in any way. A confidence interval, on the other hand, will be tied to sample size - as sample size grows, your estimate of mean/standard deviation becomes more precise, and the confidence interval shrinks. For groups of unequal sample size, confidence intervals will appropriately capture the variability that's due to sample size. Confidence intervals around means are extremely common, although they're somewhat less commonly reported around standard deviation measures (although there's no theoretical reason why you shouldn't).

I'm not sure what the best way to represent all that data on a single bar plot, though, as you'll have mean with a confidence interval, an SD envelope around that, and a confidence interval on your SD measure. It might be better to show two separate barplots, showing mean+/-CI and SD+/-CI for each group.

• Thank you for your reply! For a start, I did as you suggested and calculated the confidence intervals. Now I have to do some research about the point EdM raised regarding geo-spatial modeling. – pan Jun 20 at 12:43