![]() |
EpiNow2 Stan Functions
|
Functions for convolving time series. More...

Functions | |
| vector | convolve_with_rev_pmf (vector x, vector y, int len) |
| vector | convolve_to_report (vector infections, vector delay_rev_pmf, int seeding_time) |
Functions for convolving time series.
Functions from convolve.stan for implementing convolutions between infections and delay distributions.
| 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.
| infections | A vector of infection counts. |
| delay_rev_pmf | A vector representing the reversed probability mass function of the delay distribution. |
| seeding_time | The number of initial time steps to exclude from the output. |
seeding_time + 1.convolve_to_report({10, 20, 30, 40, 50}, {0.2, 0.8}, 1) convolves the infections with the reversed delay {0.2, 0.8} and drops the first (seeding_time = 1) entry, returning {18, 28, 38, 48}. Definition at line 54 of file convolve.stan.
References convolve_with_rev_pmf().

| vector convolve_with_rev_pmf | ( | vector | x, |
| vector | y, | ||
| int | len ) |
convolution_functions Functions
This file contains functions for performing discrete convolutions, which are used throughout the model to combine time series with delay distributions. 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. It is implemented in C++, with a hand-written gradient, in inst/include/epinow2/convolve_with_rev_pmf.hpp, which gives the maths.
| x | The input vector to be convolved. |
| y | The already reversed probability mass function vector. |
| len | The desired length of the output vector. |
len containing the convolution result. | If | len is longer than the full convolution (n + D - 1) or shorter than x. |
convolve_with_rev_pmf({1, 2, 3, 4}, {0.5, 0.5}, 5) convolves x with a reversed two-day uniform delay, returning {0.5, 1.5, 2.5, 3.5, 2.0}. Referenced by convolve_to_report(), and get_delay_rev_pmf().
