Anovan gives contradicting results
1 view (last 30 days)
Show older comments
I was playing around with the toy example on this page: http://www.mathworks.co.uk/help/stats/anovan.html And I tried the following:
y = [52.7 57.5 45.9 44.5 53.0 57.0 45.9 44.0]';
g1 = [1 2 1 2 1 2 1 2];
g2 = {'hi';'hi';'lo';'lo';'hi';'hi';'lo';'lo'};
g3 = {'may';'may';'may';'may';'june';'june';'june';'june'};
p_0 = anovan(y, {g1})
p_1 = anovan(y, {g1 g2})
p_2 = anovan(y, {g1 g2 g3})
which gives:
p_0 =
0.7577
p_1 =
0.3596
0.0007
p_3 =
0.4174
0.0028
0.9140
But I would expect p_0[0], p_1[0], p_2[0] to be the same. But they are not? Can anybody explain me why?
0 Comments
Answers (1)
Tom Lane
on 20 Mar 2013
This is a balanced design, so the sum of squares explained by g1 is indeed the same in each case. But its F statistic and p-value are not. That's because the F statistic is the ratio of the terms mean square to the error mean square. As you add more terms, the error mean square changes.
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!