[R] sandwich package: HAC estimators

T.Riedle tr206 at kent.ac.uk
Sat May 28 19:01:50 CEST 2016


Dear R users,

I am running a logistic regression using the rms package and the code looks as follows:

crisis_bubble4<-lrm(stock.market.crash~crash.MA+bubble.MA+MP.MA+UTS.MA+UPR.MA+PPI.MA+RV.MA,data=Data_logitregression_movingaverage)

Now, I would like to calculate HAC robust standard errors using the sandwich package assuming the NeweyWest estimator which looks as follows:


coeftest(crisis_bubble4,df=Inf,vcov=NeweyWest)

Error in match.arg(type) :

  'arg' should be one of "li.shepherd", "ordinary", "score", "score.binary", "pearson", "deviance", "pseudo.dep", "partial", "dfbeta", "dfbetas", "dffit", "dffits", "hat", "gof", "lp1"

As you can see, it doesn't work. Therefore, I did the same using the glm() instead of lrm():


crisis_bubble4<-glm(stock.market.crash~crash.MA+bubble.MA+MP.MA+UTS.MA+UPR.MA+PPI.MA+RV.MA,family=binomial("logit"),data=Data_logitregression_movingaverage)



If I use the coeftest() function, I get following results.

coeftest(crisis_bubble4,df=Inf,vcov=NeweyWest)



z test of coefficients:



              Estimate Std. Error z value Pr(>|z|)

(Intercept)   -5.26088    5.01706 -1.0486  0.29436

crash.MA       0.49219    2.41688  0.2036  0.83863

bubble.MA     12.12868    5.85228  2.0725  0.03822 *

MP.MA        -20.07238  499.37589 -0.0402  0.96794

UTS.MA       -58.18142   77.08409 -0.7548  0.45038

UPR.MA      -337.57985  395.35639 -0.8539  0.39318

PPI.MA       729.37693  358.60868  2.0339  0.04196 *

RV.MA        116.00106   79.52421  1.4587  0.14465

---

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


I am unsure whether the coeftest from the lmtest package is appropriate in case of a logistic regression. Is there another function for logistic regressions? Furthermore, I would like to present the regression coefficients, the F-statistic and the HAC estimators in one single table. How can I do that?

I thought it would be useful to incorporate the HAC consistent covariance matrix into the logistic regression directly and generate an output of coefficients and the corresponding standard errors. Is there such a function in R?

Thanks for your support.

Kind regards

	[[alternative HTML version deleted]]



More information about the R-help mailing list