The $unconstrain_draws() method transforms all parameter draws to the unconstrained scale. The method returns a list for each chain, containing the parameter values from each iteration on the unconstrained scale. If called with no arguments, then the draws within the fit object are unconstrained. Alternatively, either an existing draws object or a character vector of paths to CSV files can be passed.

unconstrain_draws(files = NULL, draws = NULL)

Arguments

files

(character vector) The paths to the CmdStan CSV files. These can be files generated by running CmdStanR or running CmdStan directly.

draws

A posterior::draws_* object.

Examples

# \dontrun{
fit_mcmc <- cmdstanr_example("logistic", method = "sample")
fit_mcmc$init_model_methods()
#> Error: Model methods cannot be used with a pre-compiled Stan executable, the model must be compiled again

# Unconstrain all internal draws
unconstrained_internal_draws <- fit_mcmc$unconstrain_draws()
#> Error: The method has not been compiled, please call `init_model_methods()` first

# Unconstrain external CmdStan CSV files
unconstrained_csv <- fit_mcmc$unconstrain_draws(files = fit_mcmc$output_files())
#> Error: The method has not been compiled, please call `init_model_methods()` first

# Unconstrain existing draws object
unconstrained_draws <- fit_mcmc$unconstrain_draws(draws = fit_mcmc$draws())
#> Error: The method has not been compiled, please call `init_model_methods()` first
# }