get_samps: Retrieve final states from sampled Markov chains

Description Usage Arguments Details Value

View source: R/get_samps.R

Description

get_samps can be used to randomly select states from a fitted model object of class epimodel. The object must have been fit using Markov chain Monte Carlo, i.e. using algorithm = "sampling" in the call to epim. The states are sampled uniformly at random without replacement, across all chains and not including the warmup period.

Usage

1
get_samps(prefit, n)

Arguments

prefit

An object of class epimodel. This object must have been fit using algorithm = "sampling".

n

A positive integer. This specifies the number of states to sample.

Details

This function can be used to specify the initial state for sampling based on states from another sampling run. This is particularly useful, for example, when you wish to fit a model using pop_adjust = T, as this makes the posterior geometry difficult to explore. Using a "prefit" run with pop_adjust = F is useful for finding good states that can be used as initial states for the run with the population adjustment.

Value

A list of length n. Each element in the list is itself a named list, with elements corresponding to sample parameters. The result can be passed directly as the init argument in epim.


epidemia documentation built on Oct. 25, 2021, 9:09 a.m.