Sample the onset-to-outcome time conditional that the outcome is after a hospitalisation event
Source:R/utils.R
dot-sample_outcome_time.Rd
The outcome of a case, either died or recovered, can have a time of event,
but this must be after the hospitalisation time, if a case has been admitted
to hospital. This function samples either the onset-to-death or
onset-to-recovery time conditional on it being greater than a
onset-to-hospitalisation time for a given case, if the case was admitted
to hospital. It does this by resampling onset-to-outcome (death or recovery)
times if they are less than the onset-to-hospitalisation time (from
.add_hospitalisation()
).
Arguments
- .data
A
<data.frame>
containing the infectious history from a branching process simulation (.sim_network_bp()
).- onset_to_outcome
A
function
for either the onset-to-death or onset-to-recovery delay distribution.onset_to_outcome
can also be set toNULL
to not simulate dates for individuals that died or recovered. Seesim_linelist()
documentation for more information.- idx
Either the
infected_lgl_idx
ordied_lgl_idx
from.add_outcomes()
to define who to sample recovery or death times for, respectively.