# Sigma vs. Residuals in stan\_glmer output?

**URL:** <https://discourse.mc-stan.org/t/sigma-vs-residuals-in-stan-glmer-output/24987>\
**Category:** Modeling\
**Tags:** hierarchical-model\
**Created:** [October 25, 2021, 9:15pm UTC](https://discourse.mc-stan.org/t/sigma-vs-residuals-in-stan-glmer-output/24987 "2021-10-25T21:15:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertvoogdgeert](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/robertvoogdgeert/32/7794_2.png) [@robertvoogdgeert](https://discourse.mc-stan.org/u/robertvoogdgeert)\
**Post date:** [October 25, 2021, 9:15pm UTC](https://discourse.mc-stan.org/t/sigma-vs-residuals-in-stan-glmer-output/24987/1 "2021-10-25T21:15:07Z")

</div>

In the print() output of a multi-level model

```
stan_glmer
 family: gaussian [identity]
 formula: ec ~ g + (g | chr)
 observations: 608
------
            Median MAD_SD
(Intercept) 51.434 0.777
gv 3.136 0.813

Auxiliary parameter(s):
      Median MAD_SD
sigma 5.499 0.159 

Error terms:
 Groups Name Std.Dev. Corr 
 chr (Intercept) 1.772         
          gv 1.746 -0.34
 Residual 5.503         
Num. levels: chr 5 

```

I have the \sigma^2\_y of 5.503 as the Residuals and the \sigma^2\_\alpha and \sigma^2\_\beta, all given under _Error terms_. This _sigma_ though is slightly different here, 5.499 but in some other models it is the same, to at least the third or fourth decimal.

In [this tutorial](https://mc-stan.org/users/documentation/case-studies/tutorial_rstanarm.html#model-2-adding-a-student-level-predictor) the difference between residuals en sigma is not explained.

Could somebody explain the difference between the two?

---

<div class="post-metadata">

**Author:** ![robertvoogdgeert](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/robertvoogdgeert/32/7794_2.png) [@robertvoogdgeert](https://discourse.mc-stan.org/u/robertvoogdgeert)\
**Post date:** [October 26, 2021, 2:30pm UTC](https://discourse.mc-stan.org/t/sigma-vs-residuals-in-stan-glmer-output/24987/2 "2021-10-26T14:30:49Z")

</div>

When using the summary function one gets the mean of _sigma_, the print() function though, gives the _median_ of _sigma_. So this will probably explain the difference.

It is strange that, under the _Error terms_ the mean of the _Residuals_ are given, with the median of the same parameter, as _sigma_, under _Auxiliary parameters_.

Normally, with print() one gets the median values of parameters, with summary() the means. With a multi-level model, it seems both are used.
