Epidemic renewal and reporting delays
This example uses 56 simulated days of epidemic counts, generated with seed
- The generating reproduction number starts at 1.3 and follows a daily
log random walk. A gamma generation interval links past infections to new infections; a lognormal reporting delay separates infection from observation. Daily reports follow a negative-binomial distribution. Simulation makes the expected report trajectory available for comparison, while the fit receives only the counts, observation days and fixed delay distributions. There are no patient records in this example.
Model
The renewal equation separates transmission from observation. Infectiousness is a weighted sum of previous incidence, and the reproduction number scales that sum to give today's infections. Reports are a second convolution:
The generation-interval weights g start at lag one; reporting-delay weights h include lag zero. The distinction matters: same-day reports are possible, but an infection does not generate itself. The expected-case function carries the infection history through both convolutions. Before day one, the model uses an exponential history whose initial growth rate satisfies the discretized Euler–Lotka equation for the initial reproduction number.
expected_cases(log_R::vector[T], log_I0::real, gen_pmf::vector[G], delay_pmf::vector[D])::vector[T] = begin
I0 = exp(log_I0)
r0 = growth_rate(exp(log_R[1]), gen_pmf)
I::vector[T]
for t in 1:T
I[t] = clamp2(exp(log_R[t]) * lagged_sum(I, t, gen_pmf, I0, r0, 1), 0.0, 1e15)
end
Y::vector[T]
for t in 1:T
Y[t] = lagged_sum(I, t, delay_pmf, I0, r0, 0)
end
Y
end
# ── observation family: negative-binomial counts on the rows marked observed ──
# cases ~ NegBin(mean Y, variance Y + cluster^2 Y^2); a row with observed == 0 is not scored,
# and the generator draws every row, so an unobserved row's draw is its forecastBRM's rw(time) term supplies the daily innovations. The intercept prior sets the first log reproduction number; the term's SD prior sets the scale of changes from one day to the next. log_I0 determines the initial infection scale. cluster is a positive overdispersion scale: the observation variance is m + cluster² m². These quantities are inferred jointly, so uncertainty in initial incidence propagates through the entire reporting trajectory.
Renewal with delayed reports
panes: brm|stanblocks|rkppl|stan|jax:1function renewal_single_model(data = renewal_single_data())
@brm data begin
log_I0 ~ Normal(log(50.0), 0.5) # log initial infections (scale of the seeded history)
cluster ~ Normal(0.0, 0.1; lower=0.0) # overdispersion of the counts
log_R ~ 1 + rw(time) # log R_t: a random walk over days
effect(log_R, Intercept) ~ Normal(log(1.3), 0.1) # ... its first value, log R_1
sd(:, rw(time)) ~ Normal(0.0, 0.05) # ... its daily innovation scale
Y = expected_cases(log_R, log_I0, gen_pmf, delay_pmf)
cases ~ nb_cases(Y, cluster, observed)
end
endSBBRMI with data keys = [:cases, :delay_pmf, :gen_pmf, :observed, :rw_log_R_time_n_new_steps, :rw_log_R_time_n_steps, :rw_log_R_time_time_idx, :time]
configured submodels:
_sb_rw1_configured_1 = Base.merge(BayesianRegressionModels._sb_rw1, quote
sigma ~ (StanBlocks.builtin.restricted)(normal, 0.0, 0.05; lower = 0.0)
end)
emitted @slic body:
begin
log_I0 ~ normal(3.912023005428146, 0.5)
cluster ~ (StanBlocks.builtin.restricted)(normal, 0.0, 0.1; lower = 0.0)
X_log_R = hcat(rep_vector(1.0, num_elements(time)))
pop_log_R ~ _popefs_normal(; X = X_log_R, beta_loc = [0.26236426446749106], beta_scale = [0.1])
rw_log_R_time ~ _sb_rw1_configured_1(; n_steps = rw_log_R_time_n_steps, n_new_steps = rw_log_R_time_n_new_steps, time_idx = rw_log_R_time_time_idx)
log_R = pop_log_R + rw_log_R_time
Y = (Main.renewal.expected_cases)(log_R, log_I0, gen_pmf, delay_pmf)
cases ~ nb_cases(Y, cluster, observed)
endRKPPL unsupported for this BRM example
RK backend: predictor `log_R` structured term `rw` needs prepared group fields and a native Julia effectfunctions {
matrix hcat(vector x) {
int n = dims(x)[1];
return to_matrix(x, n, 1);
}
vector random_walk_rows(
real sigma,
vector z,
array[] int idx
) {
int N = dims(idx)[1];
vector[(dims(z)[1] + 1)] x = random_walk_path(sigma, z);
vector[N] out;
for(i in 1:N) {
out[i] = x[idx[i]];
}
return out;
}
vector random_walk_path(
real sigma,
vector z
) {
int n = dims(z)[1];
return append_row(0.0, (sigma * cumulative_sum(z)));
}
vector expected_cases(
vector log_R,
real log_I0,
vector gen_pmf,
vector delay_pmf
) {
int T = dims(log_R)[1];
real I0 = exp(log_I0);
real r0 = growth_rate(exp(log_R[1]), gen_pmf);
vector[T] I;
for(t in 1:T) {
I[t] = clamp2((exp(log_R[t]) * lagged_sum(I, t, gen_pmf, I0, r0, 1)), 0.0, 1.0e15);
}
vector[T] Y;
for(t in 1:T) {
Y[t] = lagged_sum(I, t, delay_pmf, I0, r0, 0);
}
return Y;
}
real growth_rate(
real R,
vector gen_pmf
) {
int G = dims(gen_pmf)[1];
real r = 0.0;
for(iter in 1:2) {
real f = (-1.0 / R);
real df = 0.0;
for(s in 1:G) {
f += (gen_pmf[s] * exp(((-r) * s)));
df -= (s * gen_pmf[s] * exp(((-r) * s)));
}
r = (r - (f / df));
}
return clamp2(r, -2.0, 2.0);
}
real clamp2(real x, real lo, real hi) {
return ((x < lo) ? lo : ((x > hi) ? hi : x));
}
real lagged_sum(
vector x,
int t,
vector pmf,
real x0,
real r,
int first_lag
) {
int G = dims(pmf)[1];
real acc = 0.0;
for(i in 1:G) {
int s = (t - ((first_lag + i) - 1));
acc += (pmf[i] * ((s >= 1) ? x[s] : (x0 * exp((r * (s - 1))))));
}
return acc;
}
real nb_cases_lpmf(
array[] int cases,
vector Y,
real cluster,
array[] int observed
) {
int N = dims(cases)[1];
if (dims(Y)[1] != N) reject("nb_cases_lpmf: dim mismatch — `Y` dim 1 (= ", dims(Y)[1], ") does not match `N` (= ", N, "), inferred from `cases` dim 1. `N` sizes: `cases` dim 1 (= ", dims(cases)[1], "), `Y` dim 1 (= ", dims(Y)[1], "), `observed` dim 1 (= ", dims(observed)[1], ").");
if (dims(observed)[1] != N) reject("nb_cases_lpmf: dim mismatch — `observed` dim 1 (= ", dims(observed)[1], ") does not match `N` (= ", N, "), inferred from `cases` dim 1. `N` sizes: `cases` dim 1 (= ", dims(cases)[1], "), `Y` dim 1 (= ", dims(Y)[1], "), `observed` dim 1 (= ", dims(observed)[1], ").");
real lp = 0.0;
for(i in 1:N) {
if((observed[i] == 1)) {
lp += neg_binomial_2_lpmf(cases[i] | Y[i], (1.0 / (cluster * cluster)));
}
}
return lp;
}
vector nb_cases_lpmfs(
array[] int cases,
vector Y,
real cluster,
array[] int observed
) {
int N = dims(cases)[1];
if (dims(Y)[1] != N) reject("nb_cases_lpmfs: dim mismatch — `Y` dim 1 (= ", dims(Y)[1], ") does not match `N` (= ", N, "), inferred from `cases` dim 1. `N` sizes: `cases` dim 1 (= ", dims(cases)[1], "), `Y` dim 1 (= ", dims(Y)[1], "), `observed` dim 1 (= ", dims(observed)[1], ").");
if (dims(observed)[1] != N) reject("nb_cases_lpmfs: dim mismatch — `observed` dim 1 (= ", dims(observed)[1], ") does not match `N` (= ", N, "), inferred from `cases` dim 1. `N` sizes: `cases` dim 1 (= ", dims(cases)[1], "), `Y` dim 1 (= ", dims(Y)[1], "), `observed` dim 1 (= ", dims(observed)[1], ").");
vector[N] lp;
for(i in 1:N) {
lp[i] = ((observed[i] == 1) ? neg_binomial_2_lpmf(cases[i] | Y[i], (1.0 / (cluster * cluster))) : 0.0);
}
return lp;
}
array[] int nb_cases_int_rng(
int anontok__1,
vector Y,
real cluster,
array[] int observed
) {
int N = anontok__1;
if (dims(Y)[1] != N) reject("nb_cases_rng: dim mismatch — `Y` dim 1 (= ", dims(Y)[1], ") does not match `N` (= ", N, "), inferred from `anontok__1` dim 1. `N` sizes: `anontok__1` dim 1 (= ", anontok__1, "), `Y` dim 1 (= ", dims(Y)[1], "), `observed` dim 1 (= ", dims(observed)[1], ").");
if (dims(observed)[1] != N) reject("nb_cases_rng: dim mismatch — `observed` dim 1 (= ", dims(observed)[1], ") does not match `N` (= ", N, "), inferred from `anontok__1` dim 1. `N` sizes: `anontok__1` dim 1 (= ", anontok__1, "), `Y` dim 1 (= ", dims(Y)[1], "), `observed` dim 1 (= ", dims(observed)[1], ").");
array[N] int out;
for(i in 1:N) {
out[i] = neg_binomial_2_rng(Y[i], (1.0 / (cluster * cluster)));
}
return out;
}
}
data {
int time_n;
vector[time_n] time;
int rw_log_R_time_n_steps;
int rw_log_R_time_n_new_steps;
int rw_log_R_time_time_idx_n;
array[rw_log_R_time_time_idx_n] int rw_log_R_time_time_idx;
int gen_pmf_n;
vector[gen_pmf_n] gen_pmf;
int delay_pmf_n;
vector[delay_pmf_n] delay_pmf;
int cases_n;
array[cases_n] int cases;
int observed_n;
array[observed_n] int observed;
}
transformed data {
matrix[num_elements(time), 1] X_log_R = hcat(rep_vector(1.0, num_elements(time)));
int pop_log_R_n_covariates = 1;
}
parameters {
real log_I0;
real<lower=0.0> cluster;
vector[pop_log_R_n_covariates] pop_log_R_beta_pop;
real<lower=0.0> rw_log_R_time_sigma;
vector[(rw_log_R_time_n_steps - 1)] rw_log_R_time_z;
vector[rw_log_R_time_n_new_steps] rw_log_R_time_z_new;
}
transformed parameters {
vector[num_elements(time)] pop_log_R = (X_log_R * pop_log_R_beta_pop);
vector[rw_log_R_time_time_idx_n] rw_log_R_time = random_walk_rows(
rw_log_R_time_sigma,
append_row(rw_log_R_time_z, rw_log_R_time_z_new),
rw_log_R_time_time_idx
);
vector[num_elements(time)] log_R = (pop_log_R + rw_log_R_time);
vector[num_elements(time)] Y = expected_cases(log_R, log_I0, gen_pmf, delay_pmf);
}
model {
log_I0 ~ normal(3.912023005428146, 0.5);
cluster ~ normal(0.0, 0.1);
pop_log_R_beta_pop ~ normal([0.26236426446749106]', [0.1]');
rw_log_R_time_sigma ~ normal(0.0, 0.05);
rw_log_R_time_z ~ std_normal();
rw_log_R_time_z_new ~ std_normal();
cases ~ nb_cases(Y, cluster, observed);
}
generated quantities {
vector[observed_n] cases_likelihood = nb_cases_lpmfs(cases, Y, cluster, observed);
array[observed_n] int cases_gen = nb_cases_int_rng(cases_n, Y, cluster, observed);
}JAX export unavailable because RKPPL source emission failed.
RK backend: predictor `log_R` structured term `rw` needs prepared group fields and a native Julia effectThe observed mask in the custom count family distinguishes observed from unobserved days. This fit observes all 56 days. Setting later entries to zero removes those likelihood contributions while retaining the latent process and predictive outputs for those days. It does not set their counts to zero or treat missing reports as evidence of no infections. A forecast must therefore be constructed by changing the mask, not by appending zero counts to the fitted observation vector.
Delay distributions
A continuous delay is not rounded independently of the primary event time. An infection occurs somewhere within its calendar day. The data preparation integrates over a uniform within-day offset before assigning probability to successive report days, then normalizes over the chosen support. The probability vectors enter the model as data, so another generation interval or reporting-delay distribution changes the fit without changing the model body. This example conditions on those distributions; their uncertainty is not included in the posterior bands.
A line list would require a separate delay likelihood. If both event dates are recorded as intervals and recent events are missing long delays, BRM's double_interval_censored family integrates the primary event window and conditions on the observation cutoff. The epidist research example contains that model and its comparison with epidist. Estimating delays from such a list is a different inferential step from fitting counts with fixed delay weights; the research notes describe how the two relate.
Fit and diagnostics
Four independent WarmupHMC chains start from different random seeds, each requesting 1,000 retained draws. The completion sampler requires three chains to finish and then lets the remaining chain finish its current warmup round. The table records how many chains contributed, which were omitted, the total retained draws, divergences and sampling time. These are results of the cached run; rebuilding this page reads its tables without sampling again.
| started | retained | omitted | draws | divergences | % | seconds |
|---|---|---|---|---|---|---|
| 4 | 3 | 2 | 3000 | 0 | 0.0 | 147.8 |
Population summaries use the retained chains on the quantities' natural scales. The intervals contain the central 95 % of their pooled draws. Split R-hat compares chains; bulk and tail effective sample sizes describe the information in the centre and tails. A small divergence count alone is insufficient evidence that the chains agree. The completion rule can also select chains by speed, so the omitted-chain record belongs with the result.
| quantity | unit | median | 2.5 % | 97.5 % | R-hat | bulk ESS | tail ESS |
|---|---|---|---|---|---|---|---|
| initial infections | people/day | 53.1 | 46.74 | 59.87 | 1.001 | 2549 | 2036 |
| initial R | 1.279 | 1.146 | 1.434 | 1.008 | 445 | 767 | |
| cluster | 0.115 | 0.08443 | 0.1528 | 1.002 | 2797 | 2012 |
Expected reports
The retained three-chain run has no divergences. R-hat is 1.001–1.008 for the reported population quantities, with bulk ESS at least 445. Their 95 % intervals contain the generating initial reproduction number of 1.3, initial incidence of 50 infections per day and overdispersion scale of 0.1. This checks recovery in this simulated series, conditional on the fixed generation and reporting delays.
{"spec":"{\"$schema\":\"https://vega.github.io/schema/vega-lite/v5.json\",\"_aovSummary\":{\"bands\":[[\"q025\",\"q975\",\"q025/q975\"],[\"q25\",\"q75\",\"q25/q75\"]],\"point_col\":\"q50\",\"value_label\":\"q50\"},\"config\":{\"axis\":{\"labelLimit\":0},\"header\":{\"labelLimit\":0},\"legend\":{\"labelLimit\":0}},\"height\":300,\"layer\":[{\"_lr_layer\":true,\"data\":{\"values\":[{\"q025\":33.05,\"q25\":37.14,\"q50\":39.47,\"q75\":41.65,\"q975\":46.25,\"time\":1.0},{\"q025\":35.86,\"q25\":39.77,\"q50\":41.96,\"q75\":44.06,\"q975\":48.42,\"time\":2.0},{\"q025\":38.82,\"q25\":42.63,\"q50\":44.66,\"q75\":46.71,\"q975\":50.66,\"time\":3.0},{\"q025\":41.9,\"q25\":45.55,\"q50\":47.5,\"q75\":49.51,\"q975\":53.35,\"time\":4.0},{\"q025\":44.95,\"q25\":48.57,\"q50\":50.49,\"q75\":52.48,\"q975\":56.31,\"time\":5.0},{\"q025\":48.19,\"q25\":51.71,\"q50\":53.64,\"q75\":55.61,\"q975\":59.58,\"time\":6.0},{\"q025\":51.38,\"q25\":54.94,\"q50\":56.85,\"q75\":58.79,\"q975\":62.78,\"time\":7.0},{\"q025\":54.52,\"q25\":58.11,\"q50\":60.1,\"q75\":62.03,\"q975\":66.25,\"time\":8.0},{\"q025\":57.57,\"q25\":61.29,\"q50\":63.33,\"q75\":65.37,\"q975\":69.8,\"time\":9.0},{\"q025\":60.81,\"q25\":64.49,\"q50\":66.59,\"q75\":68.68,\"q975\":73.3,\"time\":10.0},{\"q025\":63.84,\"q25\":67.79,\"q50\":69.86,\"q75\":72.15,\"q975\":76.78,\"time\":11.0},{\"q025\":66.77,\"q25\":71.08,\"q50\":73.19,\"q75\":75.62,\"q975\":80.43,\"time\":12.0},{\"q025\":70.01,\"q25\":74.51,\"q50\":76.69,\"q75\":79.16,\"q975\":84.23,\"time\":13.0},{\"q025\":73.27,\"q25\":78.03,\"q50\":80.3,\"q75\":82.85,\"q975\":87.89,\"time\":14.0},{\"q025\":76.63,\"q25\":81.64,\"q50\":84.16,\"q75\":86.7,\"q975\":91.94,\"time\":15.0},{\"q025\":80.27,\"q25\":85.52,\"q50\":88.15,\"q75\":90.86,\"q975\":96.21,\"time\":16.0},{\"q025\":84.27,\"q25\":89.58,\"q50\":92.39,\"q75\":95.07,\"q975\":100.9,\"time\":17.0},{\"q025\":88.59,\"q25\":93.99,\"q50\":96.83,\"q75\":99.76,\"q975\":105.6,\"time\":18.0},{\"q025\":92.81,\"q25\":98.65,\"q50\":101.6,\"q75\":104.6,\"q975\":111.0,\"time\":19.0},{\"q025\":97.38,\"q25\":103.6,\"q50\":106.7,\"q75\":109.9,\"q975\":116.3,\"time\":20.0},{\"q025\":102.4,\"q25\":108.7,\"q50\":112.0,\"q75\":115.3,\"q975\":122.1,\"time\":21.0},{\"q025\":107.5,\"q25\":114.2,\"q50\":117.7,\"q75\":121.2,\"q975\":128.5,\"time\":22.0},{\"q025\":113.1,\"q25\":120.1,\"q50\":123.7,\"q75\":127.3,\"q975\":135.0,\"time\":23.0},{\"q025\":118.9,\"q25\":126.3,\"q50\":130.2,\"q75\":134.0,\"q975\":142.0,\"time\":24.0},{\"q025\":125.5,\"q25\":133.0,\"q50\":137.2,\"q75\":141.1,\"q975\":149.4,\"time\":25.0},{\"q025\":132.8,\"q25\":140.3,\"q50\":144.6,\"q75\":148.7,\"q975\":157.2,\"time\":26.0},{\"q025\":140.0,\"q25\":148.0,\"q50\":152.2,\"q75\":156.5,\"q975\":165.3,\"time\":27.0},{\"q025\":147.6,\"q25\":155.9,\"q50\":160.3,\"q75\":164.8,\"q975\":173.7,\"time\":28.0},{\"q025\":155.6,\"q25\":164.1,\"q50\":168.7,\"q75\":173.5,\"q975\":182.7,\"time\":29.0},{\"q025\":163.7,\"q25\":172.5,\"q50\":177.1,\"q75\":182.3,\"q975\":192.5,\"time\":30.0},{\"q025\":171.6,\"q25\":180.7,\"q50\":185.7,\"q75\":191.0,\"q975\":202.5,\"time\":31.0},{\"q025\":178.8,\"q25\":188.5,\"q50\":193.9,\"q75\":199.5,\"q975\":211.7,\"time\":32.0},{\"q025\":185.5,\"q25\":195.8,\"q50\":201.6,\"q75\":207.3,\"q975\":220.1,\"time\":33.0},{\"q025\":191.8,\"q25\":202.6,\"q50\":208.5,\"q75\":214.7,\"q975\":227.3,\"time\":34.0},{\"q025\":197.2,\"q25\":208.8,\"q50\":214.7,\"q75\":220.9,\"q975\":234.1,\"time\":35.0},{\"q025\":202.4,\"q25\":214.2,\"q50\":220.1,\"q75\":226.5,\"q975\":239.9,\"time\":36.0},{\"q025\":207.3,\"q25\":218.7,\"q50\":224.8,\"q75\":231.5,\"q975\":245.1,\"time\":37.0},{\"q025\":210.5,\"q25\":222.5,\"q50\":228.9,\"q75\":235.4,\"q975\":248.8,\"time\":38.0},{\"q025\":213.3,\"q25\":225.6,\"q50\":231.9,\"q75\":238.8,\"q975\":251.9,\"time\":39.0},{\"q025\":215.1,\"q25\":227.9,\"q50\":234.1,\"q75\":240.9,\"q975\":254.1,\"time\":40.0},{\"q025\":216.5,\"q25\":229.3,\"q50\":235.5,\"q75\":242.2,\"q975\":255.1,\"time\":41.0},{\"q025\":217.6,\"q25\":230.0,\"q50\":236.1,\"q75\":242.9,\"q975\":255.7,\"time\":42.0},{\"q025\":217.3,\"q25\":230.1,\"q50\":236.1,\"q75\":242.9,\"q975\":255.9,\"time\":43.0},{\"q025\":216.9,\"q25\":229.6,\"q50\":235.9,\"q75\":242.5,\"q975\":255.3,\"time\":44.0},{\"q025\":215.6,\"q25\":228.8,\"q50\":235.0,\"q75\":241.7,\"q975\":254.9,\"time\":45.0},{\"q025\":214.6,\"q25\":227.7,\"q50\":234.3,\"q75\":241.0,\"q975\":254.6,\"time\":46.0},{\"q025\":213.4,\"q25\":226.7,\"q50\":233.6,\"q75\":240.3,\"q975\":254.0,\"time\":47.0},{\"q025\":212.6,\"q25\":226.3,\"q50\":233.3,\"q75\":240.2,\"q975\":254.1,\"time\":48.0},{\"q025\":212.9,\"q25\":226.4,\"q50\":233.3,\"q75\":240.7,\"q975\":254.9,\"time\":49.0},{\"q025\":214.6,\"q25\":227.3,\"q50\":234.5,\"q75\":241.8,\"q975\":256.1,\"time\":50.0},{\"q025\":216.5,\"q25\":229.1,\"q50\":236.3,\"q75\":243.1,\"q975\":257.3,\"time\":51.0},{\"q025\":218.8,\"q25\":231.7,\"q50\":238.3,\"q75\":245.5,\"q975\":259.9,\"time\":52.0},{\"q025\":220.2,\"q25\":233.8,\"q50\":240.9,\"q75\":248.6,\"q975\":264.6,\"time\":53.0},{\"q025\":221.0,\"q25\":235.7,\"q50\":243.5,\"q75\":252.3,\"q975\":270.4,\"time\":54.0},{\"q025\":219.8,\"q25\":237.7,\"q50\":246.6,\"q75\":257.0,\"q975\":279.0,\"time\":55.0},{\"q025\":217.0,\"q25\":238.5,\"q50\":249.8,\"q75\":262.6,\"q975\":290.6,\"time\":56.0}]},\"encoding\":{\"tooltip\":[{\"field\":\"time\",\"title\":\"Day\",\"type\":\"quantitative\"},{\"field\":\"q50\",\"title\":\"median\",\"type\":\"quantitative\"},{\"field\":\"q025\",\"title\":\"q025\",\"type\":\"quantitative\"},{\"field\":\"q975\",\"title\":\"q975\",\"type\":\"quantitative\"}],\"x\":{\"field\":\"time\",\"scale\":{\"zero\":false},\"title\":\"Day\",\"type\":\"quantitative\"},\"y\":{\"field\":\"q025\",\"scale\":{\"zero\":false},\"title\":\"Expected reports per day\",\"type\":\"quantitative\"},\"y2\":{\"field\":\"q975\"}},\"mark\":{\"color\":\"#2a78d6\",\"line\":false,\"opacity\":0.2,\"type\":\"area\"},\"params\":[{\"bind\":\"scales\",\"name\":\"grid\",\"select\":{\"encodings\":[\"x\",\"y\"],\"type\":\"interval\"}}]},{\"_lr_layer\":true,\"data\":{\"values\":[{\"q025\":33.05,\"q25\":37.14,\"q50\":39.47,\"q75\":41.65,\"q975\":46.25,\"time\":1.0},{\"q025\":35.86,\"q25\":39.77,\"q50\":41.96,\"q75\":44.06,\"q975\":48.42,\"time\":2.0},{\"q025\":38.82,\"q25\":42.63,\"q50\":44.66,\"q75\":46.71,\"q975\":50.66,\"time\":3.0},{\"q025\":41.9,\"q25\":45.55,\"q50\":47.5,\"q75\":49.51,\"q975\":53.35,\"time\":4.0},{\"q025\":44.95,\"q25\":48.57,\"q50\":50.49,\"q75\":52.48,\"q975\":56.31,\"time\":5.0},{\"q025\":48.19,\"q25\":51.71,\"q50\":53.64,\"q75\":55.61,\"q975\":59.58,\"time\":6.0},{\"q025\":51.38,\"q25\":54.94,\"q50\":56.85,\"q75\":58.79,\"q975\":62.78,\"time\":7.0},{\"q025\":54.52,\"q25\":58.11,\"q50\":60.1,\"q75\":62.03,\"q975\":66.25,\"time\":8.0},{\"q025\":57.57,\"q25\":61.29,\"q50\":63.33,\"q75\":65.37,\"q975\":69.8,\"time\":9.0},{\"q025\":60.81,\"q25\":64.49,\"q50\":66.59,\"q75\":68.68,\"q975\":73.3,\"time\":10.0},{\"q025\":63.84,\"q25\":67.79,\"q50\":69.86,\"q75\":72.15,\"q975\":76.78,\"time\":11.0},{\"q025\":66.77,\"q25\":71.08,\"q50\":73.19,\"q75\":75.62,\"q975\":80.43,\"time\":12.0},{\"q025\":70.01,\"q25\":74.51,\"q50\":76.69,\"q75\":79.16,\"q975\":84.23,\"time\":13.0},{\"q025\":73.27,\"q25\":78.03,\"q50\":80.3,\"q75\":82.85,\"q975\":87.89,\"time\":14.0},{\"q025\":76.63,\"q25\":81.64,\"q50\":84.16,\"q75\":86.7,\"q975\":91.94,\"time\":15.0},{\"q025\":80.27,\"q25\":85.52,\"q50\":88.15,\"q75\":90.86,\"q975\":96.21,\"time\":16.0},{\"q025\":84.27,\"q25\":89.58,\"q50\":92.39,\"q75\":95.07,\"q975\":100.9,\"time\":17.0},{\"q025\":88.59,\"q25\":93.99,\"q50\":96.83,\"q75\":99.76,\"q975\":105.6,\"time\":18.0},{\"q025\":92.81,\"q25\":98.65,\"q50\":101.6,\"q75\":104.6,\"q975\":111.0,\"time\":19.0},{\"q025\":97.38,\"q25\":103.6,\"q50\":106.7,\"q75\":109.9,\"q975\":116.3,\"time\":20.0},{\"q025\":102.4,\"q25\":108.7,\"q50\":112.0,\"q75\":115.3,\"q975\":122.1,\"time\":21.0},{\"q025\":107.5,\"q25\":114.2,\"q50\":117.7,\"q75\":121.2,\"q975\":128.5,\"time\":22.0},{\"q025\":113.1,\"q25\":120.1,\"q50\":123.7,\"q75\":127.3,\"q975\":135.0,\"time\":23.0},{\"q025\":118.9,\"q25\":126.3,\"q50\":130.2,\"q75\":134.0,\"q975\":142.0,\"time\":24.0},{\"q025\":125.5,\"q25\":133.0,\"q50\":137.2,\"q75\":141.1,\"q975\":149.4,\"time\":25.0},{\"q025\":132.8,\"q25\":140.3,\"q50\":144.6,\"q75\":148.7,\"q975\":157.2,\"time\":26.0},{\"q025\":140.0,\"q25\":148.0,\"q50\":152.2,\"q75\":156.5,\"q975\":165.3,\"time\":27.0},{\"q025\":147.6,\"q25\":155.9,\"q50\":160.3,\"q75\":164.8,\"q975\":173.7,\"time\":28.0},{\"q025\":155.6,\"q25\":164.1,\"q50\":168.7,\"q75\":173.5,\"q975\":182.7,\"time\":29.0},{\"q025\":163.7,\"q25\":172.5,\"q50\":177.1,\"q75\":182.3,\"q975\":192.5,\"time\":30.0},{\"q025\":171.6,\"q25\":180.7,\"q50\":185.7,\"q75\":191.0,\"q975\":202.5,\"time\":31.0},{\"q025\":178.8,\"q25\":188.5,\"q50\":193.9,\"q75\":199.5,\"q975\":211.7,\"time\":32.0},{\"q025\":185.5,\"q25\":195.8,\"q50\":201.6,\"q75\":207.3,\"q975\":220.1,\"time\":33.0},{\"q025\":191.8,\"q25\":202.6,\"q50\":208.5,\"q75\":214.7,\"q975\":227.3,\"time\":34.0},{\"q025\":197.2,\"q25\":208.8,\"q50\":214.7,\"q75\":220.9,\"q975\":234.1,\"time\":35.0},{\"q025\":202.4,\"q25\":214.2,\"q50\":220.1,\"q75\":226.5,\"q975\":239.9,\"time\":36.0},{\"q025\":207.3,\"q25\":218.7,\"q50\":224.8,\"q75\":231.5,\"q975\":245.1,\"time\":37.0},{\"q025\":210.5,\"q25\":222.5,\"q50\":228.9,\"q75\":235.4,\"q975\":248.8,\"time\":38.0},{\"q025\":213.3,\"q25\":225.6,\"q50\":231.9,\"q75\":238.8,\"q975\":251.9,\"time\":39.0},{\"q025\":215.1,\"q25\":227.9,\"q50\":234.1,\"q75\":240.9,\"q975\":254.1,\"time\":40.0},{\"q025\":216.5,\"q25\":229.3,\"q50\":235.5,\"q75\":242.2,\"q975\":255.1,\"time\":41.0},{\"q025\":217.6,\"q25\":230.0,\"q50\":236.1,\"q75\":242.9,\"q975\":255.7,\"time\":42.0},{\"q025\":217.3,\"q25\":230.1,\"q50\":236.1,\"q75\":242.9,\"q975\":255.9,\"time\":43.0},{\"q025\":216.9,\"q25\":229.6,\"q50\":235.9,\"q75\":242.5,\"q975\":255.3,\"time\":44.0},{\"q025\":215.6,\"q25\":228.8,\"q50\":235.0,\"q75\":241.7,\"q975\":254.9,\"time\":45.0},{\"q025\":214.6,\"q25\":227.7,\"q50\":234.3,\"q75\":241.0,\"q975\":254.6,\"time\":46.0},{\"q025\":213.4,\"q25\":226.7,\"q50\":233.6,\"q75\":240.3,\"q975\":254.0,\"time\":47.0},{\"q025\":212.6,\"q25\":226.3,\"q50\":233.3,\"q75\":240.2,\"q975\":254.1,\"time\":48.0},{\"q025\":212.9,\"q25\":226.4,\"q50\":233.3,\"q75\":240.7,\"q975\":254.9,\"time\":49.0},{\"q025\":214.6,\"q25\":227.3,\"q50\":234.5,\"q75\":241.8,\"q975\":256.1,\"time\":50.0},{\"q025\":216.5,\"q25\":229.1,\"q50\":236.3,\"q75\":243.1,\"q975\":257.3,\"time\":51.0},{\"q025\":218.8,\"q25\":231.7,\"q50\":238.3,\"q75\":245.5,\"q975\":259.9,\"time\":52.0},{\"q025\":220.2,\"q25\":233.8,\"q50\":240.9,\"q75\":248.6,\"q975\":264.6,\"time\":53.0},{\"q025\":221.0,\"q25\":235.7,\"q50\":243.5,\"q75\":252.3,\"q975\":270.4,\"time\":54.0},{\"q025\":219.8,\"q25\":237.7,\"q50\":246.6,\"q75\":257.0,\"q975\":279.0,\"time\":55.0},{\"q025\":217.0,\"q25\":238.5,\"q50\":249.8,\"q75\":262.6,\"q975\":290.6,\"time\":56.0}]},\"encoding\":{\"tooltip\":[{\"field\":\"time\",\"title\":\"Day\",\"type\":\"quantitative\"},{\"field\":\"q50\",\"title\":\"median\",\"type\":\"quantitative\"},{\"field\":\"q025\",\"title\":\"q025\",\"type\":\"quantitative\"},{\"field\":\"q975\",\"title\":\"q975\",\"type\":\"quantitative\"}],\"x\":{\"field\":\"time\",\"scale\":{\"zero\":false},\"title\":\"Day\",\"type\":\"quantitative\"},\"y\":{\"field\":\"q25\",\"scale\":{\"zero\":false},\"title\":\"Expected reports per day\",\"type\":\"quantitative\"},\"y2\":{\"field\":\"q75\"}},\"mark\":{\"color\":\"#2a78d6\",\"line\":false,\"opacity\":0.6,\"type\":\"area\"}},{\"_lr_layer\":true,\"data\":{\"values\":[{\"q025\":33.05,\"q25\":37.14,\"q50\":39.47,\"q75\":41.65,\"q975\":46.25,\"time\":1.0},{\"q025\":35.86,\"q25\":39.77,\"q50\":41.96,\"q75\":44.06,\"q975\":48.42,\"time\":2.0},{\"q025\":38.82,\"q25\":42.63,\"q50\":44.66,\"q75\":46.71,\"q975\":50.66,\"time\":3.0},{\"q025\":41.9,\"q25\":45.55,\"q50\":47.5,\"q75\":49.51,\"q975\":53.35,\"time\":4.0},{\"q025\":44.95,\"q25\":48.57,\"q50\":50.49,\"q75\":52.48,\"q975\":56.31,\"time\":5.0},{\"q025\":48.19,\"q25\":51.71,\"q50\":53.64,\"q75\":55.61,\"q975\":59.58,\"time\":6.0},{\"q025\":51.38,\"q25\":54.94,\"q50\":56.85,\"q75\":58.79,\"q975\":62.78,\"time\":7.0},{\"q025\":54.52,\"q25\":58.11,\"q50\":60.1,\"q75\":62.03,\"q975\":66.25,\"time\":8.0},{\"q025\":57.57,\"q25\":61.29,\"q50\":63.33,\"q75\":65.37,\"q975\":69.8,\"time\":9.0},{\"q025\":60.81,\"q25\":64.49,\"q50\":66.59,\"q75\":68.68,\"q975\":73.3,\"time\":10.0},{\"q025\":63.84,\"q25\":67.79,\"q50\":69.86,\"q75\":72.15,\"q975\":76.78,\"time\":11.0},{\"q025\":66.77,\"q25\":71.08,\"q50\":73.19,\"q75\":75.62,\"q975\":80.43,\"time\":12.0},{\"q025\":70.01,\"q25\":74.51,\"q50\":76.69,\"q75\":79.16,\"q975\":84.23,\"time\":13.0},{\"q025\":73.27,\"q25\":78.03,\"q50\":80.3,\"q75\":82.85,\"q975\":87.89,\"time\":14.0},{\"q025\":76.63,\"q25\":81.64,\"q50\":84.16,\"q75\":86.7,\"q975\":91.94,\"time\":15.0},{\"q025\":80.27,\"q25\":85.52,\"q50\":88.15,\"q75\":90.86,\"q975\":96.21,\"time\":16.0},{\"q025\":84.27,\"q25\":89.58,\"q50\":92.39,\"q75\":95.07,\"q975\":100.9,\"time\":17.0},{\"q025\":88.59,\"q25\":93.99,\"q50\":96.83,\"q75\":99.76,\"q975\":105.6,\"time\":18.0},{\"q025\":92.81,\"q25\":98.65,\"q50\":101.6,\"q75\":104.6,\"q975\":111.0,\"time\":19.0},{\"q025\":97.38,\"q25\":103.6,\"q50\":106.7,\"q75\":109.9,\"q975\":116.3,\"time\":20.0},{\"q025\":102.4,\"q25\":108.7,\"q50\":112.0,\"q75\":115.3,\"q975\":122.1,\"time\":21.0},{\"q025\":107.5,\"q25\":114.2,\"q50\":117.7,\"q75\":121.2,\"q975\":128.5,\"time\":22.0},{\"q025\":113.1,\"q25\":120.1,\"q50\":123.7,\"q75\":127.3,\"q975\":135.0,\"time\":23.0},{\"q025\":118.9,\"q25\":126.3,\"q50\":130.2,\"q75\":134.0,\"q975\":142.0,\"time\":24.0},{\"q025\":125.5,\"q25\":133.0,\"q50\":137.2,\"q75\":141.1,\"q975\":149.4,\"time\":25.0},{\"q025\":132.8,\"q25\":140.3,\"q50\":144.6,\"q75\":148.7,\"q975\":157.2,\"time\":26.0},{\"q025\":140.0,\"q25\":148.0,\"q50\":152.2,\"q75\":156.5,\"q975\":165.3,\"time\":27.0},{\"q025\":147.6,\"q25\":155.9,\"q50\":160.3,\"q75\":164.8,\"q975\":173.7,\"time\":28.0},{\"q025\":155.6,\"q25\":164.1,\"q50\":168.7,\"q75\":173.5,\"q975\":182.7,\"time\":29.0},{\"q025\":163.7,\"q25\":172.5,\"q50\":177.1,\"q75\":182.3,\"q975\":192.5,\"time\":30.0},{\"q025\":171.6,\"q25\":180.7,\"q50\":185.7,\"q75\":191.0,\"q975\":202.5,\"time\":31.0},{\"q025\":178.8,\"q25\":188.5,\"q50\":193.9,\"q75\":199.5,\"q975\":211.7,\"time\":32.0},{\"q025\":185.5,\"q25\":195.8,\"q50\":201.6,\"q75\":207.3,\"q975\":220.1,\"time\":33.0},{\"q025\":191.8,\"q25\":202.6,\"q50\":208.5,\"q75\":214.7,\"q975\":227.3,\"time\":34.0},{\"q025\":197.2,\"q25\":208.8,\"q50\":214.7,\"q75\":220.9,\"q975\":234.1,\"time\":35.0},{\"q025\":202.4,\"q25\":214.2,\"q50\":220.1,\"q75\":226.5,\"q975\":239.9,\"time\":36.0},{\"q025\":207.3,\"q25\":218.7,\"q50\":224.8,\"q75\":231.5,\"q975\":245.1,\"time\":37.0},{\"q025\":210.5,\"q25\":222.5,\"q50\":228.9,\"q75\":235.4,\"q975\":248.8,\"time\":38.0},{\"q025\":213.3,\"q25\":225.6,\"q50\":231.9,\"q75\":238.8,\"q975\":251.9,\"time\":39.0},{\"q025\":215.1,\"q25\":227.9,\"q50\":234.1,\"q75\":240.9,\"q975\":254.1,\"time\":40.0},{\"q025\":216.5,\"q25\":229.3,\"q50\":235.5,\"q75\":242.2,\"q975\":255.1,\"time\":41.0},{\"q025\":217.6,\"q25\":230.0,\"q50\":236.1,\"q75\":242.9,\"q975\":255.7,\"time\":42.0},{\"q025\":217.3,\"q25\":230.1,\"q50\":236.1,\"q75\":242.9,\"q975\":255.9,\"time\":43.0},{\"q025\":216.9,\"q25\":229.6,\"q50\":235.9,\"q75\":242.5,\"q975\":255.3,\"time\":44.0},{\"q025\":215.6,\"q25\":228.8,\"q50\":235.0,\"q75\":241.7,\"q975\":254.9,\"time\":45.0},{\"q025\":214.6,\"q25\":227.7,\"q50\":234.3,\"q75\":241.0,\"q975\":254.6,\"time\":46.0},{\"q025\":213.4,\"q25\":226.7,\"q50\":233.6,\"q75\":240.3,\"q975\":254.0,\"time\":47.0},{\"q025\":212.6,\"q25\":226.3,\"q50\":233.3,\"q75\":240.2,\"q975\":254.1,\"time\":48.0},{\"q025\":212.9,\"q25\":226.4,\"q50\":233.3,\"q75\":240.7,\"q975\":254.9,\"time\":49.0},{\"q025\":214.6,\"q25\":227.3,\"q50\":234.5,\"q75\":241.8,\"q975\":256.1,\"time\":50.0},{\"q025\":216.5,\"q25\":229.1,\"q50\":236.3,\"q75\":243.1,\"q975\":257.3,\"time\":51.0},{\"q025\":218.8,\"q25\":231.7,\"q50\":238.3,\"q75\":245.5,\"q975\":259.9,\"time\":52.0},{\"q025\":220.2,\"q25\":233.8,\"q50\":240.9,\"q75\":248.6,\"q975\":264.6,\"time\":53.0},{\"q025\":221.0,\"q25\":235.7,\"q50\":243.5,\"q75\":252.3,\"q975\":270.4,\"time\":54.0},{\"q025\":219.8,\"q25\":237.7,\"q50\":246.6,\"q75\":257.0,\"q975\":279.0,\"time\":55.0},{\"q025\":217.0,\"q25\":238.5,\"q50\":249.8,\"q75\":262.6,\"q975\":290.6,\"time\":56.0}]},\"encoding\":{\"tooltip\":[{\"field\":\"time\",\"title\":\"Day\",\"type\":\"quantitative\"},{\"field\":\"q50\",\"title\":\"median\",\"type\":\"quantitative\"},{\"field\":\"q025\",\"title\":\"q025\",\"type\":\"quantitative\"},{\"field\":\"q975\",\"title\":\"q975\",\"type\":\"quantitative\"}],\"x\":{\"field\":\"time\",\"scale\":{\"zero\":false},\"title\":\"Day\",\"type\":\"quantitative\"},\"y\":{\"field\":\"q50\",\"scale\":{\"zero\":false},\"title\":\"Expected reports per day\",\"type\":\"quantitative\"}},\"mark\":{\"color\":\"#2a78d6\",\"strokeWidth\":2,\"type\":\"line\"}},{\"data\":{\"values\":[{\"observed\":40.0,\"time\":1.0},{\"observed\":49.0,\"time\":2.0},{\"observed\":29.0,\"time\":3.0},{\"observed\":33.0,\"time\":4.0},{\"observed\":53.0,\"time\":5.0},{\"observed\":75.0,\"time\":6.0},{\"observed\":53.0,\"time\":7.0},{\"observed\":64.0,\"time\":8.0},{\"observed\":78.0,\"time\":9.0},{\"observed\":68.0,\"time\":10.0},{\"observed\":69.0,\"time\":11.0},{\"observed\":70.0,\"time\":12.0},{\"observed\":70.0,\"time\":13.0},{\"observed\":80.0,\"time\":14.0},{\"observed\":86.0,\"time\":15.0},{\"observed\":86.0,\"time\":16.0},{\"observed\":83.0,\"time\":17.0},{\"observed\":83.0,\"time\":18.0},{\"observed\":118.0,\"time\":19.0},{\"observed\":119.0,\"time\":20.0},{\"observed\":116.0,\"time\":21.0},{\"observed\":110.0,\"time\":22.0},{\"observed\":109.0,\"time\":23.0},{\"observed\":120.0,\"time\":24.0},{\"observed\":128.0,\"time\":25.0},{\"observed\":161.0,\"time\":26.0},{\"observed\":151.0,\"time\":27.0},{\"observed\":127.0,\"time\":28.0},{\"observed\":161.0,\"time\":29.0},{\"observed\":186.0,\"time\":30.0},{\"observed\":202.0,\"time\":31.0},{\"observed\":214.0,\"time\":32.0},{\"observed\":223.0,\"time\":33.0},{\"observed\":240.0,\"time\":34.0},{\"observed\":203.0,\"time\":35.0},{\"observed\":194.0,\"time\":36.0},{\"observed\":180.0,\"time\":37.0},{\"observed\":296.0,\"time\":38.0},{\"observed\":219.0,\"time\":39.0},{\"observed\":257.0,\"time\":40.0},{\"observed\":210.0,\"time\":41.0},{\"observed\":270.0,\"time\":42.0},{\"observed\":241.0,\"time\":43.0},{\"observed\":247.0,\"time\":44.0},{\"observed\":219.0,\"time\":45.0},{\"observed\":287.0,\"time\":46.0},{\"observed\":197.0,\"time\":47.0},{\"observed\":198.0,\"time\":48.0},{\"observed\":194.0,\"time\":49.0},{\"observed\":171.0,\"time\":50.0},{\"observed\":270.0,\"time\":51.0},{\"observed\":255.0,\"time\":52.0},{\"observed\":274.0,\"time\":53.0},{\"observed\":223.0,\"time\":54.0},{\"observed\":247.0,\"time\":55.0},{\"observed\":266.0,\"time\":56.0}]},\"encoding\":{\"tooltip\":[{\"field\":\"time\",\"type\":\"quantitative\"},{\"field\":\"observed\",\"type\":\"quantitative\"}],\"x\":{\"field\":\"time\",\"scale\":{\"zero\":false},\"title\":\"Day\",\"type\":\"quantitative\"},\"y\":{\"field\":\"observed\",\"scale\":{\"zero\":false},\"title\":\"Expected reports per day\",\"type\":\"quantitative\"}},\"mark\":{\"color\":\"#eb6834\",\"filled\":true,\"size\":24.5,\"type\":\"point\"}}],\"width\":640,\"description\":\"Expected daily reports: posterior median with 50 % and 95 % credible bands in blue; observed counts in orange.\"}","caption":"Expected daily reports: posterior median with 50 % and 95 % credible bands in blue; observed counts in orange.","alt":"Expected daily reports: posterior median with 50 % and 95 % credible bands in blue; observed counts in orange."}The bands describe the expected reporting intensity Y in the declaration. They exclude negative-binomial observation noise, so there is no requirement that 95 % of the orange counts lie within the outer band. The separate ppc.tsv table contains predictive intervals that include this noise. Reporting delays spread the effect of a change in transmission over later days; the plot should be read as a trajectory of reports, not of infection onset. The random-walk prior regularizes changes that the delayed counts cannot identify individually.
Reproduce
Commands and fit receipt
The repository's test environment supplies the pinned BRM, StanBlocks, BridgeStan, WarmupHMC and TreeArrays dependencies. These shell commands are manual: the docs build executes the model declarations and figures but reads the completed fit's summaries. Run the fit deliberately when its model, data or settings change; routine documentation edits reuse the cache.
julia --startup-file=no --project=test test/setup_env.jl
julia -t 4 --startup-file=no --project=test research/epi_renewal/fit.jlThe script writes its receipt before sampling and saves the draws outside the repository. Its key includes the emitted program, data, settings, seed and sampling harness. TreeArrays reduces the named chain and draw axes to small summary tables. A second invocation with the same key rebuilds those tables from the saved draws. The receipt identifies the program behind these numbers.
On a fresh checkout the draws may be absent. An existing receipt guards against repeating a recent fit; set BRM_DOCS_FIT_FORCE=1 for a deliberate rerun. BRM_DOCS_CACHE selects a persistent draw-cache directory; its default is under the system temporary directory. Only the small summary tables belong in git.
| field | value |
|---|---|
| commit | d278222e2babaf9c64a3c1ed8ead78dcf57c27b2 |
| uncommitted_changes | yes |
| started | 2026-11-11 01:14 local time |
| host | a Linux fleet host, 4 Julia threads |
| julia | 1.10.12 |
| BayesianRegressionModels | 0.2.270 |
| sampler | WarmupHMC completion_warmup_mcmc over BridgeStan; model already uses explicit innovations |
| chains | 4 per fit, quorum 3, 1000 draws each |
| model | renewal |
| sources | research/epi_renewal/renewal.jl; simulate_single(seed=132); 56 days |
| seed | 20261112 |
| content_sha256 | de6339b051af47e9dfb6a2369e0bd78468aab41d35dea9f5a6bf7671b55ad61c |
| harness_sha256 | d3052cea6c5a6ef32afd4bd2d206779996c59789b9e94c95cd6e0fa03e835a15 |
| settings | (1000, 4, nothing, Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, @NamedTuple{target_acceptance_rate::Float64, adaptive_centering::Bool}}(:target_acceptance_rate => 0.99, :adaptive_centering => false)) |
| WarmupHMC | 0.2.11 |
| StanBlocks | 0.2.31 |
| TreeArrays | 0.2.0 |
| BridgeStan | 2.9.0 |
| seconds | 147.820258601 |
| divergent | 0 |
| omitted_chains | 2 |
| dimension | 59 |
| status | complete |
| completed | 2026-11-11T02:25:49 |
| summary | TreeArrays quantiles pooled over chain and draw; split R-hat, bulk and tail ESS |