plm-model の f-test を作成してテストしたい
model <- plm(y ~ a + b)
もしも
# a = b
と
# a = 0 and b = 0
私はこのようにlinearHypothesisを試しました
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"))