Learn R Programming

chkptstanr (version 0.1.1)

extract_chkpt_draws: Extract Draws from CmdStanMCMC Objects

Description

A convenience function for extracting the draws from a CmdStanMCMC object.

Usage

extract_chkpt_draws(object, phase)

Arguments

object

An object of class CmdStanMCMC.

phase

Character string. Which phase during checkpointing? The options included warmup and sample. The latter extracts the draws with inc_warmup = FALSE, which is the default in draws

Value

A 3-D draws_array object (iteration x chain x variable).

Examples

Run this code
# NOT RUN {
 library(cmdstanr)

# eight schools example
fit_schools_ncp_mcmc <- cmdstanr_example("schools_ncp")

drws <- extract_chkpt_draws(object = fit_schools_ncp_mcmc,
                            phase = "sample")

# compare to cmdstanr
all.equal(drws, fit_schools_ncp_mcmc$draws())
# }

Run the code above in your browser using DataLab