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, default None

Observation weights used in estimation

See also

IVLIML, IVGMM, IVGMMCUE

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, float])

Parameter estimation without error checking

fit(self, \*, cov_type, debiased, \*\*cov_config)

Estimate model parameters

from_formula(formula, data, \*, weights, …)

Parameters

predict(self, params, …)

Predict values for additional data

resids(self, params)

Compute model residuals

wresids(self, 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