EpiNow2 Stan Functions
Infections Estimation

Functions for estimating infection trajectories. More...

Collaboration diagram for Infections Estimation:

Subgroups

 Estimates Smoothing
 Functions for smoothing estimates using Gaussian processes.
 
 Observation Model
 Functions for modeling the observation process.
 

Functions

real update_infectiousness (vector infections, vector gt_rev_pmf, int seeding_time, int index)
 
vector generate_infections (vector R, int uot, vector gt_rev_pmf, array[] real initial_infections, int pop, int ht, int obs_scale, real frac_obs, int initial_as_scale)
 Generate infections using a renewal equation approach.
 
vector deconvolve_infections (vector shifted_cases, vector noise, int fixed, int prior)
 

Description

Functions for estimating infection trajectories.

This group contains functions for estimating and modeling infection dynamics, including implementation of the renewal equation and backcalculation approaches. Core infection estimation functions from infections.stan and related generated quantities functions.

Function Documentation

◆ deconvolve_infections()

vector deconvolve_infections ( vector shifted_cases,
vector noise,
int fixed,
int prior )

Backcalculate infections from cases

This function estimates infections by working backwards from observed cases, applying noise to account for uncertainty in the process.

Parameters
shifted_casesVector of shifted case counts
noiseVector of noise values
fixedWhether to use fixed (1) or variable (0) noise
priorPrior type to use (0: noise only, 1: cases * noise, 2: random walk)
Returns
A vector of infection counts

Definition at line 125 of file infections.stan.

◆ generate_infections()

vector generate_infections ( vector R,
int uot,
vector gt_rev_pmf,
array[]real initial_infections,
int pop,
int ht,
int obs_scale,
real frac_obs,
int initial_as_scale )

Generate infections using a renewal equation approach.

This function implements the renewal equation to generate a time series of infections based on reproduction numbers and the generation time distribution. It can also account for population depletion if a population size is specified.

Parameters
RVector of reproduction numbers
uotUnobserved time (seeding time)
gt_rev_pmfVector of reversed generation time PMF
initial_infectionsArray of initial infection values
popInitial susceptible population (0 for unlimited)
htHorizon time
obs_scaleWhether to scale by fraction observed (1) or not (0)
frac_obsFraction of infections that are observed
initial_as_scaleWhether initial infections are a scaling factor (1) or not (0)
Returns
A vector of infection counts

Definition at line 63 of file infections.stan.

References R_to_r(), and update_infectiousness().

Here is the call graph for this function:

◆ update_infectiousness()

real update_infectiousness ( vector infections,
vector gt_rev_pmf,
int seeding_time,
int index )

Infection Modeling Functions

This group of functions handles the generation, calculation, and backcalculation of infection time series in the model. These functions implement the core epidemiological dynamics, including the renewal equation approach. Calculate infectiousness for a single time point

This function computes the weighted sum of past infections with the generation time distribution to determine the current infectiousness.

Parameters
infectionsVector of infection counts
gt_rev_pmfVector of reversed generation time PMF
seeding_timeNumber of time steps used for seeding
indexCurrent time index (relative to seeding_time)
Returns
The infectiousness at the specified time point

Definition at line 25 of file infections.stan.

Referenced by calculate_Rt(), and generate_infections().

Here is the caller graph for this function: