lagrange_multiplier Module

class weak_instruments.lagrange_multiplier.LMTestResult(lm_stat: float, p_val: float)

Bases: object

weak_instruments.lagrange_multiplier.lm_test(Y: ndarray, X: ndarray, Z: ndarray, b: ndarray, talk: bool = False) LMTestResult

Calculates the Jackknife Lagrange-multiplier test.

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

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

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

  • b (np.ndarray) – A 1-D numpy array of the parameter values to test.

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

Returns:

A custom result object containing the LM test statistic and p-value.

Return type:

LMTestResult