Package 'hermione'

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

Help Index


Reparameterise Beta distributions

Description

Reparameterise Beta distributions

Usage

beta_muvar2shape1shape2(mu, sigma2)

Arguments

mu

Mean, should be less than 1

sigma2

variance, should be less than 1/12

Value

A named list containing 'shape1' and 'shape2'

Author(s)

Sangeeta Bhatia


Reparameterise Beta distributions

Description

Reparameterise Beta distributions

Usage

beta_shape1shape22muvar(shape1, shape2)

Arguments

shape1

positive

shape2

positive

Value

A named list containing 'mu' and 'sigma2'

Author(s)

Sangeeta Bhatia


Modified beta distribution

Description

Modified beta probability density function

Usage

dmbeta(x, shape1, shape2, xmax, ncp = 0, log = FALSE)

Arguments

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)

Details

This function returns the probability density of the random variable x/xmax where x/xmax is distributed according to a beta distribution.

Value

modified density

Author(s)

Sangeeta Bhatia


Probability of serial interval as a convolution of infectiousness distribution of primary case and incubation period of secondary case

Description

Probability of serial interval as a convolution of infectiousness distribution of primary case and incubation period of secondary case

Usage

fast_probability_basic(t, tmax, inf_params, ip_params)

Arguments

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

Value

numeric. Probability of observing the given serial interval given the parameters of infectious period distributions and incubation period distributions

Author(s)

Sangeeta Bhatia


Probability of serial interval when primary case has been isolated and in the presence of asymptomatic infectiousness

Description

Probability of serial interval when primary case has been isolated and in the presence of asymptomatic infectiousness

Usage

fast_probability_isolation_offset(poffset, nu, offset, inf_params)

Arguments

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.

Value

numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distribution

Author(s)

Sangeeta Bhatia


Probability of serial interval in the presence of asymptomatic infectiousness

Description

Probability of serial interval in the presence of asymptomatic infectiousness

Usage

fast_probability_offset(t, tmax, offset, inf_params, ip_params)

Arguments

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.

Value

numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distribution

Author(s)

Sangeeta Bhatia


Modififed beta cumulative probability distribution function

Description

Modififed beta cumulative probability distribution function

Usage

pmbeta(x, shape1, shape2, xmax, ncp = 0, log = FALSE)

Arguments

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)

Value

modified distribution

Author(s)

Sangeeta Bhatia


Probability of serial interval as a convolution of infectiousness distribution of primary case and incubation period of secondary case

Description

Probability of serial interval

Usage

probability_basic(
  t,
  inf_distr = "dgamma",
  inc_distr = "dgamma",
  inf_params,
  inc_params
)

Arguments

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.

Details

Probability of observing a serial interval t is the convolution of the distributions of infectious profile and incubation period.

Value

numeric. Probability of observing the given serial interval given the parameters of infectious period distributions and incubation period distributions

Author(s)

Sangeeta Bhatia

Examples

probability_basic(
  10,
  inf_params = list(shape = 100, rate = 100),
  inc_params = list(shape = 50, rate = 100)
)

Probability of serial interval

Description

Probability of serial interval

Usage

probability_isolation(
  t,
  nu,
  inf_distr = "dgamma",
  inc_distr = "dgamma",
  inf_params,
  inc_params
)

Arguments

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.

Value

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.

Author(s)

Sangeeta Bhatia


Probability of serial interval when primary case has been isolated and in the presence of asymptomatic infectiousness

Description

Probability of serial interval when primary case has been isolated and in the presence of asymptomatic infectiousness

Usage

probability_isolation_offset(
  t,
  nu,
  offset,
  inf_distr = "dgamma",
  inc_distr = "dgamma",
  inf_params,
  inc_params
)

Arguments

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.

Value

numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distributions

Author(s)

Sangeeta Bhatia


Probability of serial interval with asymptomatic infectiousness

Description

Probability of serial interval with asymptomatic infectiousness

Usage

probability_offset(
  t,
  offset,
  inf_distr = "dgamma",
  inc_distr = "dgamma",
  inf_params,
  inc_params
)

Arguments

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.

Value

numeric probability of observing the given serial interval with the given parameters of infectious period and incubation period distribution

Author(s)

Sangeeta Bhatia


Simulate serial interval

Description

Simulate serial interval

Usage

simulate_si(
  mean_ip,
  sd_ip,
  mean_inf,
  sd_inf,
  mean_iso = NULL,
  sd_iso = NULL,
  offset = 0,
  nsim = 50
)

Arguments

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 offset is NULL, then asymptomatic infectiousness is assumed to be absent.

nsim

Number of transmission pairs to simulate

Details

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.

Value

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.

Author(s)

Sangeeta Bhatia


Total log likelihood

Description

Total log-likelhood

Usage

total_log_likelihood(
  tvec,
  nu_vec = NULL,
  offset_vec = NULL,
  inf_params,
  ip_params
)

Arguments

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.

Details

This function returns the totoal log-likelihood of the observed serial interval. In the absence of isolation, the likelihood is

L(rate,shapetvec)=i=1n=0tif(t1)g(tit1)dt1L(rate, shape \mid tvec) = \prod\limits_{i = 1}{n}{ = \int\limits_{0}^{t_{i}}{f(t_1)g(t_{i} - t_1)dt_1} }

where tit_i is the ith observation, t1t_1 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

L(rate,shapetvec)=i=1n=0ti(f(t1)/F(νi))g(tit1)dt1L(rate, shape \mid tvec) = \prod\limits_{i = 1}{n}{ = \int\limits_{0}^{t_{i}}{(f(t_1) / F(\nu_i))g(t_{i} - t_1)dt_1} }

where νi\nu_i 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.

Value

total log-likelihood

Author(s)

Sangeeta Bhatia


Probability of observing serial interval taking into account recall bias

Description

Probability of observing serial interval taking into account recall bias

Usage

with_recall_bias(tobs, nu, inf_params, ip_params, beta)

Arguments

tobs

observed serial interval

nu

isolation

inf_params

parameters of the infectious period

ip_params

parameters of the incubation period

beta

recall bias coefficient

Value

probability of observing tobs taking into account recall bias

Author(s)

Sangeeta Bhatia