英文:
Robust F Test with PLM regression in R
问题
我正在尝试在R中使用PLM对象运行强健的F-Test。我正在运行以下代码:
library('wooldridge')
data(wagepan, package='wooldridge')
library('plm')
pdata <- pdata.frame(wagepan, index=c("nr", "year"))
fdreg <- plm(lwage ~ educ * (d81 + d82 + d83 + d84 + d85 + d86 + d87) + union, data=pdata, model="fd")
summary(fdreg)
library('car')
H0 <- matchCoefs(fdreg, "educ")
linearHypothesis(fdreg, H0)
linearHypothesis(fdreg, H0, vcov=vcovHC(fdreg, "HC1"))
我遇到以下错误信息:
'arg' should be one of “arellano”, “white1”, “white2”
有人可以帮我解决这个问题吗?
英文:
I'm trying to run a robust F-Test using a PLM object in R. I'm running the following code:
library('wooldridge')
data(wagepan,package='wooldridge')
library('plm')
pdata<-pdata.frame(wagepan,index=c("nr","year"))
fdreg<-plm(lwage~educ*(d81+d82+d83+d84+d85+d86+d87)+union,data=pdata,model="fd")
summary(fdreg)
library('car')
H0<-matchCoefs(fdreg,"educ")
linearHypothesis(fdreg,H0)
linearHypothesis(fdreg,H0,vcov=vcovHC(fdreg,"HC1"))
I'm getting the following error message:
'arg' should be one of “arellano”, “white1”, “white2”
Can anyone help me with this?
答案1
得分: 1
错误发生在linearHypothesis
的第二行。
"HC1"
是参数type
的值,但是您输入的方式使其用于参数method
,因为参数的顺序不对(请参考?plm::vcovHC
了解参数及其顺序)。
我建议您更改您的行,明确指定参数,例如,
linearHypothesis(fdreg, H0, vcov. = vcovHC(fdreg, type = "HC1"))
线性假设检验
假设:
educ:d81 = 0
educ:d82 = 0
educ:d83 = 0
educ:d84 = 0
educ:d85 = 0
educ:d86 = 0
educ:d87 = 0
模型1:受限制模型
模型2:lwage ~ educ * (d81 + d82 + d83 + d84 + d85 + d86 + d87) + union
注意:提供了系数协方差矩阵。
Res.Df Df Chisq Pr(>Chisq)
1 3807
2 3800 7 8.0019 0.3324
英文:
The error occurs in the 2nd line for linearHypothesis
.
"HC1"
is a value for argument type
but the way you input it, it is used for argument method
due to order of arguments (see ?plm::vcovHC
for the arguments and their order).
I suggest you change your line to specify the argument explicitly, e.g.,
linearHypothesis(fdreg, H0, vcov. = vcovHC(fdreg, type = "HC1"))
Linear hypothesis test
Hypothesis:
educ:d81 = 0
educ:d82 = 0
educ:d83 = 0
educ:d84 = 0
educ:d85 = 0
educ:d86 = 0
educ:d87 = 0
Model 1: restricted model
Model 2: lwage ~ educ * (d81 + d82 + d83 + d84 + d85 + d86 + d87) + union
Note: Coefficient covariance matrix supplied.
Res.Df Df Chisq Pr(>Chisq)
1 3807
2 3800 7 8.0019 0.3324
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论