linearmodels.panel.covariance.HomoskedasticCovariance

class linearmodels.panel.covariance.HomoskedasticCovariance(y: ndarray[tuple[int, ...], dtype[float64]], x: ndarray[tuple[int, ...], dtype[float64]], params: ndarray[tuple[int, ...], dtype[float64]], entity_ids: ndarray[tuple[int, ...], dtype[integer]] | None, time_ids: ndarray[tuple[int, ...], dtype[integer]] | None, *, debiased: bool = False, extra_df: int = 0)[source]

Homoskedastic covariance estimation.

Parameters:
y: ndarray[tuple[int, ...], dtype[float64]]

(entity x time) by 1 stacked array of the dependent variable.

x: ndarray[tuple[int, ...], dtype[float64]]

(entity x time) by variables stacked array of the exogenous variables.

params: ndarray[tuple[int, ...], dtype[float64]]

Variables by 1 array of estimated model parameters.

entity_ids: ndarray[tuple[int, ...], dtype[integer]] | None

(entity x time) by 1 stacked array of entity ids. Not used by this estimator, so it can be None.

time_ids: ndarray[tuple[int, ...], dtype[integer]] | None

(entity x time) by 1 stacked array of time ids. Not used by this estimator, so it can be None.

debiased: bool = False

Flag indicating whether to debias the estimator. The default is False.

extra_df: int = 0

Additional degrees of freedom consumed by models beyond the number of columns in x, e.g., fixed effects. Covariance estimators are always adjusted for extra_df irrespective of the setting of debiased. The default is 0.

Raises:

ValueError – If the model has no residual degrees of freedom: the number of observations less extra_df, and less the number of regressors if debiased is True, is not positive.

Notes

The estimator of the covariance is

\[s^2\hat{\Sigma}_{xx}^{-1}\]

where

\[\hat{\Sigma}_{xx} = X'X\]

and

\[s^2 = (n-df)^{-1} \hat{\epsilon}'\hat{\epsilon}\]

where df is extra_df and n-df is replaced by n-df-k if debiased is True.

Methods

deferred_cov()

Covariance calculation deferred until executed.

Properties

ALLOWED_KWARGS

DEFAULT_KERNEL

cov

Estimated covariance.

eps

Model residuals.

name

Covariance estimator name.

s2

Error variance.