brms (version 0.10.0)

VarCorr.brmsfit: Extract variance and correlation components

Description

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

Usage

"VarCorr"(x, sigma = 1, estimate = "mean", as.list = TRUE, ...)
"as.data.frame"(x, ...)

Arguments

x
An object of class brmsift.
sigma
Ignored (included for compatibility with VarCorr).
estimate
A character vector specifying which summary statistics (e.g., "mean", "median", "sd", or "quantile") should be calculated for the extracted parameters.
as.list
logical; Indicates if covariance and correlation matrices should be returned as lists of matrices (the default), or as 3-dimensional arrays. We recommend not to set as.list to FALSE.
...
Further arguments to be passed to the functions specified in estimate

Value

An object of class brmsVarCorr, which is a list of lists (one per grouping factor), each containing 3 elements: a matrix containing the standard deviations, a list of correlation matrices, and a list of covariance matrices. 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 = "poisson", chains = 1)
# ## return the means of random effects covariances
# (vc <- VarCorr(fit))
# as.data.frame(vc)
# 
# ## return 2.5% and 97.5% quantiles of random effects covariances
# VarCorr(fit, estimate = "quantile", probs = c(0.025, 0.975))
# ## End(Not run)

Run the code above in your browser using DataLab