# linearmodels.iv.model.IV2SLS¶

class IV2SLS(dependent, exog, endog, instruments, *, weights=None)[source]

Estimation of IV models using two-stage least squares

Parameters:
dependentarray_like

Endogenous variables (nobs by 1)

exogarray_like

Exogenous regressors (nobs by nexog)

endogarray_like

Endogenous regressors (nobs by nendog)

instrumentsarray_like

Instrumental variables (nobs by ninstr)

weightsarray_like

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

Attributes:
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

Methods

 estimate_parameters(x, y, z, kappa) Parameter estimation without error checking fit(*[, cov_type, debiased]) Estimate model parameters from_formula(formula, data, *[, weights]) Parameters: 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