epinowcast
Loading...
Searching...
No Matches
delay_multinomial_lpmf.stan File Reference

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)
 

Function Documentation

◆ delay_multinomial_lpmf()

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.

Parameters
obsObserved cell counts (one per observed delay).
log_exp_obsLog expected cells, log(total) + log(p_d).
Returns
Log probability mass under the (truncated) multinomial.

Definition at line 14 of file delay_multinomial_lpmf.stan.

◆ delay_multinomial_snaps()

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.

Parameters
startFirst snapshot in the range.
endLast snapshot in the range.
obsFlat observed cell counts.
log_exp_obsGap-filled log expected cells over the cutoff range.
exp_offsetFlat index of the first cutoff cell of the range.
totalKnown integer total by snapshot (the cutoff running total).
obs_lookupMaps each observed cell to its cutoff-block position.
lslCutoff slots per snapshot (max consecutive observed + 1).
clslCumulative lsl.
nslObserved cells per snapshot.
cnslCumulative nsl.
Returns
Summed log probability mass over the snapshots.

Definition at line 44 of file delay_multinomial_lpmf.stan.