Robust F Test with PLM regression in R

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

Robust F Test with PLM regression in R

问题

我正在尝试在R中使用PLM对象运行强健的F-Test。我正在运行以下代码:

  1. library('wooldridge')
  2. data(wagepan, package='wooldridge')
  3. library('plm')
  4. pdata <- pdata.frame(wagepan, index=c("nr", "year"))
  5. fdreg <- plm(lwage ~ educ * (d81 + d82 + d83 + d84 + d85 + d86 + d87) + union, data=pdata, model="fd")
  6. summary(fdreg)
  7. library('car')
  8. H0 <- matchCoefs(fdreg, "educ")
  9. linearHypothesis(fdreg, H0)
  10. linearHypothesis(fdreg, H0, vcov=vcovHC(fdreg, "HC1"))

我遇到以下错误信息:

  1. '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:

  1. library(&#39;wooldridge&#39;)
  2. data(wagepan,package=&#39;wooldridge&#39;)
  3. library(&#39;plm&#39;)
  4. pdata&lt;-pdata.frame(wagepan,index=c(&quot;nr&quot;,&quot;year&quot;))
  5. fdreg&lt;-plm(lwage~educ*(d81+d82+d83+d84+d85+d86+d87)+union,data=pdata,model=&quot;fd&quot;)
  6. summary(fdreg)
  7. library(&#39;car&#39;)
  8. H0&lt;-matchCoefs(fdreg,&quot;educ&quot;)
  9. linearHypothesis(fdreg,H0)
  10. linearHypothesis(fdreg,H0,vcov=vcovHC(fdreg,&quot;HC1&quot;))

I'm getting the following error message:

  1. &#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了解参数及其顺序)。

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

  1. 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.,

  1. linearHypothesis(fdreg, H0, vcov. = vcovHC(fdreg, type = &quot;HC1&quot;))
  2. Linear hypothesis test
  3. Hypothesis:
  4. educ:d81 = 0
  5. educ:d82 = 0
  6. educ:d83 = 0
  7. educ:d84 = 0
  8. educ:d85 = 0
  9. educ:d86 = 0
  10. educ:d87 = 0
  11. Model 1: restricted model
  12. Model 2: lwage ~ educ * (d81 + d82 + d83 + d84 + d85 + d86 + d87) + union
  13. Note: Coefficient covariance matrix supplied.
  14. Res.Df Df Chisq Pr(&gt;Chisq)
  15. 1 3807
  16. 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:

确定