Learn R Programming

brms (version 2.22.0)

coef.brmsfit: Extract Model Coefficients

Description

Extract model coefficients, which are the sum of population-level effects and corresponding group-level effects

Usage

# S3 method for brmsfit
coef(object, summary = TRUE, robust = FALSE, probs = c(0.025, 0.975), ...)

Value

A list of 3D arrays (one per grouping factor). If summary is TRUE, the 1st dimension contains the factor levels, the 2nd dimension contains the summary statistics (see posterior_summary), and the 3rd dimension contains the group-level effects. If summary is FALSE, the 1st dimension contains the posterior draws, the 2nd dimension contains the factor levels, and the 3rd dimension contains the group-level effects.

Arguments

object

An object of class brmsfit.

summary

Should summary statistics be returned instead of the raw values? Default is TRUE.

robust

If FALSE (the default) the mean is used as the measure of central tendency and the standard deviation as the measure of variability. If TRUE, the median and the median absolute deviation (MAD) are applied instead. Only used if summary is TRUE.

probs

The percentiles to be computed by the quantile function. Only used if summary is TRUE.

...

Further arguments passed to fixef.brmsfit and ranef.brmsfit.

Examples

Run this code
if (FALSE) {
fit <- brm(count ~ zAge + zBase * Trt + (1+Trt|visit),
           data = epilepsy, family = gaussian(), chains = 2)
## extract population and group-level coefficients separately
fixef(fit)
ranef(fit)
## extract combined coefficients
coef(fit)
}

Run the code above in your browser using DataLab