brms (version 1.10.2)

VarCorr.brmsfit: Extract Variance and Correlation Components

Description

This function calculates the estimated standard deviations, correlations and covariances of the group-level terms in a multilevel model of class brmsfit. For linear models, the residual standard deviations, correlations and covariances are also returned.

Usage

# S3 method for brmsfit
VarCorr(x, sigma = 1, summary = TRUE, robust = FALSE,
  probs = c(0.025, 0.975), old = FALSE, estimate = "mean", ...)

# S3 method for brmsVarCorr as.data.frame(x, ...)

Arguments

x

An object of class brmsfit.

sigma

Ignored (included for compatibility with VarCorr).

summary

Should summary statistics (i.e. means, sds, and 95% intervals) 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 deivation (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.

old

Logical; indicates if the old implementation of this method (prior to version 1.7.0) should be used. Defaults to FALSE.

estimate

(Deprecated) A character vector specifying which coefficients (e.g., "mean", "median", "sd", or "quantile") should be calculated for the population-level effects. Only used if old is TRUE.

...

Further arguments to be passed to the functions specified in estimate

Value

A list of lists (one per grouping factor), each with three elements: a matrix containing the standard deviations, an array containing the correlation matrix, and an array containing the covariance matrix with variances on the diagonial.

If old is TRUE, the returned object is of class brmsVarCorr, which can be coerced to a data.frame by using the as.data.frame method.

Examples

Run this code
# NOT RUN {
fit <- brm(count ~ log_Age_c + log_Base4_c * Trt_c + (1+Trt_c|visit), 
           data = epilepsy, family = gaussian(), chains = 2)
VarCorr(fit)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab