nse.andrews: Andrews NSE estimators.

Description Usage Arguments Details Value References Examples

Description

Calculate the variance of the mean with the kernel based variance estimator indtroduced by Andrews (1991).

Usage

1
nse.andrews(x, prewhite = FALSE, type = "Bartlett")

Arguments

x

A numeric vector or matrix.

prewhite

A bool indicating if the time-serie will be prewhitened before analysis.

type

The type of kernel used c("Bartlett","Parzen","Quadratic Spectral","Truncated","Tukey-Hanning").

Details

This is a wrapper around lrvar from the sandwich package and use Andrews (1991) automatic bandwidth estimator.

Value

The variance estimator in the univariate case or the variance-covariance matrix estimator in the multivariate case.

References

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.

Examples

 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
28
29
30
31
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.andrews(x = Ts1, type = "Bartlett")
nse::nse.andrews(x = Ts, type = "Bartlett")
nse::nse.andrews(x = Ts1, prewhite = TRUE, type = "Bartlett")
nse::nse.andrews(x = Ts, prewhite = TRUE, type = "Bartlett")
 
nse::nse.andrews(x = Ts1, type = "Parzen")
nse::nse.andrews(x = Ts, type = "Parzen")
nse::nse.andrews(x = Ts1, prewhite = TRUE, type = "Parzen")
nse::nse.andrews(x = Ts, prewhite = TRUE, type = "Parzen")
 
nse::nse.andrews(x = Ts1, type = "Quadratic Spectral")
nse::nse.andrews(x = Ts, type = "Quadratic Spectral")
nse::nse.andrews(x = Ts1, prewhite = TRUE, type = "Quadratic Spectral")
nse::nse.andrews(x = Ts, prewhite = TRUE, type = "Quadratic Spectral")
 
nse::nse.andrews(x = Ts, type = "Truncated")
nse::nse.andrews(x = Ts1, prewhite = TRUE, type = "Truncated")
nse::nse.andrews(x = Ts, prewhite = TRUE, type = "Truncated")
 
nse::nse.andrews(x = Ts1, type = "Tukey-Hanning")
nse::nse.andrews(x = Ts, type = "Tukey-Hanning")
nse::nse.andrews(x = Ts1, prewhite = TRUE, type = "Tukey-Hanning")
nse::nse.andrews(x = Ts, prewhite = TRUE, type = "Tukey-Hanning")

AmurG/nse documentation built on May 5, 2019, 4:56 a.m.