linearmodels.system.covariance.ClusteredCovariance

class linearmodels.system.covariance.ClusteredCovariance(x: list[ndarray], eps: Float64Array, sigma: Float64Array, full_sigma: Float64Array, *, gls: bool = False, debiased: bool = False, constraints: LinearConstraint | None = None, clusters: IntArray | None = None, group_debias: bool = False)[source]

Heteroskedastic covariance estimation for system regression

Parameters:
x: list[ndarray]

ndependent element list of regressor

eps: Float64Array

Model residuals, ndependent by nobs

sigma: Float64Array

Covariance matrix estimator of eps

gls: bool = False

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

debiased: bool = False

Flag indicating to apply a small sample adjustment

constraints: LinearConstraint | None = None

Constraints used in estimation, if any

clusters: IntArray | None = None

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

group_debias: bool = False

Flag indicating whether to debias by the number of groups.

Notes

If GLS is used, the covariance is estimated by

\[(X'\Omega^{-1}X)^{-1}\tilde{S}_{\mathcal{G}}(X'\Omega^{-1}X)^{-1}\]

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

\[(X'X)^{-1}\hat{S}_{\mathcal{G}}(X'X)^{-1}\]

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

Methods

Properties

cov

Parameter covariance

cov_config

Optional configuration information used in covariance

sigma

Error covariance