The linear instrumental variable (IV) model is widely used in observational studies, yet its validity hinges on strong assumptions. Classical specification tests such as the Sargan-Hansen J test are limited to overidentified settings and are therefore not applicable in the common just-identified case, where the number of instruments is equal to the number of endogenous variables. We propose a novel test for the well-specification of the linear IV model under the assumption that the structural error is mean independent of the instruments. This assumption enables specification testing even in the just-identified setting. Our approach uses the idea of residual prediction: if the two-stage least squares residuals can be predicted from the instruments better than chance, this indicates misspecification. The resulting test employs sample splitting and a user-chosen machine learning method, and we show asymptotic type I error control and consistency against a broad class of alternatives. We further show how the proposed testing principle can be adapted to settings with weak or many instruments via an Anderson-Rubin-type inversion, thereby substantially extending the applicability. The tests accommodate heteroskedasticity- and cluster-robust inference and are implemented in the R package RPIV and the ivmodels software package for Python.
翻译:线性工具变量模型广泛应用于观察性研究,但其有效性依赖于较强的假设。经典设定检验(如Sargan-Hansen J检验)仅适用于过度识别情形,因此在常见的恰好识别情形(工具变量数量等于内生变量数量)中无法使用。我们提出了一种新的检验方法,用于评估线性工具变量模型的设定正确性,其假设结构误差项均值独立于工具变量。这一假设使得即使在恰好识别情形下也能进行设定检验。我们的方法基于残差预测思路:若两阶段最小二乘残差可被工具变量以高于随机水平的准确度预测,则表明模型存在设定偏误。该检验通过样本拆分和用户选择的机器学习方法实现,我们证明了其渐近I类错误控制能力以及对广泛备择假设的一致性。进一步,我们展示了如何通过Anderson-Rubin型逆变换将该检验原理推广至弱工具变量或过多工具变量的情形,从而显著扩展了其适用性。该检验支持异方差稳健与聚类稳健推断,并已在R包RPIV及Python软件包ivmodels中实现。