def cov_hac_simple(results, nlags=None, weights_func=weights_bartlett, use_correction=True):
 (xu, hessian_inv) = _get_sandwich_arrays(results)
 sigma = S_hac_simple(xu, nlags=nlags, weights_func=weights_func)
 cov_hac = _HCCM2(hessian_inv, sigma)
 if use_correction:
  (nobs, k_params) = xu.shape
  cov_hac *= (nobs / float((nobs - k_params)))
 return cov_hac

def cov_hac_simple ( results , nlags = None , weights_func = weights_bartlett , use_correction = True ) : ( xu , hessian_inv ) = _get_sandwich_arrays ( results ) sigma = S_hac_simple ( xu , nlags = nlags , weights_func = weights_func ) cov_hac = _HCCM2 ( hessian_inv , sigma ) if use_correction : ( nobs , k_params ) = xu . shape cov_hac *= ( nobs / float ( ( nobs - k_params ) ) ) return cov_hac
heteroscedasticity and autocorrelation robust covariance matrix assumes we have a single time series with zero axis consecutive .