[R] Heteroskedasticity and Autocorrelation in SemiPar package

Liviu Andronic landronimirc at gmail.com
Fri Jun 26 23:05:39 CEST 2009


On Fri, Jun 26, 2009 at 10:11 PM, Susan Chen<suenb16 at yahoo.com> wrote:
> Does anyone know how to report heteroskedasticity and autocorrelation-consistent standard errors when using the "spm" command in SemiPar package? Suppose the original command is
> sp1<-spm(y~x1+x2+f(x3), random=~1,group=id)
>
There's HAC() in library(gmm), which is a modification from the
sandwich::vcovHAC(), designed to accept as input any vectors (and not
only specific objects, such as lm).

The sandwich::vcovHAC() can also be relatively easily extended to
accept other fits as input (not only lm or glm, for example), but this
would require some understanding of the internals of both SemiPar and
sandwich. You might enquire if the author of SemiPar is interested in
adding such functionality. For technical details, check the first
vignette of sandwich.

Once you get HAC covariance matrix for your fit, you can use either
lmtest::coeftest or library(car) to obtain the HAC std errs.
Liviu




More information about the R-help mailing list