|
epinowcast
|
Go to the source code of this file.
Functions | |
| real | delay_multinomial_lpmf (array[] int obs, vector log_exp_obs) |
| real | delay_multinomial_snaps (int start, int end, array[] int obs, vector log_exp_obs, int exp_offset, array[] int total, array[] int obs_lookup, array[] int lsl, array[] int clsl, array[] int nsl, array[] int cnsl) |
| real delay_multinomial_lpmf | ( | array[]int | obs, |
| vector | log_exp_obs ) |
(Truncated) multinomial delay-only likelihood for one snapshot
Conditional log probability of a reference date's observed delay cells given their total. Renormalising the delay intensities over the observed cells gives the plain multinomial when the row is complete and the truncated multinomial when only early delays are observed. The shared log(total) offset cancels, so the total enters only through the cells.
| obs | Observed cell counts (one per observed delay). |
| log_exp_obs | Log expected cells, log(total) + log(p_d). |
Definition at line 14 of file delay_multinomial_lpmf.stan.
| real delay_multinomial_snaps | ( | int | start, |
| int | end, | ||
| array[]int | obs, | ||
| vector | log_exp_obs, | ||
| int | exp_offset, | ||
| array[]int | total, | ||
| array[]int | obs_lookup, | ||
| array[]int | lsl, | ||
| array[]int | clsl, | ||
| array[]int | nsl, | ||
| array[]int | cnsl ) |
Delay-only multinomial likelihood over a range of snapshots
Sums a (truncated) multinomial over each snapshot, conditioning on the known total. The delay probabilities are renormalised over every slot up to the observation cutoff (lsl), so interior cells that are unobserved but before the cutoff keep their weight; only right-truncated slots beyond the cutoff are excluded. With an observation indicator the unobserved before-cutoff cells are marginalised into a single residual category whose count is the known total minus the observed counts, leaving the observed cells plus that residual as the multinomial categories.
| start | First snapshot in the range. |
| end | Last snapshot in the range. |
| obs | Flat observed cell counts. |
| log_exp_obs | Gap-filled log expected cells over the cutoff range. |
| exp_offset | Flat index of the first cutoff cell of the range. |
| total | Known integer total by snapshot (the cutoff running total). |
| obs_lookup | Maps each observed cell to its cutoff-block position. |
| lsl | Cutoff slots per snapshot (max consecutive observed + 1). |
| clsl | Cumulative lsl. |
| nsl | Observed cells per snapshot. |
| cnsl | Cumulative nsl. |
Definition at line 44 of file delay_multinomial_lpmf.stan.