# Test to compare 5 subgroups with population parameter

I have 5 subgroups , A,B,C,D,E each have their own mean and standard deviation.

 Subgroup  Mean  SD   n
A         25.8  9.11 77
B         32.6  10.4 448
C         31.3  10.3 92
D         25.9  7.7  2347
E         29.2  8.9  10121


I also have the population mean and standard deviation ($$\mu=30, \sigma=10$$). What statistical test should I use , if my goal to check if the subgroup mean differs from population ? Thanks.

• It would be helpful if you can share some means, variances, sample sizes. Do you know whether data are normal or nearly normal? Oct 19 at 18:31
• @BruceET, Your question is making me wonder, 1) What if the data is normally distributed , 2) what if the data is not-normally distributed. Oct 19 at 18:55
• With normal data, Welch one-factor ANOVA can test whether there are significant differences among the 5 group means, even if variances are not the same. For normal data, traditional tests to answer whether sample variances are significantly different are available, while non-normal data would require entirely different tests. Oct 19 at 19:14
• @BruceET, Thanks Bruce, please pardon my ignorance here. I thought about ANOVA but my understanding was that, ANOVA is comparing for differences between 5 groups. My goal is to compare if the 5 groups differ compare to population mean and sd. Is ANOVA still applicable in this scenario ? Oct 19 at 19:25
• @BruceET, Thanks Bruce, I have updated my question with the sample mean and sd and population parameters. I like to start with the assumption that data follows a normal distribution Oct 19 at 19:53

Originally, it seemed to me that you wanted to know whether each subgroup is consistent with a sample from a normal population with a specified mean and standard deviation. In your edit you mentioned specifically $$\mu = 30, \sigma = 10.$$

If you have the data (not just sample mean, sample SD, and sample size), then it is possible to do a Kolmogorov-Smirnov test to see how well each group matches that specific normal distribution.

For example, suppose you have the data for Group A as the list x in R of $$n=77$$ observations and that $$\bar X = 25.8, S = 9.11.$$

mean(x);  sd(x)
 25.8
 9.11


Then a Kolmogorov-Smirnov goodness-of-fit test shows that this sample from Group A is not consistent with a sample from $$\mathsf{Norm}(\mu = 30, \sigma=10),$$ as below. The P-value is nearly $$0.$$ [In the R code pnorm is the CDF of a normal populations, and the mean and standard deviation are supplied.]

ks.test(x, pnorm, 30, 10)

One-sample Kolmogorov-Smirnov test

data:  x
D = 0.25323, p-value = 7.708e-05
alternative hypothesis: two-sided


This test compares the population CDF with the empirical CDF (ECDF) of the sample. [The ECDF is based on a sorted sample, starting at $$0$$ on the left and jumping up by $$1/77$$ at each observation to end at $$1$$ on the right.] The K-S test statistic $$D$$ is the maximum vertical distance between the CDF and the ECDF. This test does not work very well for small samples, but yours are large enough to give useful results, if you're interested.

plot(ecdf(x), main="ECDF of Group A Data with CDF of NORM(30,10)") Note: Here are my fictitious data, rounded to three places and sorted from smallest to largest:

sort(round(x, 3))
  0.987  1.994  7.324  9.410 11.164 15.103 15.179 15.676 16.389 17.173 17.356
 17.435 17.826 18.684 18.884 19.321 19.876 20.115 20.873 20.884 20.999 21.082
 21.550 21.618 21.647 21.778 22.137 22.349 22.644 22.769 23.025 23.448 23.701
 23.990 24.528 24.614 25.254 25.587 25.773 25.781 26.177 26.606 26.801 27.579
 27.634 27.668 27.701 28.216 28.237 28.342 29.316 29.352 29.392 29.642 29.782
 29.940 29.972 30.000 30.459 31.557 31.697 32.216 33.327 33.789 33.825 35.363
 35.763 36.250 36.433 37.938 38.151 39.277 40.428 41.931 42.790 48.052 49.068


