nse.nw | R Documentation |
Function which calculates the numerical standard error with the Newey West (1987, 1994) HAC estimator.
nse.nw(x, lag.prewhite = 0)
x |
A numeric vector |
lag.prewhite |
Prewhite the series before analysis (integer or |
The NSE estimator.
nse.nw
is a wrapper around lrvar
from
the sandwich
package. See the documentation of sandwich
for details.
David Ardia and Keven Bluteau
Newey, W.K., West, K.D. (1987). A simple, positive semi-definite, heteroskedasticity and autocorrelationconsistent covariance matrix. Econometrica 55(3), .703-708.
Newey, W.K., West, K.D. (1994) . Automatic lag selection in covariance matrix estimation. Review of Economic Studies 61(4), .631-653.
## Not run: n = 1000 ar = 0.9 mean = 1 sd = 1 set.seed(1234) x = c(arima.sim(n = n, list(ar = ar), sd = sd) + mean) nse.nw(x = x, lag.prewhite = 0) nse.nw(x = x, lag.prewhite = 1) nse.nw(x = x, lag.prewhite = NULL) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.