Group level variance

I am sure this has been covered somewhere, but I have not found the right search term.
I am looking at longitudinal data where the sampling device (MRI scanner) may change over time, with an expectation that newer scanners may have a lower error. It is very easy to model a scanner specific bias, .e.g. (1 | scanner) in rstanarm, but I don’t quite see how to have a scanner specific residual error.

Living in R with programming staff who know even less STAN than I, an rstanarm solution would be great, but any pointer to the answer is appreciated

Terry T

You want a “location-scale” model, which is done in brms formula syntax via:

bf(
  y ~  (1 |z| scanner_id)
  , sigma ~ 1 + (1 |z| scanner_id)
)

(the |z| bit is for letting the model know that a given level of scanner_id has both a location and a scale parameter)

1 Like