statsmodels.stats.sandwich_covariance.cov_cluster_2groups

statsmodels.stats.sandwich_covariance.cov_cluster_2groups(results, group, group2=None, use_correction=True)[source]

cluster robust covariance matrix for two groups/clusters

Parameters:
resultsresult instance

result of a regression, uses results.model.exog and results.resid TODO: this should use wexog instead

use_correctionbool

If true (default), then the small sample correction factor is used.

Returns:
cov_bothndarray, (k_vars, k_vars)

cluster robust covariance matrix for parameter estimates, for both clusters

cov_0ndarray, (k_vars, k_vars)

cluster robust covariance matrix for parameter estimates for first cluster

cov_1ndarray, (k_vars, k_vars)

cluster robust covariance matrix for parameter estimates for second cluster

Notes

verified against Peterson’s table, (4 decimal print precision)


Last update: Oct 29, 2024