Anovan gives contradicting results

1 Ansicht (letzte 30 Tage)
Max
Max am 20 Mär. 2013
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?

Antworten (1)

Tom Lane
Tom Lane am 20 Mär. 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.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by