Skip to contents

Construct model

Usage

construct_model(
  pathogen_structure,
  method,
  smoothing_params = smoothing_structure(),
  dispersion_params = dispersion_structure(),
  pathogen_noise = FALSE,
  dow_effect = FALSE
)

Arguments

pathogen_structure

either single(), multiple(), or subtyped()

method

either random_walk() or p_spline()

smoothing_params

argument is optional and defines the structure of the smoothing terms including optionally setting the smoothing prior tau. Created with smoothing_structure(). NULL option defaults to "shared" smoothing structure and default priors.

dispersion_params

argument is optional and defines priors for the overdispersion parameter of the negative binomial likelihood for the case timeseries. Created using dispersion_structure(). NULL option uses default priors for phi.

pathogen_noise

logical whether individual pathogen counts have additional gamma-distributed noise. Default is FALSE. Models with single pathogen structure will be set to FALSE.

dow_effect

logical whether to incorporate a day of week model.

Value

a list containing the data, the model parameters, and pathogen names of class EpiStrainDynamics.model

Examples


mod <- construct_model(
  pathogen_structure = multiple(
    data = sarscov2,
    case_timeseries = "cases",
    time = "date",
    component_pathogen_timeseries = c("alpha", "delta", "omicron", "other")
  ),
  method = p_spline(),
  smoothing_params = smoothing_structure(
    "independent",
    tau_mean = c(0, 0.1, 0.3, 0), tau_sd = rep(1, times = 4)
  ),
  dispersion_params = dispersion_structure(phi_mean = 0, phi_sd = 1),
  pathogen_noise = FALSE,
  dow_effect = TRUE
)