nse.nw: Newey-West NSE estimators.

Description Usage Arguments Value References Examples

Description

Calculate the variance of the mean with the Newey West (1987, 1994) HAC estimator.

This is a wrapper around lrvar from the sandwich package.

Usage

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

Arguments

x

A numeric vector or matrix.

lag.prewhite

Prewhite the serie before analysis (integer or NULL, i.e. automatic selection)

Value

The variance estimator in the univariate case or the variance-covariance matrix estimator in the multivariate case.

References

Andrews, Donald WK. "Heteroskedasticity and autocorrelation consistent covariance matrix estimation." Econometrica: Journal of the Econometric Society 59.03 (1991): 817-858.

Newey, Whitney K., and Kenneth D. West. "A simple, positive semi-definite, heteroskedasticity and autocorrelationconsistent covariance matrix.", Econometrica: Journal of the Econometric Society 55.03 (1987) : 703-708.

Newey, Whitney K., and Kenneth D. West. "Automatic lag selection in covariance matrix estimation." The Review of Economic Studies 61.4 (1994): 631-653.

Zeileis, Achim. "Econometric computing with HC and HAC covariance matrix estimators." (2004).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
n    = 1000
ar   = 0.9
mean = 1
sd   = 1

set.seed(1234)   
x = as.vector(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)

braverock/nse documentation built on May 13, 2019, 5:03 a.m.