enw_expectation: Expectation model module

View source: R/model-modules.R

enw_expectationR Documentation

Expectation model module

Description

Expectation model module

Usage

enw_expectation(
  r = ~0 + (1 | day:.group),
  generation_time = 1,
  observation = ~1,
  latent_reporting_delay = 1,
  data,
  ...
)

Arguments

r

A formula (as implemented in enw_formula()) describing the generative process used for expected incidence. This can use features defined by reference date as defined in metareference as produced by enw_preprocess_data(). By default this is set to use a daily random effect by group. This parameterisation is highly flexible and so may not be the most appropriate choice when data is sparsely reported or reporting delays are substantially. These settings an alternative could be a group specific weekly random walk (specified as ⁠rw(week, by = .group⁠).

generation_time

A numeric vector that sums to 1 and defaults to 1. Describes the weighting to apply to previous generations (i.e as part of a renewal equation). When set to 1 (the default) this corresponds to modelling the daily growth rate.

observation

A formula (as implemented in enw_formula()) describing the modifiers used to adjust expected observations. This can use features defined by reference date as defined in metareference as produced by enw_preprocess_data(). By default no modifiers are used but a common choice might be to adjust for the day of the week. Note as the baseline is no modification an intercept is always used and it is set to 0.

latent_reporting_delay

A numeric vector that defaults to 1. Describes the weighting to apply to past and current latent expected observations (from most recent to least). This can be used both to convolve based on some assumed reporting delay and to rescale observations (by multiplying a probability mass function by some fraction) to account ascertainment etc. A list of PMFs can be provided to allow for time-varying PMFs. This should be the same length as the modelled time period plus the length of the generation time if supplied.

data

Output from enw_preprocess_data().

...

Additional parameters passed to enw_add_metaobs_features(). The same arguments as passed to enw_preprocess_data() should be used here.

Value

A list containing the supplied formulas, data passed into a list describing the models, a data.frame describing the priors used, and a function that takes the output data and priors and returns a function that can be used to sample from a tightened version of the prior distribution.

See Also

Model modules enw_fit_opts(), enw_missing(), enw_obs(), enw_reference(), enw_report()

Examples

enw_expectation(data = enw_example("preprocessed"))

seabbs/epinowcast documentation built on July 8, 2024, 1:45 a.m.