1 What problem does this tool solve?
Instrumental variables (IV) is the most powerful and most fragile tool in the applied econometrician's kit. Its two-stage least squares (2SLS) estimate is trustworthy only if the instrument is strong (moves the endogenous regressor appreciably) and if the standard diagnostics are read correctly. Yet applied practice is riddled with the wrong habits: reporting a first-stage F against the folkloric threshold of 10 even under heteroskedasticity, ignoring the fact that the conventional t-test on the 2SLS coefficient is invalid at moderate F, and never checking how sensitive the result is to a single influential observation. The ivDiag package [Lal, 2024] bundles the modern weak-IV diagnostic toolkit into a single command, so that an IV table can carry the numbers that referees now expect: the effective F-statistic, identification-robust confidence sets, the valid-t adjustment, and influence diagnostics.
2 The diagnostics it computes
For the just or over-identified linear IV model $Y=\beta D+X^{\prime}\gamma+u$, $D=Z^{\prime}\pi+X^{\prime}\delta+v$. ivDiag reports:
- Effective F-statistic [Montiel Olea and Pflueger, 2013b]. The Montiel Olea and Pflueger [2013] effective F generalises the first-stage F to heteroskedastic, clustered, and autocorrelated errors, and is the correct strength measure outside the homoskedastic textbook case.
- Anderson-Rubin (AR) confidence set [Anderson and Rubin, 1949]. The AR interval is identification-robust: it has correct coverage regardless of instrument strength, and it can be unbounded or empty honestly signalling when the data cannot pin $\beta$ down.
- The valid-t (tF) confidence interval [Lee et al., 2022]. This adjusts the conventional 2SLS confidence interval's critical value as a smooth function of the observed effective F, restoring correct size when F is moderate rather than enormous.
- Local-to-zero and influence diagnostics. Leave-one-out and bootstrap procedures reveal whether the estimate hinges on a handful of observations -a common pathology in just-identified IV.
The guiding principle is that instrument strength is a signal-to-noise ratio, and a 2SLS point estimate without its strength diagnostics is uninterpretable [Andrews et al., 2019].
3 Installation and setup
4 A minimal working example
The one-stop function is ivDiag(). Supply the outcome, the endogenous treatment, the instrument(s), exogenous controls, and (optionally) a clustering variable.
The F_stat element lists several first-stage F's side by side; the one to report is the effective F matched to your error structure (here, cluster-robust). Compare the AR set with the conventional 2SLS interval: when the instrument is strong they nearly coincide; when it is weak, the AR set widens or opens to infinity, whereas the naive interval stays misleadingly tight.
To visualise how the two intervals diverge as strength varies, ivDiag provides a coefficient plot:
5 Reading the output: a decision rule
- Look at the effective F first. If it is comfortably large (well into the tens or hundreds), conventional 2SLS inference is approximately valid and the tF adjustment is small.
- If the effective F is moderate, report the tF interval, not the naive one. A first-stage F of, say, 15 does not license the textbook t-test.
- If the effective F is small, lead with the Anderson-Rubin set. An unbounded AR set is not a failure of the software it is the data telling you the instrument is too weak to identify $\beta$.
- Always check influence. If dropping one cluster overturns the result, the estimate is fragile regardless of the F-statistic.
6 Diagnostics in the age of heterogeneous effects
Strength is necessary but not sufficient. Even a strong instrument identifies only a local average treatment effect (LATE) for compliers [Imbens and Angrist, 1994], and 2SLS with additively entered covariates can return a contaminated, negatively-weighted combination of effects unless the covariates are handled by saturation or the propensity-spanning condition of Blandhol et al. [2022]. ivDiag keeps you honest about the first-stage strength; the companion discipline is to name the estimand (whose LATE?) and, where covariates enter, to check whether the design satisfies the conditions under which 2SLS still estimates a convex-weighted causal effect [Sloczynski, 2020]. Diagnostics for the two problems weak identification and heterogeneity-induced contamination are complementary, and a credible IV table now reports both.
7 Comparison to alternatives
Base R's AER::ivreg and fixest::feols (with a two-part formula) estimate 2SLS and report a first-stage F, but neither delivers the effective F, AR sets, or the tF adjustment out of the box. The ivmodel package offers strong weak-IV inference for the single-instrument case; ivDiag is broader and more turnkey, designed to produce a publication-ready diagnostic panel.[cite: 23] For the underlying estimation of fixed-effects IV on large panels, estimate with feols and pass the model to a diagnostic workflow.[cite: 23] The bottom line: estimate wherever you like, but report the strength diagnostics ivDiag makes cheap because in IV, the credibility of the whole exercise rests on them.[cite: 23]
References
Andrews, I., Stock, J. H., and Sun, L. (2019). Weak instruments in instrumental variables regression: Theory and practice. Annual Review of Economics, 11, 727-753.[cite: 23]
Blandhol, C., Bonney, J., Mogstad, M., and Torgovitsky, A. (2022). When is TSLS actually LATE? NBER Working Paper 29709.[cite: 23]
Słoczyński, T. (2020). When should we (not) interpret linear IV estimands as LATE? arXiv preprint arXiv:2011.06695.[cite: 23]