Skip to contents

Selects posterior iterations once (shared across scenarios), simulates baseline and each scenario using the same draw indices and RNG seed streams, and returns both absolute forecasts and paired differences vs baseline.

Usage

chlaa_forecast_scenarios_from_fit(
  fit,
  pars = NULL,
  scenarios = NULL,
  baseline_name = "baseline",
  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,
  include_baseline_in_scenarios = TRUE
)

Arguments

fit

A `chlaa_fit` object.

pars

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

scenarios

Scenarios to run (list of `chlaa_scenario`, named list of modify lists, or a grid data.frame).

baseline_name

Baseline scenario name (modify list may be empty).

time

Simulation times. If NULL uses `fit` data times.

vars

Model variables to summarise.

include_cases

Include predicted observed cases variable "cases".

obs_model

One of "nbinom" or "mean".

quantiles

Quantiles to compute.

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 draw.

n_threads

Threads for dust2.

deterministic

Deterministic process model toggle (if supported).

include_baseline_in_scenarios

If TRUE, ensures baseline is included even if not passed.

Value

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