Immunity: Geographic and Age-Based Projection
Overview
Fits Bayesian hierarchical models of vaccine coverage by location, birth cohort, and age. Observations of vaccination status (which may span cohorts, ages, and doses) are used to fit a latent survival-style process model that decomposes coverage into a lifetime propensity to vaccinate and a time-varying force of vaccination. Hierarchical spatial structure (e.g., state, county, school) supports partial pooling via random effects. Models are implemented in 'Stan' and fit via 'rstan'. Provides helpers to validate user-supplied input data, and to predict coverage from fitted models.
Major Features
- **Arbitrary Hierarchy Layer Depth**:
sampling(),canonicalize_locations(), and underlying Stan models now support user-defined hierarchical location structures of arbitrary depth (e.g. 1-layer statewide, 2-layer state-county, 3-layer state-county-school, or deeper regional partitions).- Added
assemble_layer_data()helper to construct and validate hierarchical metadata, bounds, and parent mappings. - Added dedicated single-layer model
impute_school_coverage_process_v6_single_layerwith automatic dispatch when single-layer inputs are supplied. - Added a new vignette (
user_specified_layers) demonstrating 1-layer, 2-layer, and 3-layer model estimation and prediction workflows. - **Backend Abstraction via
flexstanr**: - Integrated
flexstanr (>= 0.2.0)to provide uniform backend abstraction acrossrstanandcmdstanrMCMC engines. - Re-exported
flexstanr::stan_options()for seamless sampler configuration. - **Modular Stan Architecture**:
- Refactored top-level Stan models into concise assembly skeletons utilizing modular
#includedirectives (functions/,data/,transformed_data/,parameters/,model/). - Pruned legacy/vestigial Stan scripts to streamline code base maintenance.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
- **Data Pipeline & Target Generation**:
- Split target generation into fit-free constructor
create_target()and validation functioncanonicalize_target(). - Added bundled example fitted datasets for single-layer and 2-layer models (
fit_sim_1layer,fit_sim_2layer,predict_sim_1layer,predict_sim_2layer,target_sim_1layer,target_sim_2layer).
Enhancements & Bug Fixes
- **Location Hierarchy Invariant**: Enforced structural validation ensuring location nodes have either 0 offspring (leaf) or $\ge 2$ offspring (preventing single-child degenerate chains).
- **Error Handling & Assertions**: Standardized assertion messages across all functions using module-level
ERR_*format string constants and helper assertion functionsstop_fmt_if()andwarn_fmt_if(). - **Validation**: Added validation against
NAweights in population and target specifications. - **Documentation Examples & Check Times**: Applied combined
@examplesIf interactive()and\donttest{}idiom to computationally heavy examples, enabling fastpkgdownbuilds (~35 seconds) while remaining CRAN--as-crancompliant. - **Vignette Dark Mode Compatibility**: Enforced solid white backgrounds and high-contrast styling across all vignette plots for clean rendering in light/dark modes.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-29
- ERROR12 OK, 1 ERROR2026-07-27
- OK6 OK2026-06-23
Documentation
- Help pages
- 30 (5 internal)includes a package overview page
- Examples that run
- 80%8 run in a plain check · 2 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 75%
- Documented parameters
- 100%
- Return-value docs
- 88%
- Help pages citing references
- 3%
Downloads
Repository
- PRs merged (all time)
- 93%
- Median days to close, 50 most recently updated closed issues
- 5
- Median days to close, 50 most recently updated closed PRs
- 1
Issues over time
PRs over time
Commits over time
15 development-tooling and community-health practices detected across 8 families in the upstream repository
Checks run against github.com/accidda/imugap on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-17 · The repository has a site deploy workflow
pkgdown site last built 2026-10-17
Show all practicesHide 4 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-04-18Named in .Rbuildignore: .claudeCommits: at least 1 crediting it in the message
- Cursorfirst seen 2026-09-01Named in .Rbuildignore: .cursor, .cursorrules
- Claude CodePull requests: 2 from outside contributors, first on 2026-03-01
- Claude Opus 4.61 commit · Apr 2026
Dependencies
Installing imuGAP adds 51 packages (24 with compiled code, 50 MB of source tarballs). Heaviest: BH 14 MB, ggplot2 6.0 MB, data.table 5.7 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.2.0Latest2026-09-02 · current release · diff ↗ ·
added 2 exports
canonicalize_target, create_observation_populations - 0.1.02026-06-22
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-06-22
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 2.4 MB / 13 files
- Download size
- 3.5 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("imuGAP")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.5281/zenodo.20562250.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.