There are two entry points for generating the summary log:

  • stan_summary_log(): return a tibble the summarizes the Stan models under the specified directory

  • stan_add_summary(): join summary columns to a bbr::run_log() tibble. At least one row of the run log tibble must have a Stan model.

stan_summary_log(
  .base_dir,
  .recurse = FALSE,
  .include = NULL,
  variables = "lp__",
  summary_fns = NULL
)

stan_add_summary(.log_df, variables = "lp__", summary_fns = NULL)

Arguments

.base_dir

Base directory to look in for models.

.recurse

If FALSE, the default, only include models in .base_dir but not subdirectories. This is passed through to fs::dir_ls() -- If TRUE recurse fully, if a positive number the number of levels to recurse.

.include

A character vector specifying which runs or model tags to include in the run log.

variables

Model variables to summarize with summary_fns. This value is passed through to the CmdStanFit $summary() method. To summarize these variables, their draws will be read in. It is valid to specify a variable that only exists in a subset of the models.

By default this is restricted to "lp__", but you will likely want to extend this with a few variables of interest. $summary() will use all variables if you pass NULL, but it's recommended to keep the set small for performance reasons and because each variable adds a number of columns equal to the number of summary_fns (or possibly more, if a summary function returns a named vector). To disable extracting and summarizing the draws entirely, set summary_fns to an empty list.

summary_fns

A list of summary or diagnostic functions passed to posterior::summarize_draws(). The result will be included as a new column, {variable}_{name}, where "name" is determined by the names of the returned vector or otherwise by the name of the summary_fns item.

With the default value of NULL, the following functions are used: mean(), stats::median(), posterior::quantile2(), posterior::rhat(), posterior::ess_bulk(), and posterior::ess_tail(). Pass an empty list to disable all variable summaries.

.log_df

a bbi_run_log_df tibble (the output of run_log())

Value

A tibble. For stan_summary_log(), the tibble will have a row for each Stan model collected from under the directory. For stan_add_summary(), the tibble will have the same number of rows as .log_df with additional columns.

Details

The information for each row is primarily extracted from a few methods of the cmdstanr fit object: $metadata, $diagnostic_summary(), and $summary().

See also

https://mc-stan.org/misc/warnings for an overview of diagnostics and warnings