Package: ivreg2r 0.1.0

Francis DiTraglia

ivreg2r: Extended Instrumental Variables Estimation with Diagnostics

Comprehensive instrumental variables and GMM estimation with automatic diagnostics, inspired by the 'Stata' command 'ivreg2' of Baum, Schaffer, and Stillman (2003) <doi:10.1177/1536867X0300300101> and Baum, Schaffer, and Stillman (2007) <doi:10.1177/1536867X0800700402>. Supports 2SLS, LIML, Fuller, k-class, two-step efficient GMM, and continuously-updated (CUE) estimators. Provides classical, robust, cluster-robust, HAC, and Driscoll-Kraay standard errors. Reports weak identification, underidentification, overidentification, and endogeneity tests at estimation time. All outputs are verified against 'Stata' within tight numerical tolerances.

Authors:Francis DiTraglia [aut, cre], Christopher F. Baum [ctb, cph], Mark E. Schaffer [ctb, cph], Steven Stillman [ctb, cph]

ivreg2r_0.1.0.tar.gz
ivreg2r_0.1.0.tar.gz(r-4.7-any)ivreg2r_0.1.0.tar.gz(r-4.6-any)
ivreg2r_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
ivreg2r/json (API)

# Install 'ivreg2r' in R:
install.packages('ivreg2r', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/restatr/ivreg2r/issues

Pkgdown/docs site:https://restatr.com

Datasets:
  • abdata - Arellano-Bond (1991) UK Employment Panel
  • card - Card (1995) College Proximity Dataset
  • cigar - Cigarette Demand Panel
  • griliches - Griliches (1976) Young Men's Wages Dataset
  • grunfeld - Grunfeld (1958) Corporate Investment Panel
  • klein - Klein (1950) Model I Macroeconomic Data
  • mroz - Mroz (1987) Female Labor Supply Dataset
  • nlswork - NLS Young Women Panel
  • phillips - Phillips Curve Macroeconomic Dataset
  • stockwatson - Stock and Watson U.S. Macroeconomic Dataset
  • wagepan - Wooldridge Wage Panel Dataset

On CRAN:

Conda:

3.18 score 8 exports 12 dependencies

Last updated from:71f1717c6f. Checks:4 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK254
source / vignettesOK221
linux-release-x86_64OK246
wasm-releaseOK133

Exports:augmentddiagnosticsfirst_stageglanceivreg2ltidy

Dependencies:cliFormulagenericsgluelifecyclemagrittrpillarpkgconfigrlangtibbleutf8vctrs

Advanced IV Estimation with ivreg2r
Introduction | The Mroz baseline | LIML, Fuller, and k-class estimation | LIML | Fuller modification | k-class estimation | COVIV | Choosing among the estimators | The Klein consumption function | LIML with COVIV equals CUE | Instrument-validity tests | Overidentification | Orthogonality (the C-statistic) | Endogeneity of a regressor | Testing an included regressor: the empty-endogenous form | Anderson-Rubin LIML overidentification | Weak-instrument-robust inference | The Stock-Wright S statistic | When instruments are genuinely weak | Redundant instruments | Building the S statistic by hand with b0 | What the package does and does not offer | Two-way clustering | The nlswork panel | One-way versus two-way clustering | Two-way clustering with instrumental variables | Reduced-form regression | Single-equation reduced form | System reduced form | Degrees-of-freedom adjustments | Estimator equivalences | Publication tables with modelsummary | A single model | Comparing estimators side by side | Exponentiated coefficients | Customizing output | Stata migration | References

Last update: 2026-07-21
Started: 2026-07-21

Instrumental Variables Estimation with ivreg2r
Introduction | OLS baseline | Two-stage least squares | Understanding the diagnostics | Weak identification | Underidentification | Overidentification | Endogeneity test (C-statistic) | Anderson-Rubin test | First-stage diagnostics | Robust and clustered inference | Heteroskedasticity-robust standard errors | Cluster-robust standard errors | VCE option summary | Weighted estimation | Sampling weights (pweight) | Analytic weights (aweight) | The other weight types | Beyond 2SLS | Tidyverse workflows | Coefficient table | Model summary | Diagnostic tests as data | Augmented data | Stata migration quick reference | Estimation basics and accessors | Estimators | Variance estimation and clustering | Weights, tests, and other options | Intentional differences from Stata | References

Last update: 2026-07-21
Started: 2026-07-21

Time Series IV, Panel VCE, and GMM
Introduction | HAC and AC standard errors | Choosing a kernel | Automatic bandwidth | Kernel-based VCE with IV | Lags and differences in the formula | Panel variance estimators | Large N, small T: the Arellano-Bond firm panel | Small N, large T: the Grunfeld investment panel | Large N, moderate T: the NLS young-women panel | Fixed-effects panels: the Stock-Watson correction | When to use which | Generalized method of moments | When GMM helps | A HAC-GMM arc on the Stock-Watson data | Reusing the weighting matrix | Centering the moment conditions | Partialling out regressors | PSD corrections | Suppressing identification statistics | Estimator equivalences | References

Last update: 2026-07-21
Started: 2026-07-21

Readme and manuals

Help Manual

Help pageTopics
Arellano-Bond (1991) UK Employment Panelabdata
Augment data with ivreg2 model predictions and residualsaugment.ivreg2
Card (1995) College Proximity Datasetcard
Cigarette Demand Panel (Baltagi-Levin / Baltagi-Griffin-Xiong)cigar
Extract coefficients from an ivreg2 objectcoef.ivreg2
Confidence intervals for ivreg2 coefficientsconfint.ivreg2
Extract IV diagnostic tests as a tibblediagnostics diagnostics.ivreg2
Extract first-stage regression objectsfirst_stage first_stage.ivreg2
Extract fitted values from an ivreg2 objectfitted.ivreg2
Extract formula from an ivreg2 objectformula.ivreg2
Glance at an ivreg2 objectglance.ivreg2
Griliches (1976) Young Men's Wages Datasetgriliches
Grunfeld (1958) Corporate Investment Panelgrunfeld
Extended Instrumental Variables Estimationivreg2
Statistical conventions in ivreg2rivreg2r-conventions
Glossary of diagnostic-output acronymsivreg2r-glossary
Klein (1950) Model I Macroeconomic Dataklein
Extract design matrices from an ivreg2 modelmodel.matrix.ivreg2
Mroz (1987) Female Labor Supply Datasetmroz
NLS Young Women Panel (Stata '[XT]' Manual Extract)nlswork
Extract number of observations from an ivreg2 objectnobs.ivreg2
Phillips Curve Macroeconomic Datasetphillips
Predict from an ivreg2 modelpredict.ivreg2
Print an ivreg2 objectprint.ivreg2
Print a summary.ivreg2 objectprint.summary.ivreg2
Extract residuals from an ivreg2 objectresiduals.ivreg2
Stock and Watson U.S. Macroeconomic Datasetstockwatson
Summary for ivreg2 objectssummary.ivreg2
Extract terms object from an ivreg2 modelterms.ivreg2
Tidy an ivreg2 objecttidy.ivreg2
Time-series operators for ivreg2 formulasd l ts-operators
Update and re-fit an ivreg2 modelupdate.ivreg2
Extract variance-covariance matrix from an ivreg2 objectvcov.ivreg2
Wooldridge Wage Panel Datasetwagepan