epiinf: Model Latent Infections

Description Usage Arguments Details Value Examples

View source: R/epiinf.R

Description

epiinf defines a model for latent infections. For the basic version of the model, this defines the generation distribution of the disease, the number of days for which to seed infections, and the prior distribution on the parameter τ, as described in the model description vignette. Recall that τ is the prior mean on daily seeded infections. These three parameters are controlled by the arguments gen, seed_days and prior_seeds respectively.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
epiinf(
  gen,
  seed_days = 6L,
  prior_seeds = hexp(prior_aux = rstanarm::exponential(0.03)),
  latent = FALSE,
  family = "normal",
  prior_aux = rstanarm::normal(10, 5),
  fixed_vtm = 1,
  pop_adjust = FALSE,
  pops = NULL,
  rm = NULL,
  prior_susc = NULL,
  prior_rm_noise = NULL
)

Arguments

gen

A numeric vector representing the probability mass function for the generation time of the disease (must be a probability vector).

seed_days

An integer giving the number of days for which to seed infections. Defaults to 6L.

prior_seeds

The prior distribution on seeded infections. This may be a call to normal, student_t, exponential, or to hexp. The latter distribution allows hierarchical modeling of seeded infections.

latent

If TRUE, treat infections as latent parameters using the extensions described in Section 5.2 here.

family

Specifies the family for the prior distribution on daily infections. Only used if latent = TRUE, and currently restricted to normal.

prior_aux

Prior distribution for the auxiliary variable in the distribution for latent infections. Only used if latent = TRUE. If fixed_vtm = TRUE, then this refers to the variance-to-mean ratio. If fixed_vtm = FALSE, it is instead the coefficient of variation. Can be a call to exponential, normal, student_t or cauchy. These result in half-normal, half-t and half-cauchy priors.

fixed_vtm

If TRUE, then the prior variance-to-mean ratio for latent infections is fixed, i.e. the auxiliary variable refers to the coefficient of dispersion. If FALSE, then the prior ratio of standard deviation to mean is fixed instead, and the auxiliary variable refers to the coefficient of variation.

pop_adjust

If TRUE, applies a population adjustment to the infection process. Defaults to FALSE.

pops

A character vector giving the name of the column in the dataframe corresponding to the population of each group.

rm

A characted vector giving a column name in data (see epim). Each entry should be the proportion of the susceptible population in that group that are removed at that point by some means other than infection; i.e. vaccination. Only used if pop_adjust=TRUE.

prior_susc

Prior distribution on the initial susceptible population at time 0, expressed as a proportion of the total population size. This quantity lies between 0 and 1, and is useful when the first modeled date is after the true beginning of an epidemic. Only used when pop_adjust = TRUE. If unspecified, then the entire population is assumed to be susceptible at time 0. If specified, should be a call to normal.

prior_rm_noise

Removal from the susceptible population (to account for vaccinations) can be applied using the rm argument. However, in practice, it is difficult to specify the proportion of the susceptible class removed at any point in time. prior_rm_noise helps to model noise around this. If specified, should be a call to normal.

Details

epiinf has additional arguments which allow the user to extend the basic model. Using latent=TRUE replaces the renewal process with a model that treats latent infections as unknown parameters that are sampled along with other parameters. The family argument then gives the distribution family for latent infections, while prior_aux defines the prior on the coefficient of dispersion d of this distribution.

Recall that one can adjust the infection process to explicitly model changes in infection rates as the remaining susceptible population is depleted. In particular, the adjustment ensures that cumulative infections never breaches the initial susceptible population. The adjustment was described in Section 5.3 of the model description article. It can be employed by setting pop_adjust = TRUE and using the susceptibles argument to point towards a variable in the dataframe which gives the susceptible population at each point in time.

Value

An object of class epiinf.

Examples

1
2
3
4
5
6
data(EuropeCovid)
inf <- epiinf(
 gen = EuropeCovid$si,
 seed_days = 6L,
 prior_seeds = hexp(rstanarm::exponential(0.02))
)

epidemia documentation built on Oct. 25, 2021, 9:09 a.m.