Library: | times |
See also: | rvlm kpss lo |
Quantlet: | neweywest | |
Description: | Calculation of the Newey and West Heteroskedastic and Autocorrelation Consistent estimator of the variance. The first argument of the quantlet represents the series and the second optional argument the vector of truncation lags of the autocorrelation consistent variance estimator. If the second optional argument is missing, the vector of truncation lags is set to m = 5, 10, 25, 50. |
Usage: | q = neweywest(x{,m}) | |
Input: | ||
x | T x 1 vector of time series observations x_t | |
m | optional; k x 1 vector of truncation lags | |
Output: | ||
q | k x 1 vector of Newey and West variance estimators for truncation lags given in m |
;Calculation of the Newey and West variance estimator of ;the first 1000 observations of the series dmus58.dat ;This estimator is calculated for the default truncation ;orders m = 5, 10, 25, 50 library("times") x = read("dmus58.dat") x = x[1:1000] q = neweywest(x) q
Contents of q [1,] 0.0022226 [2,] 0.0040569 [3,] 0.0094627 [4,] 0.018105
;Calculation of the Newey and West variance estimator of ;the first 1000 observations of the series dmus58.dat ;This estimator is calculated for the vector of truncation ;orders m = 10, 15, 20 provided by the user. library("times") x = read("dmus58.dat") x = x[1:1000] m = #(10,15,20) q = neweywest(x,m) q
Contents of q [1,] 0.0040569 [2,] 0.0058755 [3,] 0.0076776