3.11.19.4.3. statsmodels.stats.sandwich_covariance.S_hac_simple

statsmodels.stats.sandwich_covariance.S_hac_simple(x, nlags=None, weights_func=<function weights_bartlett>)[source]

inner covariance matrix for HAC (Newey, West) sandwich

assumes we have a single time series with zero axis consecutive, equal spaced time periods

Parameters:

x : ndarray (nobs,) or (nobs, k_var)

data, for HAC this is array of x_i * u_i

nlags : int or None

highest lag to include in kernel window. If None, then nlags = floor(4(T/100)^(2/9)) is used.

weights_func : callable

weights_func is called with nlags as argument to get the kernel weights. default are Bartlett weights

Returns:

S : ndarray, (k_vars, k_vars)

inner covariance matrix for sandwich

Notes

used by cov_hac_simple

options might change when other kernels besides Bartlett are available.