extract_cell_draws: Extract posterior draws for all factorial design cells

View source: R/faintr_functions.R

extract_cell_drawsR Documentation

Extract posterior draws for all factorial design cells

Description

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v080.i01")}

Examples

## Not run: 
# 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)

## End(Not run)


michael-franke/faintr documentation built on April 18, 2023, 8:31 p.m.