statsmodels.stats.sandwich_covariance.cov_cluster_2groups#

statsmodels.stats.sandwich_covariance.cov_cluster_2groups(results, group, group2=None, use_correction=True, crv_type='cluster')[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, optional

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

crv_type{“cluster”}, optional

Only ‘cluster’ (default), computing the additive two-way CRV1 combination cov0 + cov1 - cov01, is supported here. Passing ‘cluster-crv3’ or ‘cluster-jk’ raises ValueError; use cov_cluster directly with one-way clustering for those options.

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)