epiobs: Define Observational Models

Description Usage Arguments Details Value Examples

View source: R/epiobs.R

Description

epiobs defines a model for an observation vector. These observations are taken to be a function of the latent infections in the population. Examples include daily death or hospitalization rates. For more details on the model assumptions please refer to the model description vignette.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
epiobs(
  formula,
  i2o,
  family = "neg_binom",
  link = "logit",
  center = FALSE,
  prior = rstanarm::normal(scale = 0.2),
  prior_intercept = rstanarm::normal(scale = 0.2),
  prior_aux = rstanarm::normal(location = 10, scale = 5),
  ...
)

Arguments

formula

An object of class formula which determines the linear predictor for the ascertainment rate. The left hand side must define the response that is being modeled (i.e. the actual observations, not the latent ascertainment rates) in a given country on a given date.

i2o

A numeric (simplex) vector defining the probability mass function of the time distribution from infection to observation (i.e. a single death or hospitalization etc.). The nth element represents the probability that the individual was infected exactly n days prior to this.

family

A string representing the family of the sampling distribution. Can be "poisson", "neg_binom", "quasi_poisson", "normal" or "log_normal".

link

A string representing the link function used to transform the linear predictor. Can be one of "logit", "probit", "cauchit", "cloglog", "identity". Defaults to "logit".

center

If TRUE then the covariates are centered to have mean zero. All of the priors are then interpreted as priors on the centered covariates. Defaults to FALSE.

prior

Same as in stan_glm. Note: If autoscale=TRUE in the call to the prior distribution then automatic rescaling of the prior may take place.

prior_intercept

Same as in stan_glm. Prior for the regression intercept, if one has been specified.

prior_aux

The prior distribution for the auxiliary parameter, if it exists. Only used if family is "neg_binom" (reciprocal dispersion), "quasi_poisson" (dispersion), "normal" (standard deviation) or "log_normal" (sigma parameter). Can be a call to exponential, normal, student_t or cauchy. These result in half-normal, half-t and half-cauchy priors.

...

Additional arguments for model.frame

Details

Each observational model is given by a call to epiobs. In particular, this must define the model for ascertainment rates and the time distribution from infection to observation. epiobs has a formula argument. The left hand side must define the observation vector to be modeled, while the right hand side defines a linear predictor for the ascertainment rate. The argument i2o plays a similar role to the gen argument in epiinf, however it instead defines the probability mass function for the time between infection and observation.

Value

An object of class epiobs.

Examples

1
2
3
4
5
6
7
8
data(EuropeCovid)
# constant ascertainment rate (intercept model)
# link ensures ascertainment is between 0 and 2%
deaths <- epiobs(
 deaths ~ 1,
 i2o = EuropeCovid$inf2death,
 link = scaled_logit(0.02)
)

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