clusterIV
0.2.0Clustered Instrumental Variables Estimation and Inference
Overview
Implements instrumental variables estimation and inference for one endogenous regressor and one-way clustered errors. Includes the cluster-jackknife IV estimator (CJIVE) of Frandsen, Leslie and McIntyre (2025) doi:10.1162/rest.a.263 and the cluster-jackknife Anderson-Rubin and score tests of Ligtenberg (2025) doi:10.48550/arXiv.2306.08559, which are robust to weak and many instruments. Supports multiple excluded instruments, covariates, precision weights, and high-dimensional fixed effects.
Weak-instrument-robust inference
- New
cjar()implements the cluster-jackknife Anderson–Rubin test of Ligtenberg (2025), including analytic, grid-free confidence-set inversion, shifted/scaled chi-square and normal calibrations, and complete reporting of bounded, disjoint, and unbounded sets. - New
cjscore()implements Ligtenberg's cluster-jackknife score test and its analytically inverted confidence set. The CJAR and CJS procedures support both the plain and leave-two-cluster-out cross-fit variance estimators. - New
iv_infer()returns the CJIVE estimate, CJAR confidence set, and CJS point-null test in one panel while sharing preprocessing and leave-cluster-out calculations. - New base-graphics methods for
cjar,cjscore, andiv_inferdisplay p-value curves and the reported confidence sets. The sets are computed by polynomial inversion, not inferred from the plotting grid.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
Estimation and fixed effects
cjive(),cjar(),cjscore(),iv_infer(), andiv_compare()now accept high-dimensional fixed effects throughfixed_effects. A base-R, matrix-free joint projection absorbs multiple factor dimensions without constructing a dummy matrix and verifies weighted orthogonality before estimation.- Formula methods accept either
y ~ x | z | feor the controls-inside-formula layouty ~ exog | fe | x ~ z. Formula sections deliberately support a restricted additive grammar of bare variable names. - Formula methods now support
subsetandna.action. A single complete-case filter is applied to every model component. The fitted-object interfaces (cjive(),cjar(),cjscore(),iv_infer()) store and report the number of omitted rows;iv_compare()returns a plain data frame and does not. inference = "t"uses at(G - 1)reference convention for CJIVE Wald inference. It does not change the coefficient or standard error and is not presented as an exact finite-sample law.- The dense Frisch–Waugh–Lovell path remains the default throughout the package.
method = "leaveout_mean"remains an explicit special case for a pure grouping-instrument design and is never selected automatically.
Diagnostics and output
- Dense-path fits from
cjive(),cjar(),cjscore(), andiv_infer()report the clustered Montiel Olea–Pflueger effective first-stage statistic (F_eff) and its simplified-TSLS critical value. CJAR and CJS also report their polynomial tail diagnostics (F_CJandF_CJS) alongside the existing maximum within-cluster leverage diagnostic.iv_compare()intentionally reports estimates only, without these diagnostics. - New
summary()methods for CJAR and CJS report the test, confidence-set topology, first-stage diagnostics, and design advisories together.summary.cjive()includes the same strength block. nobs()methods are available for fitted objects. Supportedtidy()andglance()methods are registered throughgenericswhen that suggested package is installed; disjoint and unbounded sets remain available in a list column rather than being forced into a single interval.iv_compare()is now an S3 generic with vector and formula methods. Its historical"JIVE"row label is retained for compatibility; the observation-level calculation after FWL is IJIVE.
Documentation
- Two precomputed vignettes work through the package on real, named datasets:
vignette("queens-workflow")(Dube and Harish 2020; the full workflow, the published specification set, and the LaTeX export path) andvignette("miami-bail")(Frandsen, Leslie and McIntyre 2025; the judge-leniency design at scale). The data cannot be redistributed, so the vignettes ship with their outputs baked in and state where to obtain the files, verified by hash.knitrandrmarkdownenterSuggestsfor vignette building only. - The README gained a Validation section summarising the external Stata cross-checks and the frozen dense oracles, and five FAQ entries (which function to call first, CJAR versus CJS, interpreting
F_CJ/F_CJS, robust sets versus Wald intervals, and LaTeX export).
Performance
- The cross-fit variance kernel dispatches each leave-two-cluster-out solve on the stacked size of the two left-out clusters, mirroring the CJIVE leave-out kernel: many-instrument, small-cluster pairs are solved on the small side through a Woodbury identity, and the leave-out Gram matrices are cached lazily instead of always held. Together this reduces the per-pair time and the memory footprint by orders of magnitude in many-instrument, small-cluster designs; coefficients still pass the dense eq. (7) oracle at the 1e-10 gate, the exact spectral guard and its fail-closed classification are unchanged, and the large-side path is unchanged bit for bit.
cjar()andcjscore()withvariance = "crossfit"now compute only the variance polynomial they consume.iv_infer()still shares one pass when both jackknife tests are requested.- Whitening and the first-stage hat-diagonal accumulation allocate far less memory, which matters at high-dimensional-fixed-effects scale.
Input and numerical safety
- Input validation is shared across the public functions. Outcomes, endogenous regressors, and weights must be numeric; weights must be finite and positive; absorbed variables, rank-deficient instrument designs, and numerically zero IV denominators produce explicit errors.
- Factor and character grouping instruments use reference coding whenever an intercept or fixed effects are partialled out, and full-level coding only when neither is present. Data-frame factor controls follow the same rule, avoiding a redundant dummy when fixed effects already span the intercept. Dense paths assess support from the encoded, residualized instrument matrix; the stricter outside-cluster support rule is applied only to the explicit
leaveout_meanshortcut where that rule is mathematically required. - Dense controls that are numerically absorbed by the joint fixed-effect span are removed before the second FWL step, rather than allowing pivoted QR to promote projection noise into a regressor. Surviving controls are normalized before a dimension-aware rank decision, making the result invariant to their units. The reported
k_controlsis now the non-redundant reference-coded nuisance-column upper bound rather than intercept plus every FE level. - Numerically scaled inference preserves coefficient, standard-error, and test-statistic invariance under common rescaling and common rescaling of precision weights. Very large finite null values in CJAR/CJS and their plot methods are evaluated without forming overflowing powers of the null.
- Cross-fit variance estimation now rejects a leave-one- or leave-two-cluster- out instrument Gram whose spectral reciprocal condition number is at or below
sqrt(.Machine$double.eps), instead of returning a result that can depend materially on the instrument basis. - CJAR inversion now handles two-cluster designs and variance-boundary tangencies consistently with pointwise test acceptance. JIVE leverage equal to one and unsupported plain-test covariance ranks stop or return a typed unavailable result rather than propagating non-finite output.
Important changes
confint()now defaults to the confidence level stored on the fitted object instead of silently reverting to 95%.- Fast fixed effects make high-control designs practical, but the reported plug-in CJIVE sandwich can over-reject when the number of instruments and controls is large relative to the sample. The help pages now state this limitation and cite Kolesar, Min, Wang and Zhang (2026).
- The package title and description now cover both clustered IV estimation and weak-instrument-robust inference. The CRAN housekeeping corrections noted after version 0.1.0 are included.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK7 OK2026-07-01
Documentation
- Help pages
- 7
- Examples that run
- 100%6 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 60%
- Return-value docs
- 100%
- Help pages citing references
- 57%
Downloads
Repository
- PRs merged (all time)
- not measured
- Median days to close, 50 most recently updated closed issues
- 53
- Median days to close, 50 most recently updated closed PRs
- not measured
Stars over time
Issues over time
Commits over time
2 development-tooling and community-health practices detected across 1 family in the upstream repository
Checks run against github.com/atal-kat/clustered-estimation-and-inference on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Dependencies
Installing clusterIV adds no packages beyond those that come with R.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.2.0Latest
- 0.1.02026-06-30
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-06-30
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Download size
- 457 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("clusterIV")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-17, which the citation names so these numbers can be found later. More on citing and the projects behind them.