Name
newey_west — Newey_West variance estimator
CALLING SEQUENCE
nw=newey_west(resid,l)
PARAMETERS
- Input
x = input matrix or vector, (nobs x k)
l = order of lag (optional)
- Output
nw = matrix (or vector) of lags (nobs x k)
DESCRIPTION
Performs the Newey_West variance estimator; if no truncation lag (l) is provided by the user, then it is fixed at floor(5*nobs^0.25).if l <= 0, nw = [] is returned.
EXAMPLE
sigma2=newey_west(r('resid'),l)
This example (taken from kpss) calculates the Newey-West estimator for the residuals (r('resid')) of the regression of the tested variable on a trend, with truncation lag l.