simulate_delayed_observations | R Documentation |
Simulate a series of delayed observations from a series of infections.
simulate_delayed_observations(
infections,
delay,
noise = list(type = "noiseless")
)
infections |
Positive integer vector. Course of infections through time. |
delay |
Single delay or list of delays. Each delay can be one of:
|
noise |
List specifying the type of noise and its parameters, if applicable. |
Integer vector. Simulated delayed observations.
## Basic usage of simulate_delayed_observations
# Simulating a series of delayed observations of infections generated by an
# infection with a Re of 1.2. The delays of the observations follow a normal
# distribution.
set.seed(7)
infections <- simulate_infections(rep(1.5, 100))
delay <- list(name="norm", mean = 7, sd = 2)
delayed_observations_1 <- simulate_delayed_observations(
infections,
delay = delay
)
## Advanced usage of simulate_delayed_observations
# Simulating delayed observations using the same infections as above, but assuming
# the observation is delayed by a convolution of two different delays
shape_incubation = 3.2
scale_incubation = 1.3
delay_incubation <- list(name="gamma", shape = shape_incubation, scale = scale_incubation)
shape_onset_to_report = 2.7
scale_onset_to_report = 1.6
delay_onset_to_report <- list(name="gamma",
shape = shape_onset_to_report,
scale = scale_onset_to_report)
delayed_observations_2 <- simulate_delayed_observations(
infections,
delay = list(delay_incubation, delay_onset_to_report)
)
# Simulating noisy delayed observations, assuming a gaussian noise
delayed_observations_3 <- simulate_delayed_observations(
infections,
delay = delay,
noise = list(type = 'gaussian', sd = 0.8)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.