Notes: (1) Of course, your actual data may give different results with the K-S test, but rejection is likely for Group A, if your $$\bar X = 25.8$$ and $$\mu = 30, \sigma = 10.$$

(2) Also, if you are going to do five of these K-S tests, it would be prudent to use the Bonferroni method of avoiding false discovery by doing each of the five tests at the 1% level.

• Thanks Bruce. This is excellent suggestion. Can I use K-S test if the data is not normal ? Oct 20 at 16:10
• Yes, but notice that you'd have to know which non-normal "target distribution to use" because K-S compares sample with the CDF of a specific distribution. Oct 20 at 16:45
• perfect thanks Bruce. Oct 24 at 19:36

A suitable variant of ANOVA will work here.

This problem is special because in ANOVA (a) we usually do not assume the population mean and SD (under the null hypothesis) and (b) the null hypothesis is that all group means are equal. But the concepts and technology of ANOVA directly apply.

Indeed, the null hypothesis here is that each group is an independent sample from the given population with mean $$\mu$$ and variance $$\sigma^2.$$ In a group of size $$n_i$$ ($$i$$ will index the groups) from a such a population, the expected group mean is $$\mu$$ and its variance is $$\sigma^2/n.$$ These facts are simple consequences of the basic properties of expectation and variance.

Furthermore, when the population is approximately Normally distributed (or when the group size is sufficiently large), the sampling distribution of the group mean $$\bar X_i$$ also is approximately Normal. This implies that the random variable

$$\chi^2_i = \frac{\left(\bar X_i - \mu\right)^2}{\sigma^2/n_i}$$

approximately has a $$\chi^2(1)$$ distribution. Consequently, the sum of the $$\chi^2_i$$ for all the group means (of which there are $$m,$$ say) approximately has a $$\chi^2(m)$$ distribution.

For the alternative hypothesis $$H_A:$$ one or more of the groups is a sample of a population with a mean other than $$\mu$$ and the same variance $$\sigma^2,$$ a large value of this sum favors the alternative. This gives the usual $$\chi^2$$ test, albeit with a slightly different chi-squared statistic and more degrees of freedom than usual.

### Summary

Let the group counts be $$n_i,$$ the group means be $$\bar X_i,$$ the parent population mean be $$\mu,$$ and the parent population variance be $$\sigma^2.$$ The chi-squared statistic for testing $$H_0:$$ all groups are iid samples of the stipulated parent population against the $$H_A$$ above is $$\chi^2 = \sum_{i=1}^m \frac{\left(\bar X_i - \mu\right)^2}{\sigma^2/n_i} .$$ The p-value of this test is the upper tail probability of $$\chi^2,$$ computing using a chi-squared distribution of $$m$$ degrees of freedom.

### Example

For the data in the question, the five chi-squared statistics (one for each group, in order) are

 A        B        C        D        E
13.5828  30.2848   1.5548 394.5307  64.7744


Under the null hypothesis, each one should have a $$\chi^2(1)$$ distribution. Typical values are between $$0$$ and $$10$$ (there is only a one in a thousand chance of being greater than $$10$$). Only the third (group C) has a typical value. The others are large. Collectively they sum to $$505,$$ associated with an astronomically small p-value. (Typical values of a $$\chi^2(5)$$ distribution range from $$0.2$$ to $$20,$$ more or less.) We conclude these data did not arise as iid samples from an approximately Normal distribution of mean $$30$$ and SD $$10,$$ because all groups except C have means that are too far from $$30.$$

### Remark

This version of ANOVA is nearly the same as performing $$m$$ separate Z-tests of the groups and combining their p-values using Fisher's Method.. The latter approach would also be valid.

• Originally, it seems that OP was interested in testing both means and variances, Testing variances disappeared in the edit. I am deleting my initial Answer. Oct 19 at 23:36
• @whuber, Thanks whuber, is this similar to order statistics ? Oct 20 at 15:53
• This is unrelated to the usual meaning of "order statistic".
– whuber
Oct 20 at 16:01
• @whuber, thanks whuber. Oct 20 at 16:07