EpiNow2 Stan Functions
Convolution Functions

Functions for convolving time series. More...

Collaboration diagram for Convolution Functions:

Functions

array[] int calc_conv_indices_xlen (int s, int xlen, int ylen)
 
array[] int calc_conv_indices_len (int s, int xlen, int ylen)
 
vector convolve_with_rev_pmf (vector x, vector y, int len)
 
vector convolve_to_report (vector infections, vector delay_rev_pmf, int seeding_time)
 

Description

Functions for convolving time series.

Functions from convolve.stan for implementing convolutions between infections and delay distributions.

Function Documentation

◆ calc_conv_indices_len()

array[] int calc_conv_indices_len ( int s,
int xlen,
int ylen )

Calculate convolution indices for the case where s > xlen

Parameters
sCurrent position in the output vector
xlenLength of the x vector
ylenLength of the y vector
Returns
An array of integers: {start_x, end_x, start_y, end_y}

Definition at line 39 of file convolve.stan.

Referenced by convolve_with_rev_pmf().

Here is the caller graph for this function:

◆ calc_conv_indices_xlen()

array[] int calc_conv_indices_xlen ( int s,
int xlen,
int ylen )

convolution_functions Functions

This file contains functions for performing discrete convolutions, which are used throughout the model to combine time series with delay distributions. Calculate convolution indices for the case where s <= xlen

Parameters
sCurrent position in the output vector
xlenLength of the x vector
ylenLength of the y vector
Returns
An array of integers: {start_x, end_x, start_y, end_y}

Definition at line 20 of file convolve.stan.

Referenced by convolve_with_rev_pmf().

Here is the caller graph for this function:

◆ convolve_to_report()

vector convolve_to_report ( vector infections,
vector delay_rev_pmf,
int seeding_time )

Convolve infections to reported cases.

This function convolves a vector of infections with a reversed delay distribution to produce a vector of reported cases.

Parameters
infectionsA vector of infection counts.
delay_rev_pmfA vector representing the reversed probability mass function of the delay distribution.
seeding_timeThe number of initial time steps to exclude from the output.
Returns
A vector of reported cases, starting from seeding_time + 1.

Definition at line 105 of file convolve.stan.

References convolve_with_rev_pmf().

Here is the call graph for this function:

◆ convolve_with_rev_pmf()

vector convolve_with_rev_pmf ( vector x,
vector y,
int len )

Convolve a vector with a reversed probability mass function.

This function performs a discrete convolution of two vectors, where the second vector is assumed to be an already reversed probability mass function.

Parameters
xThe input vector to be convolved.
yThe already reversed probability mass function vector.
lenThe desired length of the output vector.
Returns
A vector of length len containing the convolution result.
Exceptions
Iflen is not of equal length to the sum of the lengths of x and y.

Definition at line 62 of file convolve.stan.

References calc_conv_indices_len(), and calc_conv_indices_xlen().

Referenced by convolve_to_report(), and get_delay_rev_pmf().

Here is the call graph for this function:
Here is the caller graph for this function: