You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a hospital and ED model, the IEDR can be the base rate and the ratio can represent IHR / IEDR.
@@ -203,7 +190,7 @@ The priors are assigned to the base rate and the ratio, and together they induce
203
190
204
191
The ratio may be any positive value.
205
192
Unlike `JointAscertainment`, this component does not automatically constrain the derived linked rate to the unit interval.
206
-
If both rates should be $<1$ (for instance because both are probabilities), make sure to choose priors that make $\alpha_{\mathrm{base}}\rho > 1$ negligibly likely.
193
+
If both rates should be $<1$ (for instance because both are probabilities), make sure to choose priors that make $\alpha_{\mathrm{base}}\rho > 1$ negligibly likely.
207
194
The component does not clip an invalid linked rate, because clipping would change the specified statistical model.
Copy file name to clipboardExpand all lines: docs/tutorials/day_of_week_effects.qmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Ignoring this weekly periodicity forces the noise model to absorb systematic var
50
50
PyRenew models day-of-week effects as a **multiplicative adjustment** applied to predicted counts after the delay convolution and ascertainment scaling:
where $d_{w(t)}$ is the day-of-week multiplier for the weekday of timepoint $t$, $\alpha$ is the ascertainment rate, and $\pi(s)$ is the delay PMF.
@@ -335,7 +335,7 @@ Day-of-week effects and right-truncation are independent adjustments that compos
335
335
Day-of-week is applied first (adjusting the expected counts for reporting patterns), then right-truncation scales down recent counts for incomplete reporting:
where $r$ is the asymptotic growth rate implied by the reproduction number at the start of the observation period, $\mathcal{R}(t=0) = e^{\text{log\_rt\_time\_0}}$, and the generation interval.
164
-
The function `r_approx_from_R` converts $\mathcal{R}(t=0)$ and the generation interval into $r$ using Newton's method.
163
+
where $r$ is the asymptotic growth rate implied by the reproduction number at the start of the observation period, $\mathcal{R}(t = 0) = e^{\text{log\_rt\_time\_0}}$, and the generation interval.
164
+
The function `r_approx_from_R` converts $\mathcal{R}(t = 0)$ and the generation interval into $r$ using Newton's method.
165
165
166
166
-**The level is set by `I0`**.</br> `I0` is the infection prevalence at the earliest point in the initialization period, $n_{\text{init}} - 1$ time points before $t = 0$.
167
167
It sets the scale of the entire initialization vector: $I_{\text{init}}(0) = I_0$, with subsequent entries growing or declining exponentially toward $t = 0$.
168
168
169
-
-**The shape is set by `log_rt_time_0`**.<br> `log_rt_time_0` enters the model in two places: it is the starting point of the $\mathcal{R}(t)$ trajectory ($\mathcal{R}(t=0) = e^{\text{log\_rt\_time\_0}}$), and it determines the exponential growth rate $r$ used to construct the initialization vector.
169
+
-**The shape is set by `log_rt_time_0`**.<br> `log_rt_time_0` enters the model in two places: it is the starting point of the $\mathcal{R}(t)$ trajectory ($\mathcal{R}(t = 0) = e^{\text{log\_rt\_time\_0}}$), and it determines the exponential growth rate $r$ used to construct the initialization vector.
170
170
When `log_rt_time_0 = 0`, $r = 0$ and the initialization vector is flat at level `I0`.
171
171
When `log_rt_time_0 > 0`, infections are growing exponentially at $t = 0$; when `log_rt_time_0 < 0`, they are declining.
The initialization vector matters because the renewal equation is a convolution: infections on day 0 depend on infections from days $-1$ through $-(K-1)$, weighted by the generation interval.
235
+
The initialization vector matters because the renewal equation is a convolution: infections on day 0 depend on infections from days $-1$ through $-(K - 1)$, weighted by the generation interval.
236
236
A flat initialization (stable) means the renewal equation starts with uniform recent history.
237
237
A growing initialization means the most recent days have disproportionately more infections, which amplifies the effect of the generation interval's short-lag weights.
238
238
@@ -362,7 +362,7 @@ The variance of $x_t$ grows linearly with time: $\text{Var}(x_t) = \sigma^2 t$.
362
362
The further into the future, the less constrained the process is.
363
363
364
364
**Hyperparameter:**`innovation_sd` ($\sigma$) is the standard deviation of each daily step on the log scale.
365
-
With `innovation_sd = 0.05`, each day's $\log \mathcal{R}$ changes by roughly $\pm 0.05$, which corresponds to roughly $\pm 5\%$ multiplicative change in $\mathcal{R}$.
365
+
With `innovation_sd = 0.05`, each day's $\log \mathcal{R}$ changes by roughly $\pm0.05$, which corresponds to roughly $\pm5\%$ multiplicative change in $\mathcal{R}$.
366
366
367
367
```{python}
368
368
#| label: rw-sample
@@ -408,7 +408,7 @@ If $\mathcal{R}(t)$ drifts above 1, the $\phi$ coefficient pulls it back; if it
408
408
-`innovation_sd` ($\sigma$): standard deviation of daily noise.
409
409
410
410
The two hyperparameters jointly determine the **stationary standard deviation** $\sigma_{\text{stat}} = \sigma / \sqrt{1 - \phi^2}$, which is the long-run spread of $\log \mathcal{R}(t)$.
411
-
For example, `autoreg = 0.9` and `innovation_sd = 0.05` give $\sigma_{\text{stat}} \approx 0.115$, meaning 95% of long-run $\log \mathcal{R}$ values fall within $\pm 0.23$ of zero, or equivalently $\mathcal{R} \in [0.79, 1.26]$.
411
+
For example, `autoreg = 0.9` and `innovation_sd = 0.05` give $\sigma_{\text{stat}} \approx 0.115$, meaning 95% of long-run $\log \mathcal{R}$ values fall within $\pm0.23$ of zero, or equivalently $\mathcal{R} \in [0.79, 1.26]$.
412
412
413
413
```{python}
414
414
#| label: ar1-sample
@@ -441,7 +441,8 @@ DifferencedAR1 models *changes* in $\mathcal{R}(t)$ as an autoregressive process
Copy file name to clipboardExpand all lines: docs/tutorials/observation_processes_counts.qmd
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -59,12 +59,12 @@ Observed data can be aggregated or available as subpopulation-level counts, whic
59
59
The deterministic transformation is given by the observation equation:
60
60
61
61
$$
62
-
\mu(t) = \alpha \sum_{d=0}^{D} I(t-d)\, \pi_d
62
+
\mu(t) = \alpha \sum_{d=0}^{D} I(t - d)\, \pi_d
63
63
$$
64
64
65
65
where:
66
66
67
-
- $I(t-d)$ is the number of incident (new) infections on day $t-d$
67
+
- $I(t - d)$ is the number of incident (new) infections on day $t - d$
68
68
- $\alpha$ is the **ascertainment rate**, the probability that an infection results in an observed event (e.g., hospitalization)
69
69
- $\pi_d$ is the delay distribution from infection to observation, conditional on an infection leading to an observed event
70
70
@@ -103,7 +103,7 @@ In this tutorial, we simulate the observation process by specifying infections d
103
103
104
104
For hospital admissions data, we construct a `PopulationCounts` observation process.
105
105
106
-
The delay is the key mechanism: infections from $d$ days ago ($I(t-d)$) contribute to today's predicted hospital admissions ($\mu(t)$), weighted by the probability $\pi_d$ that an infection leads to hospitalization after exactly $d$ days.
106
+
The delay is the key mechanism: infections from $d$ days ago ($I(t - d)$) contribute to today's predicted hospital admissions ($\mu(t)$), weighted by the probability $\pi_d$ that an infection leads to hospitalization after exactly $d$ days.
107
107
The convolution sums these contributions across all past days.
108
108
109
109
Observed hospital admissions are then generated by sampling from a negative binomial distribution:
The observation process convolves infections with a delay distribution, maintaining alignment between input and output: day $t$ in the output corresponds to day $t$ in the input.
224
224
225
225
Hospital admissions depend on infections from prior days.
226
-
A delay PMF of length $L$ covers delays 0 to $L-1$, requiring $L-1$ days of prior infection history.
227
-
The method `lookback_days()` returns $L-1$; the first valid observation day is at index `lookback_days()`.
226
+
A delay PMF of length $L$ covers delays 0 to $L - 1$, requiring $L - 1$ days of prior infection history.
227
+
The method `lookback_days()` returns $L - 1$; the first valid observation day is at index `lookback_days()`.
- $I(t-d)$ is the number of infections on day $t-d$
206
+
- $I(t - d)$ is the number of infections on day $t - d$
207
207
- $\pi_d$ is the shedding kinetics PMF, giving the fraction of total shedding occurring $d$ days after infection, analogous to the delay distribution in count observation models
208
208
- $G$ is the number of genome copies shed per infection
209
209
- $V$ is the wastewater volume per person per day
@@ -213,7 +213,8 @@ This has the same convolution structure as the observation equation for count da
Because $k_t$ depends only on the data pull date and the timepoint $t$, its behavior is straightforward: timepoints far in the past (small $t$) have large $k_t$, so $F(k_t) \approx 1$ and counts are fully reported.
0 commit comments