# Random slopes correlations parameters

Hi!
I am running a model with a maximal random slopes structure:

``````DF <- data.frame(
Subj  = rep(LETTERS[1:25],each = 8),
A  = as.factor(rep(c(1,0,1,0), times= 50)),
B  = as.factor(rep(c(0,1,1,0),times = 50)),
DV    = rnorm(200)
)

Model <- brm(DV~A*B+(A*B|Subj),
data = DF)
``````

I am looking for the posterior distribution of the random slopes correlation:
cor_Subj__A:B0__A:B1
Which is (and I hope I phrase it correctly) the correlation of the random slopes of var A in each level of var B.

At the moment, the posterior samples I managed to extract are:

names(posterior_samples(Model))
[1] “b_Intercept” “b_A1” “b_B1” “b_A1:B1”
[5] “sd_Subj__Intercept” “sd_Subj__A1” “sd_Subj__B1” “sd_Subj__A1:B1”
[9] “cor_Subj__Intercept__A1” “cor_Subj__Intercept__B1” “cor_Subj__A1__B1” “cor_Subj__Intercept__A1:B1”
[13] “cor_Subj__A1__A1:B1” “cor_Subj__B1__A1:B1” “sigma” “r_Subj[A,Intercept]”
[17] “r_Subj[B,Intercept]” “r_Subj[C,Intercept]” “r_Subj[D,Intercept]” “r_Subj[E,Intercept]”
[21] “r_Subj[F,Intercept]” “r_Subj[G,Intercept]” “r_Subj[H,Intercept]” “r_Subj[I,Intercept]”
[25] “r_Subj[J,Intercept]” “r_Subj[K,Intercept]” “r_Subj[L,Intercept]” “r_Subj[M,Intercept]”
[29] “r_Subj[N,Intercept]” “r_Subj[O,Intercept]” “r_Subj[P,Intercept]” “r_Subj[Q,Intercept]”
[33] “r_Subj[R,Intercept]” “r_Subj[S,Intercept]” “r_Subj[T,Intercept]” “r_Subj[U,Intercept]”
[37] “r_Subj[V,Intercept]” “r_Subj[W,Intercept]” “r_Subj[X,Intercept]” “r_Subj[Y,Intercept]”
[41] “r_Subj[A,A1]” “r_Subj[B,A1]” “r_Subj[C,A1]” “r_Subj[D,A1]”
[45] “r_Subj[E,A1]” “r_Subj[F,A1]” “r_Subj[G,A1]” “r_Subj[H,A1]”
[49] “r_Subj[I,A1]” “r_Subj[J,A1]” “r_Subj[K,A1]” “r_Subj[L,A1]”
[53] “r_Subj[M,A1]” “r_Subj[N,A1]” “r_Subj[O,A1]” “r_Subj[P,A1]”
[57] “r_Subj[Q,A1]” “r_Subj[R,A1]” “r_Subj[S,A1]” “r_Subj[T,A1]”
[61] “r_Subj[U,A1]” “r_Subj[V,A1]” “r_Subj[W,A1]” “r_Subj[X,A1]”
[65] “r_Subj[Y,A1]” “r_Subj[A,B1]” “r_Subj[B,B1]” “r_Subj[C,B1]”
[69] “r_Subj[D,B1]” “r_Subj[E,B1]” “r_Subj[F,B1]” “r_Subj[G,B1]”
[73] “r_Subj[H,B1]” “r_Subj[I,B1]” “r_Subj[J,B1]” “r_Subj[K,B1]”
[77] “r_Subj[L,B1]” “r_Subj[M,B1]” “r_Subj[N,B1]” “r_Subj[O,B1]”
[81] “r_Subj[P,B1]” “r_Subj[Q,B1]” “r_Subj[R,B1]” “r_Subj[S,B1]”
[85] “r_Subj[T,B1]” “r_Subj[U,B1]” “r_Subj[V,B1]” “r_Subj[W,B1]”
[89] “r_Subj[X,B1]” “r_Subj[Y,B1]” “r_Subj[A,A1:B1]” “r_Subj[B,A1:B1]”
[93] “r_Subj[C,A1:B1]” “r_Subj[D,A1:B1]” “r_Subj[E,A1:B1]” “r_Subj[F,A1:B1]”
[97] “r_Subj[G,A1:B1]” “r_Subj[H,A1:B1]” “r_Subj[I,A1:B1]” “r_Subj[J,A1:B1]”
[101] “r_Subj[K,A1:B1]” “r_Subj[L,A1:B1]” “r_Subj[M,A1:B1]” “r_Subj[N,A1:B1]”
[105] “r_Subj[O,A1:B1]” “r_Subj[P,A1:B1]” “r_Subj[Q,A1:B1]” “r_Subj[R,A1:B1]”
[109] “r_Subj[S,A1:B1]” “r_Subj[T,A1:B1]” “r_Subj[U,A1:B1]” “r_Subj[V,A1:B1]”
[113] “r_Subj[W,A1:B1]” “r_Subj[X,A1:B1]” “r_Subj[Y,A1:B1]” “lp__”

Any ideas how to get the correlation of my interest?

Thanks!

I think you might want:

`Model <- brm(DV~A*B + (1|Subj) + (0 + A:B|Subj), data = DF)`

I will try this one. Thanks!