rplmlinearhypothesis

Robust F Test with PLM regression in R


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?


Solution

  • 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