Hi,

My objective is to find latent classes in my longitudinal data. My data has a hierarchical structure. this is the data set description.

ID, lesion ID (each patient can have multiple lesions), days ( baseline, day2, day 14, d21) and the longitudinal outcome. I was initially using LCMM but it doesn’t account for the hierarchical structure in the data. Can I use brms for my problem ? This is my mixed model

model2 ← lmer(lktrans ~ days + (1 | ID) + (1| ID :lesid), data = data).

Please could someone help me with this issue ?

Please share your Stan program and accompanying data if possible.

When including Stan code in your post it really helps if you make it as readable as possible by using Stan code chunks (```stan) with clear spacing and indentation. For example, use

```
model {
vector[N] mu = alpha + beta * x;
y ~ normal(mu, sigma);
}
```

instead of

model{

vector[N] mu = alpha+beta*x;

y~normal(mu,sigma);

}

To include mathematical notation in your post put LaTeX syntax between two `$`

symbols, e.g.,

p(\theta | y) \propto p(\theta) p(y | \theta).

Don’t forget to add relevant tags to your topic (top right of this form) for application area and/or class of models you work with.