Function which calculates the numerical standard error with the kernel based variance estimator by Andrews (1991).
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)".
Returns
The NSE estimator.
Details
This kernel based variance estimation apply weight to the auto-covariance function with a kernel and sums up the value.
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.
Examples
## Not run:n =1000ar =0.9mean =1sd =1set.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)