linearmodels.iv.results.IVResults.wu_hausman

IVResults.wu_hausman(variables: str | list[str] | None = None) → WaldTestStatistic[source]

Wu-Hausman test of exogeneity.

Parameters:
variables: str | list[str] | None = None

Name or list of names of the endogenous regressors to test for exogeneity. If not provided, all endogenous regressors are jointly tested.

Returns:

Object containing test statistic, p-value, distribution and null.

Return type:

linearmodels.shared.hypotheses.WaldTestStatistic

Raises:
  • TypeError – If variables is not a str or a list of str.

  • KeyError – If a name in variables is not an endogenous regressor.

See also

wooldridge_regression

Test of exogeneity that uses the covariance estimator that was used to fit the model.

wooldridge_score

Test of exogeneity that is robust to heteroskedasticity.

Notes

The test assumes that the errors are homoskedastic. It does not use the covariance estimator that was used to fit the model, so it is the same for every cov_type.

Test statistic is difference between sum of squared OLS and sum of squared IV residuals where each set of residuals has been projected onto the set of instruments in the IV model.

Start by defining

\[\delta & = \hat{\epsilon}'_e P_{[z,w]} \hat{\epsilon}_e - \hat{\epsilon}'_c P_{z} \hat{\epsilon}_c\]

where \(\hat{\epsilon}_e\) are the regression residuals from a model where variables are treated as exogenous, \(\hat{\epsilon}_c\) are the regression residuals from the model leaving variables as endogenous, \(P_{[z,w]}\) is a projection matrix onto the exogenous variables and instruments (z) as well as variables, and \(P_{z}\) is a projection matrix only onto z.

The test statistic is then

\[\frac{\delta / q}{(\hat{\epsilon}'_e\hat{\epsilon}_e - \delta) / v}\]

where \(q\) is the number of variables tested, \(v = n - n_{endog} - n_{exog} - q\). The test statistic has a \(F_{q, v}\) distribution.