Search code examples
data-analysisstatsmodels

Difference between 'hac-groupsum' and `hac-panel’ for statsmodels robust covariance


I'm looking at the cov_type for robust covariance estimation in statsmodels by statsmodels.regression.linear_model.RegressionResults.get_robustcov_results, and it looks to me both hac-groupsum and hac-panel can both be applied to panel data for robust covariance estimation, what is the difference between those two?


Solution

  • According to https://www.statsmodels.org/devel/generated/statsmodels.regression.linear_model.OLSResults.get_robustcov_results.html

    hac-groupsum is

    Driscoll and Kraay, heteroscedasticity and autocorrelation robust covariance for panel data

    While hac-panel is

    heteroscedasticity and autocorrelation robust standard errors in panel data. The data needs to be sorted in this case, the time series for each panel unit or cluster need to be stacked. The membership to a time series of an individual or group can be either specified by group indicators or by increasing time periods. One of groups or time is required.

    hac-panel has defined groups also while hac-groupsum doesn't have that input.

    The code for this is found here from lines 293 - 344. https://coveralls.io/builds/26080820/source?filename=statsmodels%2Fbase%2Fcovtype.py