statsmodels.stats.sandwich_covariance.cov_nw_panel(results, nlags, groupidx, weights_func=<function weights_bartlett>, use_correction='hac')
[source]
Panel HAC robust covariance matrix
Assumes we have a panel of time series with consecutive, equal spaced time periods. Data is assumed to be in long format with time series of each individual stacked into one array. Panel can be unbalanced.
Parameters: |
|
---|---|
Returns: |
cov – HAC robust covariance matrix for parameter estimates |
Return type: |
ndarray, (k_vars, k_vars) |
For nlags=0, this is just White covariance, cov_white. If kernel is uniform, weights_uniform
, with nlags equal to the number of observations per unit in a balance panel, then cov_cluster and cov_hac_panel are identical.
Tested against STATA newey
command with same defaults.
Options might change when other kernels besides Bartlett and uniform are available.
© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.stats.sandwich_covariance.cov_nw_panel.html