linearmodels.iv.common.kleibergen_paap_f

linearmodels.iv.common.kleibergen_paap_f(endog: ndarray[tuple[int, ...], dtype[float64]], instr: ndarray[tuple[int, ...], dtype[float64]], exog: ndarray[tuple[int, ...], dtype[float64]], cov_type: str = 'robust', cov_config: dict[str, Any] | None = None) → float[source]

Kleibergen-Paap rk Wald F statistic

Parameters:
endog: ndarray[tuple[int, ...], dtype[float64]]

Weighted endogenous regressor array (nobs, nendog)

instr: ndarray[tuple[int, ...], dtype[float64]]

Weighted instrument array (nobs, ninstr)

exog: ndarray[tuple[int, ...], dtype[float64]]

Weighted exogenous regressor array (nobs, nexog), partialled out before testing. Include a constant column here if the model has one.

cov_type: str = 'robust'

Covariance estimator used for the first-stage scores. One of “unadjusted”, “robust”, “clustered” or “kernel”, or any other name that the IV models accept for the same estimator, such as “homoskedastic” or “heteroskedastic”. The default is “robust”.

cov_config: dict[str, Any] | None = None

Options for the covariance estimator. See kleibergen_paap().

Returns:

The rk Wald F statistic, or NaN if it is not defined.

Return type:

float

Raises:

ValueError – If cov_type is not supported, or is “clustered” and cov_config does not contain clusters.

Warning

The statistic is a robust analogue of the Cragg-Donald F statistic, but it is not a test and has no p-value. Stock-Yogo critical values are derived for conditionally homoskedastic, serially uncorrelated errors and do not apply to this statistic when the errors are not i.i.d. Comparing the two is a common heuristic without a formal justification. For a single endogenous regressor, the effective F-statistic of Olea and Pflueger (2013) is a better-founded choice but is not implemented here. Even then, a large first-stage F-statistic does not ensure that confidence intervals based on 2SLS have correct coverage.

The warnings in kleibergen_paap() also apply: the statistic is asymptotic, needs \(n\) to be large relative to the number of instruments times the number of endogenous regressors, and needs many clusters if clustered. Using the statistic to decide whether to proceed with IV estimation distorts subsequent inference.

Notes

The rk Wald statistic has the form of the statistic in kleibergen_paap(), but the scores are formed from the first-stage residuals rather than from the orthogonalized endogenous regressors. If \(W\) is the statistic, the F statistic is

\[F_{rk} = \frac{W}{n} \frac{n - k - c}{k}\]

where \(k\) is the number of excluded instruments and \(c\) is the number of exogenous regressors. With clustered covariance, the statistic is

\[F_{rk} = \frac{W}{n - 1} \frac{(n - k - c)(M - 1)}{M k}\]

where \(M\) is the number of clusters. With cov_type equal to “unadjusted” or “homoskedastic” the statistic is the Cragg-Donald F statistic from cragg_donald_f(). These are the definitions used by Stata’s ivreg2 for the “Kleibergen-Paap rk Wald F statistic” (Baum, Schaffer and Stillman, 2007).

The weights and clusters are used as in kleibergen_paap(). In a weighted model, each of the arrays, including the constant of exog, has to be multiplied by the square root of the weights, and the statistic does not depend on their scale. The clusters have one element for each row of the arrays. If there are \(m\) endogenous regressors, the scores of the Wald statistic sum to zero, so that at least \(k-m+2\) clusters are needed, which is one more than for kleibergen_paap(). A warning is issued if there are fewer clusters.

References

Kleibergen, F., & Paap, R. (2006). Generalized reduced rank tests using the singular value decomposition. Journal of Econometrics, 133(1), 97-126.

Olea, J. L. M., & Pflueger, C. (2013). A robust test for weak instruments. Journal of Business & Economic Statistics, 31(3), 358-369.

Baum, C. F., Schaffer, M. E., & Stillman, S. (2007). Enhanced routines for instrumental variables/GMM estimation and testing. Stata Journal, 7(4), 465-506.