NW_lrv {EncompassTest}R Documentation

Long-run covariance estimation using Newey-West (Bartlett) weights

Description

Given a vector of residuals, it generates the Heteroskedastic Long run variance.

Usage

NW_lrv(u, nlag = NULL, demean = TRUE)

Arguments

u

a vector of residual series, for which we recommend to use the recursive residuals from larger model.

nlag

Non-negative integer containing the lag length to use. If empty or not included, nleg = min(floor(1.2*T^(1/3)),T) will be used.

demean

Logical true of false (0 or 1) indicating whether the mean should be subtracted when computing.

Value

K by K vector of Long run variance using Newey-West (Bartlett) weights.

Examples

x<- rnorm(15);
#Newey-West covariance with automatic BW selection
lrcov = NW_lrv(x)
#Newey-West covariance with 10 lags
lrcov = NW_lrv(x, 10)
#Newey-West covariance with 10 lags and no demeaning
lrcov = NW_lrv(x, 10, 0)

[Package EncompassTest version 0.22 Index]