class linearmodels.system.covariance.ClusteredCovariance(x, eps, sigma, full_sigma, *, gls=False, debiased=False, constraints=None, clusters=None, group_debias=False)[source]

Heteroskedastic covariance estimation for system regression

x : list[ndarray]

ndependent element list of regressor

eps : ndarray

Model residuals, ndependent by nobs

sigma : ndarray

Covariance matrix estimator of eps

gls : bool

Flag indicating to compute the GLS covariance estimator. If False, assume OLS was used

debiased : bool

Flag indicating to apply a small sample adjustment

constraints : {None, LinearConstraint}

Constraints used in estimation, if any

clusters : ndarray

Optional array of cluster id. Must be integer valued, and have shape (nobs, ncluster) where ncluster is 1 or 2.

group_debias : bool

Flag indicating whether to debias by the number of groups.


If GLS is used, the covariance is estimated by


where X is a block diagonal matrix of exogenous variables and where \(\tilde{S}_{\mathcal{G}}\) is a clustered estimator of the model scores based on the model residuals and the weighted X matrix \(\Omega^{-1/2}X\).

When GLS is not used, the covariance is estimated by


where \(\hat{S}\) is a clustered estimator of the covariance of the model scores.




Parameter covariance


Optional configuration information used in covariance


Error covariance