|
epinowcast
|
Go to the source code of this file.
Functions | |
| vector | extract_group_rates (vector r, array[] int r_g, int k, int r_t) |
| array[] vector | log_expected_latent_from_r (matrix lexp_latent_int, vector r, array[] int r_g, int r_t, int r_seed, int gt_n, vector lrgt, int t, int g, vector pop, int use_pop, real pop_floor) |
| vector extract_group_rates | ( | vector | r, |
| array[]int | r_g, | ||
| int | k, | ||
| int | r_t ) |
Extract log growth rates for a specific group
| r | Vector of all group growth rates concatenated. |
| r_g | Array of indices marking the start of each group in r. |
| k | Group index (1-indexed). |
| r_t | Number of time periods. |
Definition at line 11 of file log_expected_latent_from_r.stan.
| array[] vector log_expected_latent_from_r | ( | matrix | lexp_latent_int, |
| vector | r, | ||
| array[]int | r_g, | ||
| int | r_t, | ||
| int | r_seed, | ||
| int | gt_n, | ||
| vector | lrgt, | ||
| int | t, | ||
| int | g, | ||
| vector | pop, | ||
| int | use_pop, | ||
| real | pop_floor ) |
Iteratively compute expected latent values using the renewal equation
This function calculates expected latent values over time for different groups using the renewal equation. It's designed to handle scenarios where the generation time is represented either as a constant (leading to exponential growth) or as a vector (requiring a dot product calculation). The function operates on the natural scale for stability and then transforms the results back to the log scale when the generation time is a vector.
| lexp_latent_int | Matrix of initial log expected latent values. |
| r | Vector representing growth rate or the log of the effective reproduction number. |
| r_g | Array of indices marking the start of each group in the rate vector. |
| r_t | Number of time periods for rate adjustments. |
| r_seed | Seed time period for rate-based adjustments. |
| gt_n | Length of the generation time vector (1 for constant generation time). |
| lrgt | Log of the generation time vector or scalar. |
| t | Total number of time periods. |
| g | Number of groups. |
| pop | Initial susceptible population per group. Ignored when use_pop == 0. |
| use_pop | Susceptible-depletion switch (0 = off, 1 = on). When on, transmission is scaled by the remaining susceptible fraction over the whole post-seed series. |
| pop_floor | Minimum susceptible population, floored on the transmission-rate denominator only. Matches EpiNow2's rt_opts(pop_floor). Only used when use_pop > 0. |
gt_n == 1 exponential growth is computed as a cumulative sum on the log scale; when gt_n > 1 the renewal equation is applied on the natural scale (more stable) and logged afterwards.When use_pop > 0, new cases are capped by the remaining susceptibles (fmax(0, pop - cum_cases)) so depletion cannot exceed the pool, and a small 1e-8 floor keeps the subsequent log() finite near exhaustion. Groups are independent well-mixed populations with no waning or vital dynamics. Adapted from EpiNow2's generate_infections() (epiforecasts/EpiNow2, MIT licence).
Definition at line 70 of file log_expected_latent_from_r.stan.