| Title: | Robust estimation of COVID-19 Serial Interval |
|---|---|
| Description: | This package implements methods to robustly estimate COVID-19 Serial Interval accounting for biases introduced due to isolation of cases. |
| Authors: | Sangeeta Bhatia [aut, cre], Amy Dighe [aut], Kylie E C Ainslie [aut] |
| Maintainer: | Sangeeta Bhatia <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-06-08 10:33:27 UTC |
| Source: | https://github.com/mrc-ide/hermione |
Reparameterise Beta distributions
beta_muvar2shape1shape2(mu, sigma2)beta_muvar2shape1shape2(mu, sigma2)
mu |
Mean, should be less than 1 |
sigma2 |
variance, should be less than 1/12 |
A named list containing 'shape1' and 'shape2'
Sangeeta Bhatia
Reparameterise Beta distributions
beta_shape1shape22muvar(shape1, shape2)beta_shape1shape22muvar(shape1, shape2)
shape1 |
positive |
shape2 |
positive |
A named list containing 'mu' and 'sigma2'
Sangeeta Bhatia
Modified beta probability density function
dmbeta(x, shape1, shape2, xmax, ncp = 0, log = FALSE)dmbeta(x, shape1, shape2, xmax, ncp = 0, log = FALSE)
x |
numeric value for which density is required |
shape1 |
non-negative parameter of the Beta distribution |
shape2 |
non-negative parameter of the Beta distribution |
xmax |
Maximum possible value of x |
ncp |
non-centrality parameter. |
log |
logical; if TRUE, probabilities p are given as log(p) |
This function returns the probability density of the random variable x/xmax where x/xmax is distributed according to a beta distribution.
modified density
Sangeeta Bhatia
Probability of serial interval as a convolution of infectiousness distribution of primary case and incubation period of secondary case
fast_probability_basic(t, tmax, inf_params, ip_params)fast_probability_basic(t, tmax, inf_params, ip_params)
t |
observed serial interval |
tmax |
the maximum time (from the onset of symptoms in the primary case) at which secondary case could have been infected |
inf_params |
list with components rate and shape for infectious period distribution |
ip_params |
list with components rate and shape for incubation period distribution |
numeric. Probability of observing the given serial interval given the parameters of infectious period distributions and incubation period distributions
Sangeeta Bhatia
Probability of serial interval when primary case has been isolated and in the presence of asymptomatic infectiousness
fast_probability_isolation_offset(poffset, nu, offset, inf_params)fast_probability_isolation_offset(poffset, nu, offset, inf_params)
poffset |
Probability calculation with offset only |
nu |
onset to isolation of primary case |
offset |
days of asymptomatic infectiousness |
inf_params |
named list of arguments for infectious period distribution. |
numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distribution
Sangeeta Bhatia
Probability of serial interval in the presence of asymptomatic infectiousness
fast_probability_offset(t, tmax, offset, inf_params, ip_params)fast_probability_offset(t, tmax, offset, inf_params, ip_params)
t |
observed serial interval |
tmax |
Max of observed serial interval and isolation if prmary case has been isolated |
offset |
days of asymptomatic infectiousness |
inf_params |
named list of arguments for infectious period distribution. |
numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distribution
Sangeeta Bhatia
Modififed beta cumulative probability distribution function
pmbeta(x, shape1, shape2, xmax, ncp = 0, log = FALSE)pmbeta(x, shape1, shape2, xmax, ncp = 0, log = FALSE)
x |
numeric value for which density is required |
shape1 |
non-negative parameter of the Beta distribution |
shape2 |
non-negative parameter of the Beta distribution |
xmax |
Maximum possible value of x |
ncp |
non-centrality parameter. |
log |
logical; if TRUE, probabilities p are given as log(p) |
modified distribution
Sangeeta Bhatia
Probability of serial interval
probability_basic( t, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )probability_basic( t, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )
t |
observed serial interval |
inf_distr |
quoted name of the infectious period density function. Defaults to dgamma |
inc_distr |
quoted name of the incubation period density function. Defaults to dgamma |
inf_params |
named list of arguments for infectious period distribution. |
inc_params |
named list of arguments for incubation period distribution. |
Probability of observing a serial interval t is the convolution of the distributions of infectious profile and incubation period.
numeric. Probability of observing the given serial interval given the parameters of infectious period distributions and incubation period distributions
Sangeeta Bhatia
probability_basic( 10, inf_params = list(shape = 100, rate = 100), inc_params = list(shape = 50, rate = 100) )probability_basic( 10, inf_params = list(shape = 100, rate = 100), inc_params = list(shape = 50, rate = 100) )
Probability of serial interval
probability_isolation( t, nu, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )probability_isolation( t, nu, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )
t |
observed serial interval |
nu |
onset to isolation of primary case |
inf_distr |
quoted name of the infectious period density function. Defaults to dgamma |
inc_distr |
quoted name of the incubation period density function. Defaults to dgamma |
inf_params |
named list of arguments for infectious period distribution. |
inc_params |
named list of arguments for incubation period distribution. |
numeric. Probability of observing the given serial interval given the delay from onset to isolation, the parameters of infectious period distributions and incubation period distributions.
Sangeeta Bhatia
Probability of serial interval when primary case has been isolated and in the presence of asymptomatic infectiousness
probability_isolation_offset( t, nu, offset, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )probability_isolation_offset( t, nu, offset, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )
t |
observed serial interval |
nu |
onset to isolation of primary case |
offset |
days of asymptomatic infectiousness |
inf_distr |
quoted name of the infectious period density function. Defaults to dgamma |
inc_distr |
quoted name of the incubation period density function. Defaults to dgamma |
inf_params |
named list of arguments for infectious period distribution. |
inc_params |
named list of arguments for incubation period distribution. |
numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distributions
Sangeeta Bhatia
Probability of serial interval with asymptomatic infectiousness
probability_offset( t, offset, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )probability_offset( t, offset, inf_distr = "dgamma", inc_distr = "dgamma", inf_params, inc_params )
t |
observed serial interval |
offset |
days of asymptomatic infectiousness |
inf_distr |
quoted name of the infectious period density function. Defaults to dgamma |
inc_distr |
quoted name of the incubation period density function. Defaults to dgamma |
inf_params |
named list of arguments for infectious period distribution. |
inc_params |
named list of arguments for incubation period distribution. |
numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distribution
Sangeeta Bhatia
Simulate serial interval
simulate_si( mean_ip, sd_ip, mean_inf, sd_inf, mean_iso = NULL, sd_iso = NULL, offset = 0, nsim = 50 )simulate_si( mean_ip, sd_ip, mean_inf, sd_inf, mean_iso = NULL, sd_iso = NULL, offset = 0, nsim = 50 )
mean_ip |
Mean Incubation Period |
sd_ip |
Standard deviation of the incubation period |
mean_inf |
Infectious Period |
sd_inf |
Standard deviation of the infectious period |
mean_iso |
Mean delay from symptom onset to case isolation. If this is null, then isolation is not simulated. |
sd_iso |
Standard deviation of the delay from symptom onset to case isolation |
offset |
Numeric - days before symptom onset that
infectiousness is assumed to begin. If |
nsim |
Number of transmission pairs to simulate |
This function simulates serial interval with or without case isolation, and with or without pre-symptomatic infectiousness. At the moment, infectious period, incubation period and onset to isolation distributions are assumed to be gamma distributed.
a data frame with columns t_1, t_2, si t_1 corresponds to draws from the infectious period, t_2 corresponds to draws from the incubation period, and si is the serial interval (t_1 + t_2). If mean_iso and sd_iso are not NULL, then the output also contains a column nu corresponding to draws from the distribution of onset to isolation.
Sangeeta Bhatia
Total log-likelhood
total_log_likelihood( tvec, nu_vec = NULL, offset_vec = NULL, inf_params, ip_params )total_log_likelihood( tvec, nu_vec = NULL, offset_vec = NULL, inf_params, ip_params )
tvec |
Vector of observed serial intervals |
nu_vec |
Vector of delays from onset to isolation |
offset_vec |
Vector specifying the pre-symptomatic infectiousness |
inf_params |
named list of arguments for infectious period distribution. |
This function returns the totoal log-likelihood of the observed serial interval. In the absence of isolation, the likelihood is
where is the ith observation, is the delay between
symptom onset in a primary case to the infection of a secondary case,
and f and g are the infectious and incubation period distributions
respectively.
If isolation is included via non-null nu_vec, the likelihood
is
where is the delay from symptom onset in the primary
case to their isolation.
Finally, if asymptomatic infectiosuness is included (non-null offset_vec)
the infectiousness profile is a gamma distribution with offset.
total log-likelihood
Sangeeta Bhatia
Probability of observing serial interval taking into account recall bias
with_recall_bias(tobs, nu, inf_params, ip_params, beta)with_recall_bias(tobs, nu, inf_params, ip_params, beta)
tobs |
observed serial interval |
nu |
isolation |
inf_params |
parameters of the infectious period |
ip_params |
parameters of the incubation period |
beta |
recall bias coefficient |
probability of observing tobs taking into account recall bias
Sangeeta Bhatia