Checking Type III ANOVA results [duplicate]

自闭症网瘾萝莉.ら 提交于 2019-12-11 06:29:05

问题


Setting aside the debate about Type III ANOVA and the Principle of Marginality and all that...

I've set up two models whose sum of squares should be different (and Type III ANOVA would test that difference). Here's the code:

library(car)
library(openintro)
data(hsb2)
hsb2$gender <- factor(hsb2$gender)
contrasts(hsb2$gender) <- "contr.sum"
contrasts(hsb2$ses) <- "contr.sum"
math_gender_int <- lm(math ~ gender + gender:ses, data = hsb2)
math_gender_ses_int <- lm(math ~ gender + ses + gender:ses, data = hsb2)

Now I should be able to see a difference in the sum of squares between these two models. After all, the "full" model has one more term in it:

anova(math_gender_int, math_gender_ses_int)

But the output shows this:

Analysis of Variance Table

Model 1: math ~ gender + gender:ses
Model 2: math ~ gender + ses + gender:ses
  Res.Df   RSS Df  Sum of Sq F Pr(>F)
1    194 15858                       
2    194 15858  0 -1.819e-12      

What's going on here?

来源:https://stackoverflow.com/questions/43146368/checking-type-iii-anova-results

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!