Skip to content

IV - Instrumental Variables

Overview

The IV (Instrumental Variables) estimator provides consistent estimation for exactly identified models where regressors are endogenous. It addresses the endogeneity problem by using instrumental variables to obtain consistent parameter estimates when OLS would be biased.

Mathematical Foundation

The IV method addresses endogeneity in the structural equation:

\[ \mathbf{y} = \mathbf{X}\mathbf{\beta} + \mathbf{\epsilon} \]

where \(\text{Cov}(\mathbf{X}, \mathbf{\epsilon}) \neq 0\) (endogeneity problem).

Instrumental Variables Requirements

For valid instruments \(\mathbf{Z}\):

  1. Instrument Relevance: \(\text{Cov}(\mathbf{Z}, \mathbf{X}) \neq 0\)
  2. Instrument Exogeneity: \(\text{Cov}(\mathbf{Z}, \mathbf{\epsilon}) = 0\)
  3. Exact Identification: \(\text{dim}(\mathbf{Z}) = \text{dim}(\mathbf{X})\)

IV Estimator

For exactly identified models:

\[ \hat{\mathbf{\beta}}_{IV} = (\mathbf{Z}'\mathbf{X})^{-1}\mathbf{Z}'\mathbf{y} \]

Covariance Matrix: \(\text{Var}(\hat{\mathbf{\beta}}_{IV}) = \sigma^2(\mathbf{Z}'\mathbf{X})^{-1}(\mathbf{Z}'\mathbf{Z})(\mathbf{Z}'\mathbf{X})^{-1}\)

API Reference

Constructor

IV(fit_intercept=True)

Parameters: - fit_intercept (bool): Whether to calculate the intercept for this model.

Methods

fit()

fit(instruments, regressors, targets) -> None
Fit the IV model for exactly identified case.

Parameters: - instruments (np.ndarray): Instrumental variables matrix Z - regressors (np.ndarray): Endogenous regressors matrix X - targets (np.ndarray): Target values y

Requirements: - Number of instruments must equal number of regressors - n_samples > n_features + fit_intercept

predict()

predict(regressors) -> np.ndarray
Generate predictions using fitted IV coefficients.

Statistical Methods

  • standard_errors() → Standard errors of coefficients
  • t_statistics() → T-statistics for significance tests
  • p_values() → P-values for coefficient tests
  • confidence_intervals(alpha=0.05) → Confidence intervals
  • summary() → Comprehensive regression summary
  • covariance_matrix() → Coefficient covariance matrix

Properties

Core Results: - coefficients: IV regression coefficients - intercept: IV regression intercept - r_squared: R-squared (can be negative for IV models) - r_squared_adj: Adjusted R-squared - mse: Mean squared error - residuals: Regression residuals

Model Information: - n_samples: Number of observations - n_features: Number of features - fit_intercept: Whether intercept is included

Implementation Details

Numerical Stability

  • Automatic algorithm selection for solving (Z'X)⁻¹
  • SVD fallback for rank-deficient matrices
  • Robust handling of ill-conditioned systems

Performance

  • Memory-efficient computation
  • Vectorized operations
  • Minimal memory allocation

Usage Guidelines

Use IV when: - Regressors are endogenous - You have exactly as many instruments as endogenous regressors
- Instruments are strong (first-stage F > 10) and valid

Use alternatives when: - More instruments than regressors → Use TSLS - Regressors are exogenous → Use OLS - Instruments are weak → Consider other methods

See Also

  • TSLS - For overidentified models
  • OLS - For models without endogeneity