-
Notifications
You must be signed in to change notification settings - Fork 0
/
VarCorr.brmsfit.Rmd
44 lines (34 loc) · 1.72 KB
/
VarCorr.brmsfit.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: "``brms::VarCorr.brmsfit``"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(brms)
```
## ``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
<pre><code>
## S3 method for class 'brmsfit'
VarCorr(x, sigma = 1, summary = TRUE,
robust = FALSE, probs = c(0.025, 0.975), ...)
</code></pre>
#### 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 rawvalues? 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.
* ``...`` : Currently ignored.
#### 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.
#### Examples
```{r}
fit <- brm(count ~ log_Age_c + log_Base4_c * Trt_c + (1+Trt_c|visit),
data = epilepsy, family = gaussian(), chains = 2)
VarCorr(fit)
```
#### Author(s)
Paul-Christian Buerkner <[email protected]>