Skip to contents

Samples from the offspring distributions (see offspring_opts()) and adds the next generation of transmission events by reference to case_data. The generation times for each infector-infectee pair is also sampled and is returned from the function.

Usage

sample_offspring(case_data, offspring, alpha, latent_period)

Arguments

case_data

a data.table: cases in outbreak so far; initially generated by outbreak_setup()

offspring

a list with class <ringbp_offspring_opts>: the offspring distribution functions for the ringbp model, returned by offspring_opts(). Contains three elements: community, isolated, and asymptomatic

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 with the generation times for the new cases exposure/infection times.

Note The case_data supplied to the function is modified by references, see data.table::set() for more information.

Details

A case's offspring cannot simply be sampled from a single offspring distribution, as the case might become isolated before infecting some or all of those cases. To account for cases that transition between states (community -> isolated for symptomatic cases, asymptomatic -> isolated for asymptomatic cases) we sample offspring from both the pre-isolation and the post-isolation (isolated) distributions, assign all new cases a generation time, and then discard pre-isolation offspring with a generation time after the isolation time and post-isolation offspring with a generation time before it.