linearmodels.system.model.IV3SLS

class linearmodels.system.model.IV3SLS(equations: Mapping[str, Mapping[str, ndarray | DataArray | DataFrame | Series | None] | Sequence[ndarray | DataArray | DataFrame | Series | None]], *, sigma: ndarray | DataArray | DataFrame | Series | None = None)[source]

Three-stage Least Squares (3SLS) Estimator

Parameters:
equations: Mapping[str, Mapping[str, ndarray | DataArray | DataFrame | Series | None] | Sequence[ndarray | DataArray | DataFrame | Series | None]]

Dictionary-like structure containing dependent, exogenous, endogenous and instrumental variables. Each key is an equations label and must be a string. Each value must be either a tuple of the form (dependent, exog, endog, instrument[, weights]) or a dictionary with keys “dependent”, and at least one of “exog” or “endog” and “instruments”. When using a tuple, values must be provided for all 4 variables, although either empty arrays or None can be passed if a category of variable is not included in a model. The dictionary may contain optional keys for “exog”, “endog”, “instruments”, and “weights”. “exog” can be omitted if all variables in an equation are endogenous. Alternatively, “exog” can contain either an empty array or None to indicate that an equation contains no exogenous regressors. Similarly “endog” and “instruments” can either be omitted or may contain an empty array (or None) if all variables in an equation are exogenous.

sigma: ndarray | DataArray | DataFrame | Series | None = None

Prespecified residual covariance to use in GLS estimation. If not provided, FGLS is implemented based on an estimate of sigma.

Notes

Estimates a set of regressions which are seemingly unrelated in the sense that separate estimation would lead to consistent parameter estimates. Each equation is of the form

\[y_{i,k} = x_{i,k}\beta_i + \epsilon_{i,k}\]

where k denotes the equation and i denoted the observation index. By stacking vertically arrays of dependent and placing the exogenous variables into a block diagonal array, the entire system can be compactly expressed as

\[Y = X\beta + \epsilon\]

where

\[\begin{split}Y = \left[\begin{array}{x}Y_1 \\ Y_2 \\ \vdots \\ Y_K\end{array}\right]\end{split}\]

and

\[\begin{split}X = \left[\begin{array}{cccc} X_1 & 0 & \ldots & 0 \\ 0 & X_2 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & X_K \end{array}\right]\end{split}\]

The system instrumental variable (IV) estimator is

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

where \(\hat{X} = Z(Z'Z)^{-1}Z'X\) and. When certain conditions are satisfied, a GLS estimator of the form

\[\hat{\beta}_{3SLS} = (\hat{X}'\Omega^{-1}\hat{X})^{-1}\hat{X}'\Omega^{-1}Y\]

can improve accuracy of coefficient estimates where

\[\Omega = \Sigma \otimes I_N\]

where \(\Sigma\) is the covariance matrix of the residuals.

Methods

add_constraints(r[, q])

Add parameter constraints to a model.

fit(*[, method, full_cov, iterate, ...])

Estimate model parameters

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

Specify a 3SLS using the formula interface

multivariate_iv(dependent[, exog, endog, ...])

Interface for specification of multivariate IV models

predict(params, *[, equations, data, eval_env])

Predict values for additional data

reset_constraints()

Remove all model constraints

Properties

constraints

Model constraints

formula

Set or get the formula used to construct the model

has_constant

Vector indicating which equations contain constants

param_names

Model parameter names