Learn R Programming

nse (version 1.21)

nse.nw: Newey-West estimator

Description

Function which calculates the numerical standard error with the Newey West (1987, 1994) HAC estimator.

Usage

nse.nw(x, lag.prewhite = 0)

Value

The NSE estimator.

Arguments

x

A numeric vector

lag.prewhite

Prewhite the series before analysis (integer or NULL). When lag.prewhite = NULL this performs automatic lag selection. Default is lag.prewhite = 0 that is no prewhitening.

Author

David Ardia and Keven Bluteau

References

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.

Examples

Run this code
if (FALSE) {
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)
}

Run the code above in your browser using DataLab