LinearHypothesis函数是什么意思?

时间:2020-04-20 22:13:26

标签: r regression

我在汽车包装中的R中使用它 https://www.rdocumentation.org/packages/car/versions/3.0-7/topics/linearHypothesis

mod.duncan <- lm(prestige ~ income + education, data=Duncan)

## the following are all equivalent:
linearHypothesis(mod.duncan, "1*income - 1*education = 0")
linearHypothesis(mod.duncan, "income = education")
linearHypothesis(mod.duncan, "income - education")
linearHypothesis(mod.duncan, "1income - 1education = 0")
linearHypothesis(mod.duncan, "0 = 1*income - 1*education")
linearHypothesis(mod.duncan, "income-education=0")
linearHypothesis(mod.duncan, "1*income - 1*education + 1 = 1")
linearHypothesis(mod.duncan, "2income = 2*education")

mod.duncan.2 <- lm(prestige ~ type*(income + education), data=Duncan)
coefs <- names(coef(mod.duncan.2))

## test against the null model (i.e., only the intercept is not set to 0)
linearHypothesis(mod.duncan.2, coefs[-1]) 

所以等价公式的块可以写为H0:“ B1-B2 = 0”,对吗? 这意味着它们的局部效果相等吗?并不是说他们共同无关紧要吗?

那么下面的代码是做什么的?

linearHypothesis(mod.duncan.2, coefs[-1]) 

在R中,它返回所有回归变量= 0的假设。无疑这意味着H0:B1 = B2 = B3 = B4 = B5 = 0? 并且说他们共同无关紧要不是那么对吗?

我对自己是否正确解释感到困惑。因为他们似乎矛盾。当然,两个局部效应相等并不意味着它们对因变量没有共同影响吗?但是还有什么其他解释?

请有人让我挺直。谢谢

0 个答案:

没有答案