linearmodels.system.covariance.KernelCovariance

class linearmodels.system.covariance.KernelCovariance(x: list[numpy.ndarray], eps: linearmodels.typing.data.Float64Array, sigma: linearmodels.typing.data.Float64Array, full_sigma: linearmodels.typing.data.Float64Array, *, gls: bool = False, debiased: bool = False, constraints: LinearConstraint | None = None, kernel: str = 'bartlett', bandwidth: float | None = None)[source]

Kernel (HAC) covariance estimation for system regression

Parameters:
x: list[numpy.ndarray]

ndependent element list of regressor

eps: linearmodels.typing.data.Float64Array

Model residuals, ndependent by nobs

sigma: linearmodels.typing.data.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

kernel: str = 'bartlett'

Name of kernel to use. Supported kernels include:

  • ”bartlett”, “newey-west” : Bartlett’s kernel

  • ”parzen”, “gallant” : Parzen’s kernel

  • ”qs”, “quadratic-spectral”, “andrews” : Quadratic spectral kernel

bandwidth: float | None = None

Bandwidth to use for the kernel. If not provided the optimal bandwidth will be estimated.

Notes

If GLS is used, the covariance is estimated by

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

where X is a block diagonal matrix of exogenous variables and where \(\tilde{S}\) is a estimator of the covariance 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}(X'X)^{-1}\]

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

Methods

Properties

bandwidth

Bandwidth used in estimation

cov

Parameter covariance

cov_config

Optional configuration information used in covariance

kernel

Kernel used in estimation

sigma

Error covariance