Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
680bb1e
Merge branch 'main' of https://github.com/CDCgov/PyRenew
cdc-mitzimorris Sep 15, 2025
2cb876b
update
cdc-mitzimorris Sep 18, 2025
60db8df
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Sep 22, 2025
32a5314
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Oct 5, 2025
d6213f2
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Oct 8, 2025
96f27c9
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Nov 17, 2025
1cb6fa2
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Nov 24, 2025
f62e1e4
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Dec 4, 2025
0c6785d
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Dec 22, 2025
1ee62b9
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Jan 29, 2026
0629461
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 4, 2026
efeadee
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 5, 2026
371ba98
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 5, 2026
5aa8c42
remove unused classes and their unit tests
cdc-mitzimorris Feb 5, 2026
2c8e65f
updated docs to match deletions
cdc-mitzimorris Feb 6, 2026
c490ba4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 6, 2026
c5bb498
Merge branch 'mem_deprecate_classes' of github-bf06:CDCgov/PyRenew in…
cdc-mitzimorris Feb 6, 2026
b2701d3
wordsmithing RV tutorial
cdc-mitzimorris Feb 6, 2026
a3faf53
metaclass.py only has ABC classes
cdc-mitzimorris Feb 6, 2026
04ea0aa
merge fix
cdc-mitzimorris Feb 6, 2026
4c32083
wordsmithing docs landing page
cdc-mitzimorris Feb 6, 2026
ff5eda6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 6, 2026
8cfbe30
lint fix
cdc-mitzimorris Feb 6, 2026
145cc89
Merge branch 'mem_deprecate_classes' of github-bf06:CDCgov/PyRenew in…
cdc-mitzimorris Feb 6, 2026
915f8ce
fix issue 679
cdc-mitzimorris Feb 6, 2026
a11f307
Merge remote-tracking branch 'origin/main' into mem_deprecate_classes
cdc-mitzimorris Feb 6, 2026
48680ac
Update docs/tutorials/random_variables.qmd
cdc-mitzimorris Feb 6, 2026
95b2e31
Update README.md
cdc-mitzimorris Feb 6, 2026
cbfbfdc
Update README.md
cdc-mitzimorris Feb 6, 2026
7266f82
Merge branch 'mem_deprecate_classes' of github-bf06:CDCgov/PyRenew in…
cdc-mitzimorris Feb 6, 2026
c325c53
improve day-of-week plots
cdc-mitzimorris Feb 6, 2026
4496587
improve day-of-week plots
cdc-mitzimorris Feb 7, 2026
13b9a12
improve day-of-week plots
cdc-mitzimorris Feb 7, 2026
db657ac
tests for newly exposed lines in metaclass.py
cdc-mitzimorris Feb 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ where $\alpha$ is the ascertainment rate and $\pi(s)$ is the delay distribution

The Pyrenew package provides configurable classes which encapsulate these components and methods to orchestrate the configuration and composition of these processes
resulting in programs which clearly express the model structure and choices, allowing for both ease of model specification and dissemination.
The fundamental building blocks are the `Model` metaclass, from which we can draw samples,
and the `RandomVariable` metaclass which has been abstracted to allow for sampling from distributions, computing a mechanistic equation, or simply returning a fixed value.
The `PyrenewBuilder` class orchestrates the composition process.
The fundamental building block is the `RandomVariable` abstract base class, which allows for sampling from distributions, computing a mechanistic equation, or simply returning a fixed value.

We use `RandomVariable`s to build probabilistic models. We represent complete models as concrete subclasses of the `Model` abstract base class.
The `PyrenewBuilder` class orchestrates the composition of `RandomVariables` into a `Model`.

PyRenew's strength lies in multi-signal integration for information pooling across diverse observed data streams
such as hospital admissions, wastewater concentrations, and emergency department visits
Expand Down
70 changes: 69 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
--8<-- "README.md"
# PyRenew

**Bayesian renewal modeling with JAX and NumPyro.**

