Fit a stochastic epidemic model using the linear noise approximation or ordinary differential equations to approximate the latent epidemic process.

fit_stem(
  stem_object,
  method,
  mcmc_kern,
  iterations,
  initialization_attempts = 500,
  ess_warmup = 50,
  thinning_interval = 100,
  return_adapt_rec = FALSE,
  return_ess_rec = FALSE,
  print_progress = 0,
  status_filename = NULL
)

Arguments

stem_object

a stochastic epidemic model object containing the dataset, model dynamics, and measurement process.

method

either "lna" or "ode".

mcmc_kern

MCMC transition kernel generated by a call to the mcmc_kernel function.

iterations

number of iterations

initialization_attempts

number of initialization attempts

ess_warmup

number of preliminary ESS iterations for the LNA, initial conditions, and time varying parameters prior to starting MCMC

thinning_interval

thinning interval for posterior samples, defaults to saving every 100th sample

return_adapt_rec

should the MCMC samples be returned during adaptation? defaults to FALSE.

return_ess_rec

should elliptical slice sampling steps and angles be returned? defaults to FALSE

print_progress

interval at which to print progress to a text file. If 0 (default) progress is not printed.

status_filename

string to pre-append to status files, defaults to LNA or ODE depending on the method used.

Value

list with posterior samples for the parameters and the latent process, along with MCMC diagnostics.