Skip to content

clusterIV

0.2.0

Clustered Instrumental Variables Estimation and Inference

0packages depend
856downloads / year
92.0%test coverage
13/13flavors OK

Overview

About

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.

Changes in 0.2.0

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, and iv_infer display 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(), and iv_compare() now accept high-dimensional fixed effects through fixed_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 | fe or the controls-inside-formula layout y ~ exog | fe | x ~ z. Formula sections deliberately support a restricted additive grammar of bare variable names.
  • Formula methods now support subset and na.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 a t(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(), and iv_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_CJ and F_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. Supported tidy() and glance() methods are registered through generics when 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) and vignette("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. knitr and rmarkdown enter Suggests for 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() and cjscore() with variance = "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_mean shortcut 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_controls is 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

CRAN checks
13OK
Slowest check: 2.1 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK7 OK2026-07-01
Advisories

none known

Documentation

In release 0.2.0
READMEYes · 2,015 wordsVignettesYes · 2 · staticNEWSYes · 100% structured · mentions 0.2.0Citation fileNoWebsitenot declared in DESCRIPTION
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

856
CRAN downloads in the past year
Rank #18,172 · ~2/day · ~71/mo
Daily download trend is not available in this view yet.
34130 days
69390 days
8561 year
Compare downloads with other packages →
Also on26 r2u4 autocran

Repository

2Stars
0Forks
0Open issues
0Open PRs
0Releases
15Commits
1Commit identities
15 commits · Last activity 2026-10-02 · 0% stars, 30d
Responsiveness
How these are sampled
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

2026-07-03 · 22026-07-07 · 2
PracticesBeta

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.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
3 external dependencies (excludes base and recommended)

Installing clusterIV adds no packages beyond those that come with R.

Depends (0)
none
Imports (1)
stats
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (1)
Author, Maintainer since 0.1.0 (2026)
Releases (2)

Pick two releases to compare their code metrics.

  • 0.2.0Latest
    record
    2026-10-01 · current release · diff ↗ ·
    added 3 exports
    cjar, cjscore, iv_infer
  • 0.1.0
    record
    2026-06-30
  • R
    R 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")
Katawazi, A. (2026). clusterIV: Clustered Instrumental Variables Estimation and Inference (Version 0.2.0) [Computer software]. https://doi.org/10.32614/CRAN.package.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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for clusterIV version 0.2.0 [Data set]. HJJB, LLC. Data release v2026-10-17. https://doi.org/10.5281/zenodo.21843040

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.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy