EpiNow2 Stan Functions
Delay Handlers

Functions for delay distribution handling. More...

Collaboration diagram for Delay Handlers:

Functions

array[] int get_delay_type_max (int delay_types, array[] int delay_types_p, array[] int delay_types_id, array[] int delay_types_groups, array[] int delay_max, array[] int delay_np_pmf_groups)
 
vector get_delay_rev_pmf (int delay_id, int len, array[] int delay_types_p, array[] int delay_types_id, array[] int delay_types_groups, array[] int delay_max, vector delay_np_pmf, array[] int delay_np_pmf_groups, vector delay_params, array[] int delay_params_groups, array[] int delay_dist, int left_truncate, int reverse_pmf, int cumulative)
 
void delays_lp (vector delay_params, vector delay_params_mean, vector delay_params_sd, array[] int delay_params_groups, array[] int delay_dist, array[] int weight)
 
vector normal_lb_rng (vector mu, vector sigma, vector lb)
 

Description

Functions for delay distribution handling.

Functions from delays.stan for creating, parameterizing and applying delay distributions.

Function Documentation

◆ delays_lp()

void delays_lp ( vector delay_params,
vector delay_params_mean,
vector delay_params_sd,
array[]int delay_params_groups,
array[]int delay_dist,
array[]int weight )

Update log density for delay distribution priors

Parameters
delay_paramsVector of parameters for parametric delay distributions
delay_params_meanVector of prior means for delay parameters
delay_params_sdVector of prior standard deviations for delay parameters
delay_params_groupsArray of indices for accessing delay parameters
delay_distArray of distribution types (0: lognormal, 1: gamma)
weightArray of weights for each delay distribution in the log density

Definition at line 135 of file delays.stan.

◆ get_delay_rev_pmf()

vector get_delay_rev_pmf ( int delay_id,
int len,
array[]int delay_types_p,
array[]int delay_types_id,
array[]int delay_types_groups,
array[]int delay_max,
vector delay_np_pmf,
array[]int delay_np_pmf_groups,
vector delay_params,
array[]int delay_params_groups,
array[]int delay_dist,
int left_truncate,
int reverse_pmf,
int cumulative )

Get the reversed probability mass function for a delay

Parameters
delay_idIdentifier for the specific delay distribution
lenLength of the output PMF
delay_types_pArray indicating whether each delay is parametric (1) or non-parametric (0)
delay_types_idArray mapping delay types to their respective IDs
delay_types_groupsArray of indices defining groups of delay types
delay_maxArray of maximum delays for parametric distributions
delay_np_pmfVector of probability mass functions for non-parametric delays
delay_np_pmf_groupsArray of indices for accessing non-parametric PMFs
delay_paramsVector of parameters for parametric delay distributions
delay_params_groupsArray of indices for accessing delay parameters
delay_distArray of distribution types (0: lognormal, 1: gamma)
left_truncateWhether to left-truncate the PMF (1) or not (0)
reverse_pmfWhether to reverse the PMF (1) or not (0)
cumulativeWhether to return cumulative (1) or daily (0) values
Returns
A vector containing the (reversed) PMF of length len

Definition at line 64 of file delays.stan.

References convolve_with_rev_pmf(), and discretised_pmf().

Here is the call graph for this function:

◆ get_delay_type_max()

array[] int get_delay_type_max ( int delay_types,
array[]int delay_types_p,
array[]int delay_types_id,
array[]int delay_types_groups,
array[]int delay_max,
array[]int delay_np_pmf_groups )

Delay Distribution Functions

This group of functions handles the creation, manipulation, and application of delay distributions in the model. Delay distributions represent the time between events (e.g., infection to symptom onset, symptom onset to reporting). Get the maximum delay for each delay type

Parameters
delay_typesNumber of delay types
delay_types_pArray indicating whether each delay is parametric (1) or non-parametric (0)
delay_types_idArray mapping delay types to their respective IDs
delay_types_groupsArray of indices defining groups of delay types
delay_maxArray of maximum delays for parametric distributions
delay_np_pmf_groupsArray of indices for accessing non-parametric PMFs
Returns
An array of maximum delays for each delay type

Definition at line 23 of file delays.stan.

◆ normal_lb_rng()

vector normal_lb_rng ( vector mu,
vector sigma,
vector lb )

Generate random samples from a normal distribution with lower bounds

Parameters
muVector of means
sigmaVector of standard deviations
lbVector of lower bounds
Returns
A vector of random samples from the truncated normal distribution

Definition at line 171 of file delays.stan.