linearmodels.iv.covariance.kernel_optimal_bandwidth

linearmodels.iv.covariance.kernel_optimal_bandwidth(x: ndarray[Any, dtype[float64]], kernel: str = 'bartlett') int[source]
Parameters:
x: ndarray[Any, dtype[float64]]

Array of data to use when computing optimal bandwidth

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

Returns:

Optimal bandwidth. Set to nobs - 1 if computed bandwidth is larger.

Return type:

int

Notes

Todo

  • Explain mathematics involved

  • References