Skip to content

Stratified Randomized Experiments

0packages depend
5Kdownloads / year
93.9%test coverage
13/13flavors OK

Overview

About

Estimate average treatment effects (ATEs) in stratified randomized experiments. 'sreg' supports a wide range of stratification designs, including matched pairs, n-tuple designs, and larger strata with many units — possibly of unequal size across strata. 'sreg' is designed to accommodate scenarios with multiple treatments and cluster-level treatment assignments, and accommodates optimal linear covariate adjustment based on baseline observable characteristics. 'sreg' computes estimators and standard errors based on Bugni, Canay, Shaikh (2018) doi:10.1080/01621459.2017.1375934; Bugni, Canay, Shaikh, Tabord-Meehan (2024+) doi:10.48550/arXiv.2204.08356; Jiang, Linton, Tang, Zhang (2023+) doi:10.48550/arXiv.2201.13004; Bai, Jiang, Romano, Shaikh, and Zhang (2024) doi:10.1016/j.jeconom.2024.105740; Bai (2022) doi:10.1257/aer.20201856; Bai, Romano, and Shaikh (2022) doi:10.1080/01621459.2021.1883437; Liu (2024+) doi:10.48550/arXiv.2301.09016; and Cytrynbaum (2024) doi:10.3982/QE2475.

Changes in 2.1.0

Estimation and inference

  • Corrected the large-strata variance estimator for experiments with multiple active treatment arms under both individual- and cluster-level assignment. The estimator now includes the contribution of clusters or individuals assigned to active arms other than the arm being compared with control.
  • Corrected the small-strata cluster estimator. Point estimation now uses expanded cluster outcomes, cluster-level covariate means, and normalization by the mean represented cluster size. The corresponding variance estimator now incorporates the common random denominator and the contributions of all treatment arms.
  • Corrected mixed-design inference under cluster-level assignment. Component estimates are now weighted by their shares of the represented individual population, computed from Ng, and the variance estimator includes the variability of these random population shares.
Show all changes in 2.1.0Hide the rest of the changes in 2.1.0
  • Covariates supplied for a mixed design are now used in both its small- and large-strata components for individual- and cluster-level assignment. A targeted error explains when the large-strata component cannot identify the requested treatment-by-stratum adjustment and recommends reducing the covariate set or using X = NULL.
  • Improved HC1 handling in degenerate multi-treatment settings by reverting to the unadjusted variance estimate when the finite-sample correction is undefined.

Design support and interface

  • Added the optional k argument to sreg(). It validates the common stratum size in uniform small-strata designs and identifies the small-stratum size in general mixed designs, extending mixed-design support beyond matched pairs and triplets to general k-tuples.
  • Improved automatic design classification, validation messages, and warnings for small- and mixed-strata designs under both individual- and cluster-level assignment.
  • Standardized user-facing output to use the term "large strata" rather than "big strata."

Data generation

  • Extended sreg.rgen() to generate mixed designs through the new mixed.strata and n.small arguments for both individual- and cluster-level assignment.
  • Added optional stratum-specific allocation probabilities, stratum effects, and treatment effects through allocation.probs, stratum.effects, and treatment.effects.by.stratum for large-strata individual-level designs.
  • Clarified that n counts clusters when cluster = TRUE, strengthened input validation, and corrected large-strata cluster generation so that is.cov = FALSE no longer returns covariate columns.

Documentation and maintenance

  • Substantially expanded the function documentation, examples, README, and introductory vignette to cover large-, small-, mixed-, and cluster-randomized designs and the S3 print and plot methods.
  • Corrected references and documented the structure of returned objects, cluster-size handling, cluster-level covariate aggregation, and mixed-design adjustment behavior.
  • Expanded the automated test suite for multi-arm variance estimation, general k-tuple and mixed designs, cluster estimators, data generation, design classification, and adjustment diagnostics.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 6.4 min · r-oldrel-macos-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 2.1.0
READMEYes · 2,196 wordsVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 2.1.0Citation fileYes · software entry onlyWebsitenot declared in DESCRIPTION
Help pages
5
Examples that run
100%5 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
40%

Downloads

5K
CRAN downloads in the past year
Rank #16,190 · ~14/day · ~419/mo
Daily download trend is not available in this view yet.
30330 days
76590 days
5K1 year
Compare downloads with other packages →
Also on80 r2u7 autocran

Repository

3Stars
0Forks
0Open issues
0Open PRs
5Releases
1,489Commits
3Commit identities
1,489 commits · Last activity 2026-09-30 · 0% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
33%
Median days to close, 50 most recently updated closed issues
not measured
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2024-06-26 · 12026-07-07 · 3
PracticesBeta

6 development-tooling and community-health practices detected across 4 families in the upstream repository

Checks run against github.com/jutrifonov/sreg on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

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

Coverage (1)
Coverage reporting
CRAN release process (1)
cran-comments.md
Lint, format, editor (2)
lintrRStudio project
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
12 external dependencies (excludes base and recommended)

Installing sreg adds 34 packages (18 with compiled code, 35 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, viridis 2.9 MB.

Depends (1)
R >= 2.10
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (4)
Author, Maintainer since 1.0.0 (2024), Copyright holder
Releases (5)

Pick two releases to compare their code metrics.

Package metadata

First published
2024-06-25
Total releases
5 / 2 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 2.10
Bundled data
13 KB / 1 file
Download size
154 KB

Cite

Cite this package

Run in R for the authors' entry:

citation("sreg")

The package provides a citation file, so citation() returns the authors' own entry.

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 sreg version 2.1.0 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, 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