linearmodels.iv.model.IV2SLS

class linearmodels.iv.model.IV2SLS(dependent: IVData | ndarray | DataArray | DataFrame | Series, exog: IVData | ndarray | DataArray | DataFrame | Series | None, endog: IVData | ndarray | DataArray | DataFrame | Series | None, instruments: IVData | ndarray | DataArray | DataFrame | Series | None, *, weights: IVData | ndarray | DataArray | DataFrame | Series | None = None)[source]

Estimation of IV models using two-stage least squares

Parameters:
dependent: IVData | ndarray | DataArray | DataFrame | Series

Endogenous variables (nobs by 1)

exog: IVData | ndarray | DataArray | DataFrame | Series | None

Exogenous regressors (nobs by nexog)

endog: IVData | ndarray | DataArray | DataFrame | Series | None

Endogenous regressors (nobs by nendog)

instruments: IVData | ndarray | DataArray | DataFrame | Series | None

Instrumental variables (nobs by ninstr)

weights: IVData | ndarray | DataArray | DataFrame | Series | None = None

Observation weights used in estimation

Notes

The 2SLS estimator is defined

\[\begin{split}\hat{\beta}_{2SLS} & =(X'Z(Z'Z)^{-1}Z'X)^{-1}X'Z(Z'Z)^{-1}Z'Y\\ & =(\hat{X}'\hat{X})^{-1}\hat{X}'Y\\ \hat{X} & =Z(Z'Z)^{-1}Z'X\end{split}\]

The 2SLS estimator is a special case of a k-class estimator with \(\kappa=1\),

Todo

  • VCV: bootstrap

Methods

estimate_parameters(x, y, z, kappa)

Parameter estimation without error checking

fit(*[, cov_type, debiased])

Estimate model parameters

from_formula(formula, data, *[, weights])

predict(params, *[, exog, endog, data, eval_env])

Predict values for additional data

resids(params)

Compute model residuals

wresids(params)

Compute weighted model residuals

Properties

formula

Formula used to create the model

has_constant

Flag indicating the model includes a constant or equivalent

isnull

Locations of observations with missing values

notnull

Locations of observations included in estimation