Hi,
I would be interested in modelling the covariance matrix of the fixed effects. So far, I’ve been able to model the correlation matrix of the random effects and used the Cholesky factorization to do so. I would like to do something similar for the covariance matrix of the fixed effects. And what kind of priors should I use. Any help would be greatly appreciated! Here is the code:
parameters{
vector[5] beta;//Fixed-effects when no moderation
// vector[9] beta;// Fixed-effects when moderation
real<lower=0> sigma_em; // Residual std (Mediator)
real<lower=0> sigma_ey; // Residual std (Outcome)
vector<lower=0>[5] sigma_u; // Random effects' standard deviations when no moderation
//vector<lower=0>[9] sigma_u; // Random effects' standard deviations when moderation
cholesky_factor_corr[5] L_u;//Declare L_u to be the Choleski factor of a 5X5 correlation matrix (no moderation)
//cholesky_factor_corr[9] L_u;//Declare L_u to be the Choleski factor of a 9X9 correlation matrix (moderation)
matrix[5,J] z_u; // Random effects' matrix (no moderation)
//matrix[9,J] z_u; // Random effects' matrix (moderation)
}
/*Transformed Parameter Block:
Transforms of the parameters before computing the likelihood*/
transformed parameters {
matrix[5,J] u; //no moderation
//matrix[9,J] u; //moderation
/*The Cholesky factor is first multipled by the diagonal matrix formed
by the vector of the random effect variances "sigma_u",
and then is multiplied with the random effects' matrix "z_u",
to obtain a random effects' matrix with the intended correlations.*/
u = diag_pre_multiply(sigma_u, L_u) * z_u;
}
}