Sample the offspring distributions for cases that can be in either the community, isolated or asymptomatic states and transition between states
Source:R/sample_offspring.R
sample_offspring.RdSamples 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.
Arguments
- case_data
a
data.table: cases in outbreak so far; initially generated byoutbreak_setup()- offspring
a
listwith class<ringbp_offspring_opts>: the offspring distributionfunctions for the ringbp model, returned byoffspring_opts(). Contains three elements:community,isolated, andasymptomatic- alpha
a
numericscalar: skew parameter of the skew-normal distribution. Used to model the relationship between incubation period and generation time.- latent_period
a non-negative
numericscalar: 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_periodis positive then generation times are sampled conditional ongt >= latent_period(i.e. left-truncated atlatent_period). This may reduce the realised proportion of presymptomatic transmission, depending on theincubation_perioddistribution andpresymptomatic_transmission(inevent_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.