I’m working on a gaussian multivariate model with four response variables and one categorical variable as a explanatory variable. My interest here are the correlations between the response variables per each level of the Treatment variable. For example:
cor1: Y1-Trt1 X Y2-Trt1,
cor2: Y1-Trt2 X Y2-Trt2
I use a grouping structure of gr(site:plot, by = “Treatment”, id = “V”, cor = TRUE). So a nested random effect correlated between the response variables with a separate variance-covariance matrix for each level (three levels) of Treatment variable.
f.1 <- bf(y1 ~ 1 + Trt + gr(site:plot, by = "Trt", id = "V", cor = TRUE))
f.2 <- bf(y2 ~ 1 + Trt + gr(site:plot, by = "Trt", id = "V", cor = TRUE))
f.3 <- bf(y3 ~ 1 + Trt + gr(site:plot, by = "Trt", id = "V", cor = TRUE))
f.4 <- bf(y4 ~ 1 + Trt + gr(site:plot, by = "Trt", id = "V", cor = TRUE))
What I get from this definition is:
cor: y1_Intercept:"Trt"Trt,y2_Intercept:"Trt"Trt)
cor: y1_Intercept:"Trt"Trt,y3_Intercept:"Trt"Trt)
cor: y2_Intercept:"Trt"Trt,y3_Intercept:"Trt"Trt)
cor: y1_Intercept:"Trt"Trt,y4_Intercept:"Trt"Trt)
cor: y2_Intercept:"Trt"Trt,y4_Intercept:"Trt"Trt)
cor: y3_Intercept:"Trt"Trt,y4_Intercept:"Trt"Trt)
The estimates for each of these correlations correspond to grouping
gr(site:plot, id = "V", cor = TRUE))
.
So this is probably not the way to get these correlations i’m looking for…? What would be the proper way to do this?