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

groupndarray

Group/cluster indicator for the first cluster dimension. If group2 is not given, group must be a 2-D array with two columns, one for each cluster dimension.

group2ndarray, optional

Group/cluster indicator for the second cluster dimension.

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)