I'm not particularly advanced when it comes to statistics and data analysis and have a problem I can't seem to solve. Basically, suppose you're doing school research and have three groups (to which student participants have been randomly assigned) - a control group, and two experimental groups. Your whole participant pool is say 27 students (tiny I know, but helps with the example)

However, within each group you have clusters of students who belong to the same class. For example, within the control group there are 3 students who all belong to class A, 3 who all belong to Class B, and 3 who all belong to class C. Same situation for the other two groups - within each there are small clusters of students (e.g. 3-5 students) who all belong to the same class.

The situation looks like this:

enter image description here

Now I get that there's a problem here and that the problem is one of "clustered data." One solution that has been suggested to me is "de-meaning" for each class, in other words:

Step 1: Calculate the mean for each class (e.g. Class A) Step 2: Subtract the mean for each class from every observation in that class

Now the means of each class become 0 and there are no longer any "between class" differences. This (apparently) gets rid of the clustering problem. You might end up with a set of data that looks like this:

"De-meaned" data

My first question is: is this a good solution to the problem?

My second question is essentially: what do you do next?

I'm assuming you could now just run a normal one-way ANOVA on the data, just as you would have done with the "raw" data if there hadn't been any clustering.

But I've gathered from posts elsewhere that you have to "correct the degrees of freedom" or something like that, because you've "used up" some of them in estimating the means for each class. Can somebody explain this?

Thanks so much for your help! Really appreciate it as this is doing my head in,



  • $\begingroup$ It seems to me that you can do a two-way ANOVA with the original data. $\endgroup$ – Ertxiem - reinstate Monica Mar 27 '19 at 14:54
  • $\begingroup$ Thank you Ertxiem - that option occurred to me too. Somebody told me that the "de-meaning" approach ends up being equivalent to a two-way ANOVA (with original) data as well. Possibly they are the same thing mathematically? $\endgroup$ – newbie34 Mar 27 '19 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.