Stan_lmer covariance prior usage


Hi Stan folk,

I have a question about the covariance prior in stanarm. I’m running the following model: stan_lmer(Y~K+(1|Subject)), where Y is continuous, K represents up to 20 discrete, independent treatment groups that I’m screening, and Subject represents the fact that I test the treatment on multiple subjects. I want to find coefficients for each group as part of a screening study to figure out which Ks will give me the lowest Y values on the population, and then expand my study to get more data on the most promising K candidates. I think I have this running pretty well, and as far as I can tell the default priors seem to be working reasonably well. However, in reality, the K’s are not actually independent: each K consists of a combination of 5 or so design choices covering a relatively large space. It might be cumbersome to model this space explicitly, especially since some of these factors are probably non-linear, and my dataset is small. However, I do have scientific intuitions about what some of the relationships will be, for example I believe that K1 is likely to be more “similar” to K8 than it is to K3. Is there a way to express these intuitions in the covariance prior to potentially improve my estimates? Do you know off hand if this can done within stan_lmer or does this kind of thing require full-on stan?


This requires writing a model in the Stan language. The prior on the (co)variance matrix does not even come into play here, as it is only estimating the standard deviation in the intercepts across subjects. The only choices for the prior on the shifts by level of K entail independence across levels, although you can specify the QR = TRUE argument to make this more plausible.