Convert the parameters in a monty_samples object into a long-format
tibble with one row per parameter, sample and chain. Array parameters
(beta[1], beta[2]) are split into a parameter name and index
columns, and parameters from a grouped packer (beta<a>) into a
parameter name and a group column.
Arguments
- samples
A
monty_samplesobject, frommonty::monty_sample()orrun_parameter_sets().- vars
Optional character vector of parameters to keep.
- dims
Optional names for the dimensions of array variables. Either an unnamed character vector applied by position to every array variable (
c("age", "vax")), or a named list giving the dimension names of each variable (list(S = c("age", "vax"), R = "age")). Dimensions that are not named produce columnsindex1,index2, and so on.- labels
Optional named list of labels for dimensions, for example
list(age = c("child", "adult")). Labelled dimensions become factors. Use the namegroupto label parameter groups.
Value
A tibble with columns chain, iteration, sample,
parameter (a factor, with levels in the order of the samples),
index columns for array parameters, group for
grouped parameters, and value.
Details
For a wide format with one column per parameter, use
posterior::as_draws_df(), which monty supports directly. Its
.chain, .iteration and .draw columns hold the same values as
chain, iteration and sample here.