Skip to contents

Runs the model for multiple posterior draws and returns time-by-time summaries (mean and quantiles) for selected variables.

Usage

chlaa_forecast_from_fit(
  fit,
  pars = NULL,
  time = NULL,
  vars = c("inc_symptoms", "cum_symptoms", "cum_deaths"),
  include_cases = TRUE,
  obs_model = c("nbinom", "mean"),
  quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975),
  n_draws = 100,
  burnin = 0.5,
  thin = 1,
  seed = 1,
  dt = 0.25,
  n_particles = 1,
  n_threads = 1,
  deterministic = FALSE,
  modify = NULL
)

Arguments

fit

A `chlaa_fit` object (or compatible).

pars

Baseline parameter list. If NULL, uses `attr(fit, "start_pars")`, otherwise `chlaa_parameters()`.

time

Vector of times to simulate.

vars

Character vector of model variables to summarise.

include_cases

Logical; include predicted observed cases as variable "cases".

obs_model

One of "nbinom" or "mean".

quantiles

Numeric vector of quantiles to return.

n_draws

Number of posterior draws to use.

burnin

Burn-in proportion or integer.

thin

Thinning interval.

seed

Seed.

dt

Model time step.

n_particles

Particles per posterior draw.

n_threads

Threads for dust2.

deterministic

Run the process model deterministically (if supported).

modify

Optional named list of parameter modifications applied after each draw update.

Value

A tidy data.frame with columns: time, variable, mean, quantiles, n_samples.

Details

If `include_cases = TRUE`, this also generates a predictive distribution for observed cases using the observation model: mu = reporting_rate * inc_symptoms and either: - `obs_model = "nbinom"`: sample Negative Binomial noise - `obs_model = "mean"`: use mu directly