# linearmodels.iv.model.IV2SLS¶

class linearmodels.iv.model.IV2SLS(dependent: , exog: , endog: , instruments: , *, weights: = None)[source]

Estimation of IV models using two-stage least squares

Parameters:
dependent:

Endogenous variables (nobs by 1)

exog:

Exogenous regressors (nobs by nexog)

endog:

Endogenous regressors (nobs by nendog)

instruments:

Instrumental variables (nobs by ninstr)

weights: = 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