nse.nw: Newey-West estimator

Description Usage Arguments Value Note Author(s) References Examples

View source: R/nse.R

Description

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

Usage

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

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.

Value

The NSE estimator.

Note

nse.nw is a wrapper around lrvar from the sandwich package. See the documentation of sandwich for details.

Author(s)

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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)

nse documentation built on April 26, 2021, 1:06 a.m.

Related to nse.nw in nse...