Description Usage Arguments Details Value References Examples
Calculate the variance of the mean with the kernel based variance estimator indtroduced by Andrews (1991).
1 2 | nse.andrews(x, type = c("bartlett", "parzen", "tukey", "qs", "trunc"),
lag.prewhite = 0, approx = c("AR(1)", "ARMA(1,1)"))
|
x |
A numeric vector or matrix. |
type |
The type of kernel used c("bartlett","parzen","qs","trunc","tukey"). |
lag.prewhite |
Prewhite the serie before analysis (integer or NULL, i.e. automatic selection) |
approx |
Andrews approximation c("AR(1)", "ARMA(1,1)") |
This is a wrapper around lrvar from the sandwich package and use Andrews (1991) automatic bandwidth estimator.
The variance estimator in the univariate case or the variance-covariance matrix estimator in the multivariate case.
Zeileis, Achim. "Econometric computing with HC and HAC covariance matrix estimators." (2004).
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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.andrews(x = x, type = "bartlett", lag.prewhite = 0)
nse.andrews(x = x, type = "bartlett", lag.prewhite = 1)
nse.andrews(x = x, type = "bartlett", lag.prewhite = NULL)
nse.andrews(x = x, type = "parzen", lag.prewhite = 0)
nse.andrews(x = x, type = "parzen", lag.prewhite = 1)
nse.andrews(x = x, type = "parzen", lag.prewhite = NULL)
nse.andrews(x = x, type = "tukey", lag.prewhite = 0)
nse.andrews(x = x, type = "tukey", lag.prewhite = 1)
nse.andrews(x = x, type = "tukey", lag.prewhite = NULL)
nse.andrews(x = x, type = "qs", lag.prewhite = 0)
nse.andrews(x = x, type = "qs", lag.prewhite = 1)
nse.andrews(x = x, type = "qs", lag.prewhite = NULL)
nse.andrews(x = x, type = "trunc", lag.prewhite = 0)
nse.andrews(x = x, type = "trunc", lag.prewhite = 1)
nse.andrews(x = x, type = "trunc", lag.prewhite = NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.