# Testing whether the mean of a group is different from the mean of the entire sample

I have the mean and standard deviation of a large sample (30k obs) and the mean and std of a subsample (2k obs). The means are percentage figures (i.e. between 0 and 100% and hence not a normal variate). Also the means are not independent, since one is based on a subsample from the other.

Despite seemingly a harmless question, I could not find an appropriate testing procedure. Any ideas on how to test whether the mean of the subsample is different to the mean of the entire sample are much appreciated.

• Why? "Why" would matter here. – John Jan 24 '14 at 11:26
• A two-sample z or t test (subsample vs rest) would provide an answer. But as @john mentioned, why would this be of any relevance? You can just compare the means and judge by eye if they are similar or not. – Michael M Jan 24 '14 at 16:06
• You can tell if the sample means differ simply by direct inspection (they either differ or they don't). Presumably you want to perform inference on some subpopulation against a population. When you say the means are percentages, do you mean they're scaled counts (as a proportion of the total), for example, something akin to "the proportion of females"? – Glen_b Jan 25 '14 at 4:04
• Hi Glen_b, we are talking about the means across percentage figures. I.e. the mean of sample A is the mean probability a person in sample A smokes. – pka24 Jan 27 '14 at 10:43

Instead of testing subsample vs. whole sample, test subsample vs. those not in subsample. Then you can test the difference in proportions with a chi square test, since it sounds like they must be being tested on some other categorical variable or, if you prefer, you can do logistic regression with the percent agreement thing (whatever variable that is) being the dependent variable and "being in the subsample" as the IV.

Logistic regression treats one variable as dependent and the other as independent, while chi-square treats the two variables equally. Also, logistic regression would allow you (if you have data) to add other variables to the equation.

Response to comment Since the whole sample = 30,000 and 50% have whatever it is, that means that divides 15,000 and 15,000. The subsample is 2,000 with 45% having whatever it is, so that's 900 and 1,100. That means those NOT in the subsample are (15,000-900) and (15,000 - 1,100) = 14,100 and 13,900. Now you can do chi square test on the table:

              Yes      No
Sub           900     1,100
Not sub    14,100    13,900

• Hi Peter, thanks for sharing your thoughts. Unfortunately I dont have the dataset the means are based on; thus making the comparison that bit more difficult. Any more ideas what one might do to test if the means differ? – pka24 Jan 24 '14 at 11:52
• Please edit your question to say exactly what data you do have. – Peter Flom Jan 24 '14 at 12:16
• Let A be the entire sample. Available are number of elements in A (e.g. 30k), the mean (e.g. 50%) and the standard deviation (e.g. 20%). The same information is also available for subsample B (i.e. N=2k, mean=45%, std=10%). Sorry for not being clear enough in the first place. – pka24 Jan 24 '14 at 12:26
• It is still unclear. Peter's answer assumes you are reporting on proportions of the data; in other words, that you have a summary of binary indicators (which can only have the values 0 or 1). The examples in your comment are inconsistent with such a dataset and suggest rather that each individual observation is a number between 0 and 100%, in which case the present answer would be wrong. Which is the correct interpretation? – whuber Jan 24 '14 at 21:08
• Yes whuber, your interpretation is correct. Each observation is between 0 and 1 and thus not binary. Do you have a smart idea on how to evaluate whether the means differ? – pka24 Jan 27 '14 at 10:40