Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 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
0304bed
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 6, 2026
ffeea65
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 9, 2026
50e7261
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 9, 2026
dae6af8
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 10, 2026
5cb3097
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 11, 2026
1d80ccc
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 11, 2026
e73b401
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 12, 2026
b1473b5
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 18, 2026
0b929b5
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 18, 2026
3ee00a7
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 24, 2026
307982a
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 24, 2026
b862bc6
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Feb 26, 2026
2c665a5
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Mar 11, 2026
60d6458
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Mar 12, 2026
ec8c464
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Mar 19, 2026
c018bf7
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Mar 24, 2026
d0207dd
Merge branch 'main' of github-bf06:CDCgov/PyRenew
cdc-mitzimorris Apr 4, 2026
87b7dbe
update tutorials
cdc-mitzimorris Apr 6, 2026
b590451
Update docs/tutorials/observation_processes_counts.qmd
cdc-mitzimorris Apr 6, 2026
2953e11
Update docs/tutorials/observation_processes_counts.qmd
cdc-mitzimorris Apr 6, 2026
1ee9fce
Update docs/tutorials/observation_processes_counts.qmd
cdc-mitzimorris Apr 6, 2026
f871f65
Update docs/tutorials/observation_processes_counts.qmd
cdc-mitzimorris Apr 6, 2026
dbe4205
Update docs/tutorials/observation_processes_counts.qmd
cdc-mitzimorris Apr 6, 2026
2c5c107
Update docs/tutorials/observation_processes_counts.qmd
cdc-mitzimorris Apr 6, 2026
3d6aa51
Update docs/tutorials/observation_processes_measurements.qmd
cdc-mitzimorris Apr 6, 2026
115fefe
Update docs/tutorials/observation_processes_measurements.qmd
cdc-mitzimorris Apr 6, 2026
b1f0c3b
Update docs/tutorials/observation_processes_measurements.qmd
cdc-mitzimorris Apr 6, 2026
1f63cd1
Update docs/tutorials/observation_processes_measurements.qmd
cdc-mitzimorris Apr 6, 2026
995501d
Update docs/index.md
cdc-mitzimorris Apr 6, 2026
0f01de9
Update docs/index.md
cdc-mitzimorris Apr 6, 2026
1abe1e6
Update docs/index.md
cdc-mitzimorris Apr 6, 2026
e90407f
Update docs/index.md
cdc-mitzimorris Apr 6, 2026
b838b29
Update docs/index.md
cdc-mitzimorris Apr 6, 2026
e917857
Merge branch 'mem_768_tutorials' of github-bf06:CDCgov/PyRenew into m…
cdc-mitzimorris Apr 6, 2026
e0dd950
changes per code review
cdc-mitzimorris Apr 6, 2026
f47bb17
Update docs/tutorials/latent_infections.qmd
cdc-mitzimorris Apr 6, 2026
d18f289
add pandas dep
cdc-mitzimorris Apr 7, 2026
175ea33
tutorial updates per code review
cdc-mitzimorris Apr 7, 2026
037c5e8
merge fix
cdc-mitzimorris Apr 7, 2026
56a27ba
changes per docs review
cdc-mitzimorris Apr 9, 2026
bbfe32e
changes per docs review
cdc-mitzimorris Apr 9, 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
67 changes: 59 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,70 @@ Built on top of [NumPyro](https://num.pyro.ai/), PyRenew provides configurable c

## 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:
A renewal model estimates new infections from recent past infections.
It combines two distinct discrete convolutions which describe different processes: transmission between infections and delay from infection to observation.

$$I(t) = \mathcal{R}(t) \sum_{s} I(t-s) \, w(s)$$
- The **renewal equation** maps past infections to new infections using the generation interval distribution $w_\tau$.
- The **observation equation** maps latent infections to expected observed events using the delay distribution $\pi_d$.

where $R_t$ is the time-varying reproduction number.
#### Renewal equation

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:
New infections arise from past infections through a generation interval distribution.

$$\mu(t) = \alpha \sum_{s} I(t-s) \, \pi(s)$$
Let $I(t)$ denote the latent number of new infections at time $t$, and let $\mathcal{R}(t)$ denote the time-varying reproduction number.
Assume the generation interval distribution has finite support over lags $\tau = 1, \dots, G$. Let $w_\tau$ denote the probability that a secondary infection occurs $\tau$ days after infection in the primary case, with

where $\alpha$ is the ascertainment rate and $\pi(s)$ is the delay distribution from infection to observation.
$$
\sum_{\tau=1}^{G} w_\tau = 1, \qquad w_\tau \ge 0.
$$

Then the renewal equation is

$$
I(t) = \mathcal{R}(t) \sum_{\tau=1}^{G} I(t - \tau)\, w_\tau.
$$

Here, $\tau$ indexes the generation interval.

In PyRenew, the latent process is represented on a **per-capita scale** (infection proportion) and is multiplied by a population size downstream when connecting to count observations.

#### Observation equation

Infections are latent and are not directly observed; instead, the data consist of events that occur some time after infection, such as hospitalizations or emergency department visits.

Let $\mu(t)$ denote the expected number of observed events at time $t$, and let $\alpha$ denote an **ascertainment rate**, the probability an infection is observed as an event. Assume the delay from infection to observation has finite support over lags $d = 0, \dots, D$. Let $\pi_d$ denote the probability that an infection is observed $d$ days later, with

$$
\sum_{d=0}^{D} \pi_d = 1, \qquad \pi_d \ge 0.
$$

Then the observation equation is

$$
\mu(t) = \alpha \sum_{d=0}^{D} I(t - d)\, \pi_d.
$$

Here, $d$ indexes lags in the infection-to-observation delay distribution.

#### Stochastic observation model

The observation equation defines the expected number of observed events at time $t$, but the actual observed data are stochastic.

Let $Y(t)$ denote the observed number of events at time $t$. We model observations as draws from a count distribution with central value (typically mean) $\mu(t)$:

$$
Y(t) \sim \text{Distribution}(\mu(t), \theta).
$$

One possible choice is the Poisson distribution, which assumes the variance equals the mean.
In practice, epidemiological count data are often overdispersed relative to the Poisson. Negative binomial distributions are a common choice for modeling these overdispersed counts.

The model thus has two layers:

- A **mechanistic layer**, where the renewal and delay convolutions determine the predicted number of observations $\mu(t)$ from the latent infections $I(t)$.
- A **stochastic observation layer**, where observed counts $Y(t)$ vary around $\mu(t)$ according to a specified distribution.

This separation allows the model to distinguish between systematic structure driven by transmission and reporting delays, and stochastic variability in observed data.

## Design

Expand Down
13 changes: 12 additions & 1 deletion docs/tutorials/building_multisignal_models.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Latent infection processes implement the renewal equation to generate infection

### Generation Interval

The generation interval PMF specifies the probability that a secondary infection occurs $d$ days after the primary infection.
The generation interval PMF specifies the probability that a secondary infection occurs $\tau$ days after the primary infection.

```{python}
# | label: gen-interval
Expand All @@ -206,6 +206,8 @@ The initial infections RV `I0_rv` specifies the **proportion of the population i
I0_rv = DistributionalVariable("I0", dist.Beta(1, 100))
```



### Initial Log Rt

We place a prior on the initial log(Rt), centered at 0.0 (Rt = 1.0) with moderate uncertainty:
Expand Down Expand Up @@ -554,6 +556,15 @@ print(f" Latent process: {type(model.latent).__name__}")
print(f" Observation processes: {list(model.observations.keys())}")
```

### Model Identifiability.

The renewal equation is linear in the initial infections `I0_rv`, so scaling `I0_rv` by a factor $c$ scales the entire infection trajectory by $c$.
In practice, `I0_rv` is weakly identified because each observation process links infections to data through a signal-specific ascertainment rate $\alpha_s$ — the probability that an infection is observed as an event in signal $s$.
Doubling `I0_rv` while halving all ascertainment rates produces identical expected observations.
Without external information to anchor either the ascertainment rates or the absolute infection level, the data cannot distinguish "more infections, lower ascertainment" from "fewer infections, higher ascertainment."
The priors on `I0_rv` and on the ascertainment rates resolve this ambiguity.


## Fitting the Model to Data: `model.run()`

When you call `model.run()`, you supply two types of information:
Expand Down
Loading
Loading