我想对 plm 模型进行 f 测试并测试
model <- plm(y ~ a + b)
如果
# a = b
和
# a = 0 and b = 0
我试过这样的线性假设
linearHypothesis(ur.model, c("a", "b")) to test for a = 0 and b = 0
但得到了错误
Error in constants(lhs, cnames_symb) :
The hypothesis "sgp1" is not well formed: contains bad coefficient/variable names.
Calls: linearHypothesis ... makeHypothesis -> rbind -> Recall -> makeHypothesis -> constants
In addition: Warning message:
In constants(lhs, cnames_symb) : NAs introduced by coercion
Execution halted
如果问题很简单,我上面的示例是稍微简化的代码。如果问题出在细节上,这里就是实际的代码。
model3 <- formula(balance.agr ~ sgp1 + sgp2 + cp + eu + election + gdpchange.imf + ue.ameco)
ur.model<-plm(model3, data=panel.l.fullsample, index=c("country","year"), model="within", effect="twoways")
linearHypothesis(ur.model, c("sgp1", "sgp2"), vcov.=vcovHC(plmmodel1, method="arellano", type = "HC1", clustering="group"))