save_pars: Control Saving of Parameter Draws

Description Usage Arguments Value Examples

View source: R/exclude_pars.R

Description

Control which (draws of) parameters should be saved in a brms model. The output of this function is ment for usage in the save_pars argument of brm.

Usage

1
save_pars(group = TRUE, latent = FALSE, all = FALSE, manual = NULL)

Arguments

group

A flag to indicate if group-level coefficients for each level of the grouping factors should be saved (default is TRUE). Set to FALSE to save memory. Alternatively, group may also be a character vector naming the grouping factors for which to save draws of coefficients.

latent

A flag to indicate if draws of latent variables obtained by using me and mi terms should be saved (default is FALSE). Saving these draws allows to better use methods such as posterior_predict with the latent variables but leads to very large R objects even for models of moderate size and complexity. Alternatively, latent may also be a character vector naming the latent variables for which to save draws.

all

A flag to indicate if draws of all variables defined in Stan's parameters block should be saved (default is FALSE). Saving these draws is required in order to apply the certain methods such as bridge_sampler and bayes_factor.

manual

A character vector naming Stan variable names which should be saved. These names should match the variable names inside the Stan code before renaming. This feature is meant for power users only and will rarely be useful outside of very special cases.

Value

A list of class "save_pars".

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# don't store group-level coefficients
fit <- brm(count ~ zAge + zBase * Trt + (1|patient),
           data = epilepsy, family = poisson(),
           save_pars = save_pars(group = FALSE))
variables(fit)

## End(Not run)
  

brms documentation built on Aug. 23, 2021, 5:08 p.m.