linearmodels.iv.absorbing.AbsorbingLS.fit

AbsorbingLS.fit(*, cov_type: str = 'robust', debiased: bool = False, method: str = 'auto', absorb_options: None | dict[str, bool | float | str | ndarray | DataArray | DataFrame | Series | None | dict[str, Any]] = None, use_cache: bool = True, lsmr_options: dict[str, float | bool] | None = None, **cov_config: Any) AbsorbingLSResults[source]

Estimate model parameters

Parameters:
cov_type: str = 'robust'

Name of covariance estimator to use. Supported covariance estimators are:

  • ”unadjusted”, “homoskedastic” - Classic homoskedastic inference

  • ”robust”, “heteroskedastic” - Heteroskedasticity robust inference

  • ”kernel” - Heteroskedasticity and autocorrelation robust inference

  • ”cluster” - One-way cluster dependent inference. Heteroskedasticity robust

debiased: bool = False

Flag indicating whether to debiased the covariance estimator using a degree of freedom adjustment.

method: str = 'auto'

One of:

  • ”auto” - (Default). Use HDFE when applicable and fallback to LSMR.

  • ”lsmr” - Force LSMR.

  • ”hdfe” - Force HDFE. Raises RuntimeError if the model contains continuous variables or continuous-binary interactions to absorb or if the model is weighted.

absorb_options: None | dict[str, bool | float | str | ndarray | DataArray | DataFrame | Series | None | dict[str, Any]] = None

Dictionary of options to pass to the absorber. Passed to either scipy.sparse.linalg.lsmr or pyhdfe.create depending on the method used to absorb the absorbed regressors.

use_cache: bool = True

Flag indicating whether the variables, once purged from the absorbed variables and interactions, should be stored in the cache, and retrieved if available. Cache can dramatically speed up re-fitting large models when the set of absorbed variables and interactions are identical.

lsmr_options: dict[str, float | bool] | None = None

Options to ass to scipy.sparse.linalg.lsmr.

Deprecated since version 4.17: Use absorb_options to pass options

**cov_config: Any

Additional parameters to pass to covariance estimator. The list of optional parameters differ according to cov_type. See the documentation of the alternative covariance estimators for the complete list of available commands.

Returns:

Results container

Return type:

linearmodels.iv.absorbing.AbsorbingLSResults

Notes

Additional covariance parameters depend on specific covariance used. The see the docstring of specific covariance estimator for a list of supported options. Defaults are used if no covariance configuration is provided.

If use_cache is True, then variables are hashed based on their contents using either a 64-bit value (if xxhash is installed) or a 256-bit value. This allows variables to be reused in different models if the set of absorbing variables and interactions is held constant.