ivDiag – User Manual
Welcome
The ivDiag package provides tools for estimation, inference, sensitivity analysis, and visualization with instrumental variable (IV) designs. It implements the guidelines proposed in Lal et al. (2024) in R, enabling researchers to obtain reliable and robust estimates of their IV models.
The package computes several types of standard errors (SEs), F-statistics, and weak-IV robust confidence intervals (CIs). Together they show how uncertain an IV estimate is, including when the instruments are weak.
The package also provides the Anderson-Rubin (AR) test and adjusted t-ratio inference from Lee et al. (2022) to enhance the validity and reliability of statistical inference.
ivDiag also offers the Local-to-Zero (LTZ) estimator (Conley et al. 2012). This estimator adjusts the 2SLS estimate and its confidence interval for a plausible violation of the exclusion restriction specified by the researcher. Functions for plotting coefficients from two-stage least squares (2SLS) and ordinary least squares (OLS) regressions allow researchers to compare the two estimators and various inferential methods.
The omnibus function ivDiag returns a list. Parts of this list can be appended as additional rows in tables produced by modelsummary, fixest::etable, and stargazer, among other tools. This makes it easy for researchers to integrate ivDiag estimates into their existing workflows.
ivDiag applies only to the one-treatment case, although there can be multiple instruments.
Organization
Chapter 1 Get Started
Installation and the datasets shipped with the package.Chapter 2 Estimation and Inference
The omnibus functionivDiag()and the coefficient plot, using McClendon (2014).Chapter 3 Conduct Tests Separately
The effective F statistic, the AR test, and the tF procedure run separately, including an AR set under a weak instrument.Chapter 4 Fuzzy RD Designs
Fuzzy regression discontinuity designs.Chapter 5 Sensitivity Tests
Zero-first-stage tests and the local-to-zero adjustment, using Guiso et al. (2016).
Contributors
- Apoorva Lal (Independent Researcher)
- Yiqing Xu (Stanford)
- StatsClaw (Agentic System for Statistical Software Development)
Report bugs
Please report bugs to yiqingxu [at] stanford.edu or open an issue on GitHub.