Skip to contents

This function takes as input a brms model fit for a factorial design and returns posterior draws for each factor level combination.

Usage

extract_cell_draws(fit)

Arguments

fit

An object of class brmsfit.

Value

A draws_df object containing posterior draws and additional metadata.

Note

The faintr package currently does not support multivariate models and models that use families categorical, dirichlet, multinomial, and logistic_normal. Furthermore, models must not include special effect terms mo(), mi(), me(), and cs() for fixed effects. Also note that faintr currently does not support models where the intercept is a population-level parameter (class b), as is the case when using the 0 + Intercept syntax in the brm function call.

References

Bürkner, P.-C. (2017). brms: An R Package for Bayesian Multilevel Models Using Stan. Journal of Statistical Software, 80(1), 1-28. doi:10.18637/jss.v080.i01

Examples

if (FALSE) {
# fit a linear mixed effects model on data from a 2 x 2 factorial design
## regress voice pitch against gender and context
fit <- brms::brm(formula = pitch ~ gender * context + (1 | subject + sentence),
                 data = politeness)

# extract draws for all four factor cells
extract_cell_draws(fit)
}