PyRenew is a flexible tool for simulation and statistical inference of epidemiological models, emphasizing hierarchical multi-signal renewal models.
Built on top of [NumPyro](https://num.pyro.ai/), PyRenew provides configurable classes that encapsulate the components of a renewal model, and methods to orchestrate their composition into programs that clearly express model structure and choices.

## Renewal models

A renewal model estimates new infections from recent past infections using a generation interval distribution $w(s)$: the probability that $s$ time units separate infection in an index case and a secondary case.
The core renewal equation is:

$$I(t) = R_t \sum_{s} I(t-s) \, w(s)$$

where $R_t$ is the time-varying reproduction number.

Inference is complicated by the fact that observational data require their own models ([Bhatt et al., 2023, S2](https://doi.org/10.1093/jrsssa/qnad030)).
The observation equation links infections to expected observations:

$$\mu(t) = \alpha \sum_{s} I(t-s) \, \pi(s)$$

where $\alpha$ is the ascertainment rate and $\pi(s)$ is the delay distribution from infection to observation.

## Design

PyRenew's building blocks are:

- **`RandomVariable`** -- an abstract base class for quantities that models can sample from, including stochastic draws via `numpyro.sample()`, mechanistic computations, and fixed values.
- **`Model`** -- an abstract base class that defines model structure through a `sample()` method and provides functionality for fitting and simulation.
- **`PyrenewBuilder`** -- an orchestrator that composes `RandomVariable` components into a complete renewal model, auto-computing derived quantities like the number of initialization points.

Components (generation interval, reproduction number process, observation process) are specified independently, so each can be swapped without changing the rest of the model.
This makes it straightforward to move a quantity between "known" and "inferred" and keeps modeling choices explicit and reviewable.


## Multi-signal models

PyRenew's strength lies in multi-signal integration: pooling information across diverse observed data streams such as hospital admissions, wastewater concentrations, and emergency department visits, where each signal has distinct observation delays, noise characteristics, and spatial resolutions.
For single-signal renewal models, we recommend the excellent R package [EpiNow2](https://epiforecasts.io/EpiNow2/).

## Installation

```bash
pip install git+https://github.com/CDCgov/PyRenew@main
```

## Tutorials

- [The RandomVariable abstract base class](tutorials/random_variables.md) -- PyRenew's core abstraction and its concrete implementations.
- [Building multi-signal models](tutorials/building_multisignal_models.md) -- composing a renewal model from PyRenew components using `PyrenewBuilder`.
- [Observation processes: count data](tutorials/observation_processes_counts.md) -- connecting latent infections to observed counts.
- [Observation processes: measurements](tutorials/observation_processes_measurements.md) -- connecting latent infections to continuous measurements.
- [Latent hierarchical infections](tutorials/latent_hierarchical_infections.md) -- modeling infections with subpopulation structure.

## Resources

- [Model equations](https://github.com/CDCgov/PyRenew/blob/main/equations.md) -- the mathematics of the multi-signal renewal processes PyRenew supports.
- [API reference](reference/index.md)
- [Developer documentation](developer_documentation.md)

### Models implemented with PyRenew

- [pyrenew-covid-wastewater](https://github.com/CDCgov/pyrenew-covid-wastewater) -- forecasting COVID-19 hospitalizations using wastewater data.
- [pyrenew-flu-light](https://github.com/CDCgov/pyrenew-flu-light/) -- an influenza forecasting model used in the 2023-24 respiratory season.

### Further reading

- [Semi-mechanistic Bayesian modelling of COVID-19 with renewal processes](https://academic.oup.com/jrsssa/article-pdf/186/4/601/54770289/qnad030.pdf) (Bhatt et al., 2023)
- [Unifying incidence and prevalence under a time-varying general branching process](https://link.springer.com/content/pdf/10.1007/s00285-023-01958-w.pdf)
6 changes: 1 addition & 5 deletions docs/tutorials/.pages
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
nav:
- getting_started.md
- random_variables.md
- building_multisignal_models.md
- observation_processes_counts.md
- observation_processes_measurements.md
- latent_hierarchical_infections.md
- custom_randomvariables.md
- basic_renewal_model.md
- hospital_admissions_model.md
- day_of_the_week.md
- periodic_effects.md
Loading
Loading