# Repeated measures ordinal model with brms - how to specify correlation structure

I’m looking at fitting a repeated measures ordinal model using `brms` and want to allow for a reasonably flexible correlation of the outcomes within a subject over time. The outcome is a 7 point scale assessed on several days. You would probably expect the outcomes on two days to be more closely related if the days are close to each other in time and less so if they are further apart, the amount of between-subject variation may change over time (e.g. perhaps similar initially, but may diverge) and it’s kind of hard to guess how correlation declines over time (might be faster, might be slower, may tend towards a plateau - but certainly not something like AR§).

This code would specify a model where all observations within a subject have the same correlation and the same variance for the underlying latent random effect:

``````brm(data=modeldata,
formula= outcome ~ 1 + day + (1 | subject) ,  #outcome is a factor, day is a factor
family = cumulative(link = "logit", threshold = "flexible"),
prior = c(set_prior(prior = "normal(0,10)", class = "Intercept"),
set_prior(prior = "normal(0,5)", class = "b"),
set_prior(prior = "normal(0,5)", class = "sd"))
``````

What are reasonable options for specifying something that is very flexible (there should be a good amount of data and weakly informative priors would also be fine - there’s probably some plausible limits to what parameters could be - so too complex a model is probably not even too much of a concern).

One option I’m aware of would be the below, but if I understand correctly you cannot easily go beyond ARMA(1,1) for non-Gaussian models?

``````brm(data=modeldata,
formula= outcome ~ 1 + day + arma(p=1, q=1, time=day, gr=subject),
family = cumulative(link = "logit", threshold = "flexible"),
prior = c(set_prior(prior = "normal(0,10)", class = "Intercept"),
set_prior(prior = "normal(0,5)", class = "b"),
set_prior(prior = "normal(0,5)", class = "sd"))
``````

I wonder whether I can somehow specify an LKJ prior. I am trying to sort out for myself whether adding `(1+day|patient)` and `set_prior("lkj(2)", class = "cor")` woudl achieve something like that, but am getting myself a bit confused right now. Any help on what the logical options might be and what issues/limitations might be would be appreciated. Or should I be looking beyond brms and write my own stan code for this one?

In case it matters, I’d be primarily using brms 2.10.0 on Redhat Enterprise Linux.

`(1+day|patient)` could be a sensible way to model varying effects of days and model the correlations of these effects. Is days supposed to be continuous or categorical?