Skip to contents

Samples generation times from a skew-normal distribution based on relative symptom onset times (symptom_onset_time - exposure_time), ensuring all generation times are at least latent_period. The location parameter of the skew-normal distribution is set to the relative symptom onset times.

Usage

incubation_to_generation_time(
  symptom_onset_time,
  exposure_time = rep(0, length(symptom_onset_time)),
  alpha,
  latent_period = 0
)

Arguments

symptom_onset_time

a positive numeric vector: symptom onset time(s) of the infector(s) in the case data. The symptom onset times are generated by sampling from the incubation period.

exposure_time

a non-negative numeric vector: time of exposure of the infector(s) in the case data. Used to convert symptom onset in absolute time to relative time for each infectee. Default is for all exposure times to be 0.

alpha

a numeric scalar: skew parameter of the skew-normal distribution. Used to model the relationship between incubation period and generation time.

latent_period

a non-negative numeric scalar: the minimum time between an individual being exposed and becoming infectious. It is a population-wide parameter, with no variability between individuals. It sets the minimum generation time in the model. Default is 0 (i.e. an individual becomes immediately infectious after being infected).

If latent_period is positive then generation times are sampled conditional on gt >= latent_period (i.e. left-truncated at latent_period). This may reduce the realised proportion of presymptomatic transmission, depending on the incubation_period distribution and presymptomatic_transmission (in event_prob_opts()).

Value

a numeric vector of generation times of equal length to the vector input to symptom_onset_time: the i-th element of the vector contains a sample from the generation time distribution of an individual with incubation period given by the i-th element of the symptom_onset_time vector. The lower bound of the output generation time vector is set by the latent_period, to prevent transmission before becoming infectious.

Examples

incubation_to_generation_time(
  symptom_onset_time = c(1, 2, 3, 4, 1),
  alpha = 2
)
#> [1] 3.774853 3.185916 2.745612 3.570205 2.602837