seir_model_fit: SEIR model fitting method to a multiple outbreak model

View source: R/SEIR_outbreak_model_fitting.R

seir_model_fitR Documentation

SEIR model fitting method to a multiple outbreak model

Description

Create an instance of the hierarchical SEIR Stan model incorporating various data elements and sample model.

Usage

seir_model_fit(
  stan_model = NULL,
  tmax,
  n_outbreaks,
  outbreak_cases,
  outbreak_sizes,
  intervention_switch = TRUE,
  multilevel_intervention = FALSE,
  priors = prior_list,
  chains = 4,
  iter = 600,
  seed = 42,
  fit_type = "NUTS",
  data_model = "poisson"
)

Arguments

stan_model

[rstan] model object

tmax

Total number of time-points in observation

n_outbreaks

Total number of outbreaks

outbreak_cases

Number of daily reported cases by outbreak

outbreak_sizes

The total size of each facility (initial number of susceptible and exposed)

intervention_switch

Describes whether interventions occur in data (default TRUE)

multilevel_intervention

Describes whether intervention occurs

chains

Number of chains to sample

iter

number of iterations of MCMC

seed

The seed for random number generation. Set to replicate results.

fit_type

string "NUTS" or "VB" (VB quicker but less accurate).

data_model

string "poisson" or "negative_binomial". If negative_binomial selected then uses phi prior to control for overdispersion

prior_list

List of priors. See [prior_list]

Value

An object of class 'stanfit' returned by sampling

Author(s)

Mike Irvine

Examples

stan_mod <- rstan::stan_model(system.file("stan",
  "hierarchical_SEIR_incidence_model.stan", package = "cr0eso"))
tmax <- 5
pop_size <- 100
dim(pop_size) <- c(1)
example_incidence <- matrix(c(1,1,2,3,2),ncol=1)
fit <- seir_model_fit(stan_model = stan_mod, tmax,1,example_incidence,pop_size)

sempwn/cr0eso documentation built on Aug. 21, 2022, 1:35 a.m.