VarCorr.brmcoda: Extract Variance and Correlation Components

View source: R/posterior.R

VarCorr.brmcodaR Documentation

Extract Variance and Correlation Components

Description

Calculates the estimated standard deviations, correlations and covariances of the group-level terms of the brmsfit object in a brmcoda object.

Usage

## S3 method for class 'brmcoda'
VarCorr(x, ...)

Arguments

x

An object of class brmcoda.

...

Further arguments passed to VarCorr.brmsfit.

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 diagonal.

See Also

VarCorr.brmsfit

Examples


## fit a model
if(requireNamespace("cmdstanr")){
  m <- brmcoda(complr = complr(data = mcompd, sbp = sbp,
                               parts = c("TST", "WAKE", "MVPA", "LPA", "SB"),
                               idvar = "ID", total = 1440),
  formula = Stress ~ bilr1 + bilr2 + bilr3 + bilr4 +
    wilr1 + wilr2 + wilr3 + wilr4 + (1 | ID),
  chain = 1, iter = 500,
  backend = "cmdstanr")
  
  VarCorr(m)
}

florale/multilevelcoda documentation built on April 21, 2024, 9:44 a.m.