Covariance matrix with more hierarchy levels

Dear all,

I’ve tried to find examples online for my question, but couldn’t find any. I was wondering whether you could maybe point me in the right direction?

I am trying to fit a hierarchical model with several hierarchical levels. I am trying to figure out how to include correlation/covariance matrices in the hierarchy.

My hierarchy is as follows: Group (1) -> Subject (6) -> Session (5 per subject)-> Measurements per session (~150 per session). The measurements (1 or 0) at the session level are fed into a logistic regression with 4 regressors.

An easier example would be where I only have group level and sessions in the hierarchy.
In this case I would use correlation/covariance matrices of size number of regressors (i.e. 4x4) [ as in the stan manual in the section 6.12 on multivariate priors for hierarchical models].

Now, how to add an additional level in the hierarchy?
I’ve considered having a covar/corr matrix at the highest level of size 4 x4. And then to have additionally covar/corr matrices for each subject of size 4x4 (i.e. that describe correlations within each subject across sessions. However, I don’t know how the link up the matrices at these two levels.

I thought about drawing them from a normal distribution, but I don’t think this is right:
corr_matrix[nregs] corrGroup; //correlation matrix at group level
matrix<lower=0>[nregs,nregs] corrSigma; // standard deviation for each correlation to go from group to individual subject
corr_matrix[nregs] corrSub[nsub]; // correlation matrix for each individual subject

transformed parameters {
-> go from correlation matrix to covariance

model {
corrGroup ~ lkj_corr(2);
for (isub in 1:nsub){
for (ireg in 1:nregs){
for (jreg in (ireg+1):nregs){
corrSub[isub,ireg,jreg] ~ normal(corrGroup[ireg],corrSigma[ireg,jreg]);}}}

No one really knows. Convex combination of correlation matrices is probably easiest

thank you so much for the link, that’s very useful!

I’ve been trying to look this up, but I’m not quite sure - how does lme4 cope with this kind of covariance structure? does it also do a mixture of a global and a local one?

lme4 only has one covariance matrix