14. The repeated-measures ANOVA | explained with a simple example

one-way ANOVA vs repeated-measures ANOVA

The difference from the one-way ANOVA is that the denominator is repeated-measures ANOVA does not include the variance between the subjects.
在这里插入图片描述

Example data

The weights, in kg, of four individuals have been measured before a certain diet, and then two and four weeks after starting the diet.
在这里插入图片描述
The null hypothesis is same as one-way ANOVA, the population mean weight is the same over the four weeks when people try this diet, we set the significance level is 0.05 in this example.

Repeated-measures ANOVA

The only difference from the one-way ANOVA is that the sum of squares within-groups is divided into between-subjects variation and an error term.
The error term is the variation that is left after we have removed the between-subjects variation from the within-group variation.

First, we can calculate variance within groups, SSW is calculated by following way:
在这里插入图片描述
Note that the variation within the first group involves the variation in weights between the four individuals before diet. This variation has nothing to do with the effect of the diet. This is the reason why we will remove it in a later step.

Next, we calculate variance between groups, SSB is calculate by the following formula:
在这里插入图片描述
SST can also be calculated as the sum of SSB and SSW.
在这里插入图片描述
Then, we must calculate variance between subjects, the SSS is calculated by following formula:
在这里插入图片描述
Then, we can calculate the term of error, which is simply the total within sum of squares minus the sum of squares for the subjects.
在这里插入图片描述
The degrees of freedom between-groups is the number of groups minus one;
The degrees of freedom within-groups is the total number of data points minus number of groups;
The degrees of freedom between subjects is the number of subjects minus 1;
The degrees of freedom for the error is the degrees of freedom of the total within-group variance minus the degrees of freedom for the subjects;
The degrees of freedom for the total sum of squares is the total number of data points minus one.
在这里插入图片描述

Next, we calculate the mean squares, which is simply the sum of squares divided by the corresponding degrees of freedom.
在这里插入图片描述
We can calculate F-ratio, which is the mean square of variance between groups divided by variance in error.
在这里插入图片描述
With the degree 2 and 6, we can get the area of t-distribution, which is our p value.
在这里插入图片描述
Because p value is below 0.05, so, we reject null hypothesis, we think at least two of the groups have a significance difference means.
在这里插入图片描述
To check which means that are different, we could run three separate paired t-tests. Only significant difference that can be observed is when we compare the first and third time-point.
在这里插入图片描述

Results comparison between one-way / repeated ANOVA

The one-way ANOVA uses the total within variance in the denominator when calculating the F-ratio because it assumes that the groups contain observations of independent individuals, whereas the repeated-measures ANOVA removes the variance between the subjects because we are interested in how much each individual reduces in weight and not the variance in weights between the individuals.
在这里插入图片描述

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