extract_inits: Generate initial conditions from a Stan fit

extract_initsR Documentation

Generate initial conditions from a Stan fit

Description

[Experimental] Extracts posterior samples to use to initialise a full model fit. This may be useful for certain data sets where the sampler gets stuck or cannot easily be initialised. In estimate_infections(), epinow() and regional_epinow() this option can be engaged by setting ⁠stan_opts(init_fit = <stanfit>)⁠.

This implementation is based on the approach taken in epidemia authored by James Scott.

Usage

extract_inits(fit, current_inits, exclude_list = NULL, samples = 50)

Arguments

fit

A ⁠<stanfit>⁠ object.

current_inits

A function that returns a list of initial conditions (such as create_initial_conditions()). Only used in exclude_list is specified.

exclude_list

A character vector of parameters to not initialise from the fit object, defaulting to NULL.

samples

Numeric, defaults to 50. Number of posterior samples.

Value

A function that when called returns a set of initial conditions as a named list.


EpiNow2 documentation built on Oct. 31, 2024, 5:09 p.m.