liml

weak_instruments.liml.LIML(Y: ndarray, X: ndarray, Z: ndarray, G: ndarray[tuple[int, ...], dtype[float64]] | None = None, talk: bool = False, colnames=None) LIMLResult

Calculates the Limited Information Maximum Likelihood (LIML) estimator for weak instrument robust inference.

Parameters:
  • Y (np.ndarray) – A 1-D or 2-D numpy array of the dependent variable (N,).

  • X (np.ndarray) – A 2-D numpy array of the endogenous regressors (N, L).

  • Z (np.ndarray) – A 2-D numpy array of the instruments (N, K).

  • G (np.ndarray, optional) – A 2-D numpy array of additional controls (N, G). Default is None.

  • talk (bool, optional) – If True, provides detailed output for debugging purposes. Default is False.

  • colnames (list, optional) – List of column names for the coefficients. Default is None.

Returns:

An object containing the following attributes:
  • betas (NDArray[np.float64]): The estimated coefficients for the model.

  • se_list (list of float): Standard errors for the estimated coefficients.

  • tstat_list (list of float): t-statistics for the estimated coefficients.

  • pval_list (list of float): p-values for the estimated coefficients.

  • ci_list (list of tuple): Confidence intervals for the estimated coefficients.

Return type:

LIMLResult

Raises:

ValueError – If the dimensions of Y, X, or Z are inconsistent or invalid.

Notes

  • The LIML estimator is designed for robust inference in the presence of weak instruments.

  • The function computes coefficient estimates, standard errors, t-statistics, p-values, and confidence intervals.

  • Additional controls can be included via the G argument.

Example

>>> import numpy as np
>>> from weak_instruments.liml import LIML
>>> Y = np.random.randn(100)
>>> X = np.random.randn(100, 1)
>>> Z = np.random.randn(100, 2)
>>> result = LIML(Y, X, Z)
>>> result.summary()
class weak_instruments.liml.LIMLResult(betas, se_list, tstat_list, pval_list, ci_list)

Bases: object

Stores results for the LIML estimator.

betas

Estimated coefficients for the LIML model.

Type:

NDArray[np.float64]

se_list

Standard errors of the estimated coefficients.

Type:

list of float

tstat_list

t-statistics for the estimated coefficients.

Type:

list of float

pval_list

p-values for the estimated coefficients.

Type:

list of float

ci_list

Confidence intervals for the estimated coefficients.

Type:

list of tuple

summary()

Prints a summary of the LIML results in a tabular format similar to statsmodels OLS and UJIVE1.