Anovan gives contradicting results

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?

답변 (1개)

Tom Lane
Tom Lane 2013년 3월 20일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Parallel Computing에 대해 자세히 알아보기

제품

태그

질문:

Max
2013년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by