Description Usage Arguments Value References Examples
Calculate the variance of the mean with the Newey West (1987, 1994) HAC estimator.
This is a wrapper around lrvar from the sandwich package.
1 |
x |
A numeric vector or matrix. |
prewhite |
A bool indicating if the time-serie will be prewhitened before analysis. |
The variance estimator in the univariate case or the variance-covariance matrix estimator in the multivariate case.
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).
1 2 3 4 5 6 7 8 9 10 11 12 13 | n = 1000
ar = c(0.9,0.6)
mean = c(1,5)
sd = c(10,2)
Ts1 = as.vector(arima.sim(n = n, list(ar = ar[1]), sd = sd[1]) + mean[1])
Ts2 = as.vector(arima.sim(n = n, list(ar = ar[2]), sd = sd[2]) + mean[2])
Ts = cbind(Ts1,Ts2)
nse::nse.nw(x = Ts1)
nse::nse.nw(x = Ts)
nse::nse.nw(x = Ts1, prewhite = TRUE)
nse::nse.nw(x = Ts, prewhite = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.