Robust F Test with PLM regression in R

huangapple go评论60阅读模式
英文:

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(&#39;wooldridge&#39;)
data(wagepan,package=&#39;wooldridge&#39;)
library(&#39;plm&#39;)
pdata&lt;-pdata.frame(wagepan,index=c(&quot;nr&quot;,&quot;year&quot;))
fdreg&lt;-plm(lwage~educ*(d81+d82+d83+d84+d85+d86+d87)+union,data=pdata,model=&quot;fd&quot;)
summary(fdreg)
library(&#39;car&#39;)
H0&lt;-matchCoefs(fdreg,&quot;educ&quot;)
linearHypothesis(fdreg,H0)
linearHypothesis(fdreg,H0,vcov=vcovHC(fdreg,&quot;HC1&quot;))

I'm getting the following error message:

&#39;arg&#39; should be one of “arellano”, “white1”, “white2”

Can anyone help me with this?

答案1

得分: 1

错误发生在linearHypothesis的第二行。
&quot;HC1&quot;是参数type的值,但是您输入的方式使其用于参数method,因为参数的顺序不对(请参考?plm::vcovHC了解参数及其顺序)。

我建议您更改您的行,明确指定参数,例如,

linearHypothesis(fdreg, H0, vcov. = vcovHC(fdreg, type = &quot;HC1&quot;))

线性假设检验

假设:
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.
&quot;HC1&quot; 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 = &quot;HC1&quot;))

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(&gt;Chisq)
1   3807                     
2   3800  7 8.0019     0.3324

huangapple
  • 本文由 发表于 2023年2月16日 09:08:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75466892.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定