linearmodels.iv.covariance.KernelCovariance¶
-
class linearmodels.iv.covariance.KernelCovariance(x: ndarray[Any, dtype[float64]], y: ndarray[Any, dtype[float64]], z: ndarray[Any, dtype[float64]], params: ndarray[Any, dtype[float64]], kernel: str =
'bartlett'
, bandwidth: int | float | None =None
, debiased: bool =False
, kappa: int | float =1
)[source]¶ Kernel weighted (HAC) covariance estimation
- Parameters:¶
- x: ndarray[Any, dtype[float64]]¶
Model regressors (nobs by nvar)
- y: ndarray[Any, dtype[float64]]¶
Series ,modeled (nobs by 1)
- z: ndarray[Any, dtype[float64]]¶
Instruments used for endogenous regressors (nobs by ninstr)
- params: ndarray[Any, dtype[float64]]¶
Estimated model parameters (nvar by 1)
- kernel: str =
'bartlett'
¶ Kernel name. Supported kernels are:
”bartlett”, “newey-west” - Triangular kernel
”qs”, “quadratic-spectral”, “andrews” - Quadratic spectral kernel
”parzen”, “gallant” - Parzen’s kernel;
- bandwidth: int | float | None =
None
¶ Non-negative bandwidth to use with kernel. If None, automatic bandwidth selection is used.
- debiased: bool =
False
¶ Flag indicating whether to use a small-sample adjustment
- kappa: int | float =
1
¶ Value of kappa in k-class estimator
Notes
Covariance is estimated using
\[n^{-1} V^{-1} \hat{S} V^{-1}\]where
\[\begin{split}\hat{S}_0 & = n^{-1} \sum_{i=1}^{n} \hat{\epsilon}^2_i \hat{x}_i^{\prime} \hat{x}_{i} \\ \hat{S}_j & = n^{-1} \sum_{i=1}^{n-j} \hat{\epsilon}_i\hat{\epsilon}_{i+j} (\hat{x}_i^{\prime} \hat{x}_{i+j} + \hat{x}_{i+j}^{\prime} \hat{x}_{i}) \\ \hat{S} & = \sum_{i=0}^{bw} K(i, bw) \hat{S}_i\end{split}\]where \(\hat{\gamma}=(Z'Z)^{-1}(Z'X)\), \(\hat{x}_i = z_i\hat{\gamma}\) and \(K(i,bw)\) is a weight that depends on the kernel. If
debiased
is true, then \(S\) is scaled by n / (n-k).\[V = n^{-1} X'Z(Z'Z)^{-1}Z'X\]where \(X\) is the matrix of variables included in the model and \(Z\) is the matrix of instruments, including exogenous regressors.
See also
linearmodels.iv.covariance.kernel_weight_bartlett
,linearmodels.iv.covariance.kernel_weight_parzen
,linearmodels.iv.covariance.kernel_weight_quadratic_spectral
Methods
Properties
Covariance of estimated parameters
Flag indicating if covariance is debiased
HAC score covariance estimate
Estimated variance of residuals.