Anovan gives contradicting results

1 次查看(过去 30 天)
Max
Max 2013-3-20
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
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.

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by