.generate_delay_data | R Documentation |
This utility can be used to build toy examples to test functions dealing with empirical delay data.
It is very basic in what it simulates.
A random walk is simulated over n_time_steps
, representing the incidence through time.
The result of this simulation is offset so that all values are positive.
Then, for each time step, n
samples from a delay distribution are taken,
with n
being the incidence value at this time step.
The random draws are then multiplied by a factor (>1 or <1) to simulate
a gradual shift in the delay distribution through time.
This multiplication factor is calculated
by linearly interpolating between 1 (at the first time step),
and delay_ratio_start_to_end
linearly,
from 1 at the first time step to ratio_delay_end_to_start
at the last time step.
.generate_delay_data(
origin_date = as.Date("2020-02-01"),
n_time_steps = 100,
time_step = "day",
ratio_delay_end_to_start = 2,
distribution_initial_delay = list(name = "gamma", shape = 6, scale = 5),
seed = NULL
)
origin_date |
Date of first infection. |
n_time_steps |
interger. Number of time steps to generate delays over |
time_step |
string. Time between two consecutive incidence datapoints.
"day", "2 days", "week", "year"... (see |
ratio_delay_end_to_start |
numeric value. Shift in delay distribution from start to end. |
distribution_initial_delay |
Distribution in list format. |
seed |
integer. Optional RNG seed. |
dataframe. Simulated delay data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.