| lmHAC {dlsem} | R Documentation |
Heteroskedasticty and autocorrelation consistent covariance matrix
Description
The heteroskedasticty and autocorrelation consistent (HAC) covariance matrix of least square estimates (Newey & West, 1978) is applied to an object of class lm. A single group factor may be taken into account.
Usage
lmHAC(x, group = NULL)
Arguments
x |
An object of class |
group |
The name of the group factor (optional). If |
Value
An object of class hac and lm.
The HAC covariance matrix is stored into the component vcov of the object,
which is taken into account by the summary and the vcov methods.
The HAC covariance matrix has the attribute max.lag, indicating the maximum lag of autocorrelation, which is automatically computed based on fit to data.
Note
If group is not NULL, the HAC covariance matrix is computed within each group.
Residuals are assumed to be temporally ordered within each group.
References
W. K. Newey, and K. D. West (1978). A simple, positive semi-definite, heteroskedasticity and autocorrelation consistent covariance matrix. Econometrica, 55(3), 703-708.
Examples
data(industry)
m0 <- lm(Consum ~ -1+Region+ecq(Job,0,5,x.group=Region), data=industry)
summary(m0)
confint(m0)
m0_hac <- lmHAC(m0,group="Region")
summary(m0_hac)
confint(m0_hac)