Learn R Programming

nse (version 1.21)

nse.andrews: 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)")
)

Value

The NSE estimator.

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)".

Author

David Ardia and Keven Bluteau

Details

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

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

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.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)
}

Run the code above in your browser using DataLab