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.
翻译:线性工具变量(IV)模型广泛应用于观测性研究,但其有效性依赖于较强的假设条件。传统的设定检验方法(如萨甘-汉森J检验)仅适用于过度识别设定,因此在常见的恰好识别情形(工具变量数量等于内生变量数量)下无法使用。我们提出了一种新的检验方法,用于检验线性IV模型在结构误差与工具变量均值独立假设下的设定正确性。该假设使得即使在恰好识别设定下也能进行设定检验。我们的方法基于残差预测思想:若两阶段最小二乘残差能够以优于随机猜测的水平被工具变量所预测,则表明模型存在设定偏误。该检验方法采用样本分割策略和用户选择的机器学习方法,我们证明了其渐近第一类错误控制能力以及对广泛备择假设的一致性。进一步地,我们展示了如何通过安德森-鲁宾型逆变换将该检验原理拓展至弱工具变量或多工具变量场景,从而显著提升其适用性。该检验支持异方差稳健和聚类稳健推断,并在R语言RPIV包及Python的ivmodels软件包中实现。