linearmodels.iv.gmm.KernelWeightMatrix

class linearmodels.iv.gmm.KernelWeightMatrix(kernel: str = 'bartlett', bandwidth: int | None = None, center: bool = False, debiased: bool = False, optimal_bw: bool = False)[source]

Heteroskedasticity, autocorrelation robust weight estimation

Parameters:
kernel: str = 'bartlett'

Name of kernel weighting function to use

bandwidth: int | None = None

Bandwidth to use when computing kernel weights

center: bool = False

Flag indicating whether to center the moment conditions by subtracting the mean before computing the weight matrix.

debiased: bool = False

Flag indicating whether to use small-sample adjustments

optimal_bw: bool = False

Flag indicating whether to estimate the optimal bandwidth, when bandwidth is None. If False, nobs - 2 is used

Notes

Supported kernels:

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

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

  • “qs”, “quadratic-spectral”, “andrews” - The quadratic spectral kernel

\[\begin{split}g_i & =z_i \epsilon_i \\ W & =n^{-1}(\Gamma_0+\sum_{j=1}^{n-1}k(j)(\Gamma_j+\Gamma_j')) \\ \Gamma_j & =\sum_{i=j+1}^n g'_i g_{j-j}\end{split}\]

where \(k(j)\) is the kernel weight for lag j and \(z_i\) contains both the exogenous regressors and instruments..

Methods

weight_matrix(x, z, eps)

param x:

Model regressors (exog and endog), (nobs by nvar)

Properties

bandwidth

Actual bandwidth used in estimating the weight matrix

config

Weight estimator configuration