nse.andrews: Andrews estimator

View source: R/nse.R

nse.andrewsR Documentation

Andrews estimator

Description

Function which calculates the numerical standard error with the kernel based variance estimator by Andrews (1991).

Usage

nse.andrews(
  x,
  type = c("bartlett", "parzen", "tukey", "qs", "trunc"),
  lag.prewhite = 0,
  approx = c("AR(1)", "ARMA(1,1)")
)

Arguments

x

A numeric vector.

type

The type of kernel used among which "bartlett", "parzen", "qs", "trunc" and "tukey". Default is type = "bartlett".

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.

approx

Andrews approximation, either "AR(1)" or "ARMA(1,1)". Default is approx = "AR(1)".

Details

This kernel based variance estimation apply weight to the auto-covariance function with a kernel and sums up the value.

Value

The NSE estimator.

Note

nse.andrews is a wrapper around lrvar from the sandwich package and uses Andrews (1991) automatic bandwidth estimator. See the documentation of sandwich for details.

Author(s)

David Ardia and Keven Bluteau

References

Andrews, D.W.K. (1991). Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica 59(3), 817-858.

Andrews, D.W.K, Monahan, J.C. (1992). An improved heteroskedasticity and autocorrelation consistent covariance matrix estimator. Econometrica 60(4), 953-966.

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

## 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.andrews(x = x, type = "parzen", lag.prewhite = 0)
nse.andrews(x = x, type = "tukey", lag.prewhite = 1)
nse.andrews(x = x, type = "qs", lag.prewhite = NULL)

## End(Not run)

keblu/nse documentation built on Nov. 16, 2022, 2:18 p.m.