linearmodels.system.gmm.KernelWeightMatrix

class KernelWeightMatrix(center=False, debiased=False, kernel='bartlett', bandwidth=None, optimal_bw=False)[source]

Heteroskedasticity robust weight estimation

Parameters:
centerbool

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

debiasedbool

Flag indicating whether to use small-sample adjustments

kernelstr

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

bandwidthfloat

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

optimal_bwbool

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

Notes

The weight matrix estimator is

\[\begin{split}W & = \hat{\Gamma}_0 + \sum_{i=1}^{n-1} w_i (\hat{\Gamma}_i + \hat{\Gamma}_i^\prime) \\ \hat{\Gamma}_j & = n^{-1}\sum_{i=1}^{n-j} g'_ig_{i+j} \\ g_i & = (z_{1i}\epsilon_{1i},z_{2i}\epsilon_{2i},\ldots,z_{ki}\epsilon_{ki})\end{split}\]

where \(g_i\) is the vector of scores across all equations for observation i and \(w_j\) are the kernel weights which depend on the selected kernel and bandwidth. \(z_{ji}\) is the vector of instruments for equation j and \(\epsilon_{ji}\) is the error for equation j for observation i. This form allows for heteroskedasticity and autocorrelation between the moment conditions.

Attributes:
bandwidth

Bandwidth used to estimate covariance of moment conditions

config

Weight estimator configuration

kernel

Kernel used in estimation

Methods

sigma(eps, x)

Estimate residual covariance.

weight_matrix(x, z, eps, *[, sigma])

Construct a GMM weight matrix for a model.

Properties

bandwidth

Bandwidth used to estimate covariance of moment conditions

config

Weight estimator configuration

kernel

Kernel used in estimation