Skip to contents

For more information on the pathfinder algorithm see the CmdStan documentation. # nolint

Usage

enw_pathfinder(data, model = epinowcast::enw_model(), diagnostics = TRUE, ...)

Arguments

data

A list of data as produced by model modules (for example enw_expectation(), enw_obs(), etc.) and as required for use the model being used.

model

A cmdstanr model object as loaded by enw_model() or as supplied by the user.

diagnostics

Logical, defaults to TRUE. Should fitting diagnostics be returned as a data.frame.

...

Additional parameters to be passed to CmdStanModel$pathfinder().

Value

A data.table containing the fit, data, and fit_args. If diagnostics is TRUE, it also includes the run_time column with the timing information.

Details

Note that the threads_per_chain argument is renamed to num_threads to match the CmdStanModel$pathfinder() method.

This fitting method is faster but more approximate than the NUTS sampler used in enw_sample() and as such is recommended for use in exploratory analysis and model development.

See also

Examples

if (FALSE) { # interactive()
pobs <- enw_example("preprocessed")

nowcast <- epinowcast(pobs,
 expectation = enw_expectation(~1, data = pobs),
 fit = enw_fit_opts(enw_pathfinder, pp = TRUE),
 obs = enw_obs(family = "poisson", data = pobs),
)

summary(nowcast)
}