Non-centred parameterisation for multivatiate normal


Any Ideas how I can apply an non-centred parameterization for my multi_norm?
I haven’t assigned a prior to the covariance matrix directly as I am mainly interested in monotoring the correlation parameter rho1 and the standard deviations sigma.
I tried to do it as the users guide suggests but it didn’t work probably I am missing something.

int<lower = 0> Ns;
int<lower = 0> N[Ns];
int<lower = 0> r1A[Ns];
int<lower = 0> r1B[Ns];
int<lower = 0> r2A[Ns];
int<lower = 0> r2B[Ns];

real<lower = -1, upper = 1> rho1;
vector[2] d;
vector<lower = 0>[2] sigma;
real mu1[Ns];
real mu2[Ns];
vector[2] delta[Ns];}

transformed parameters{
matrix[2,2] Sigma;
Sigma[1, 1] = sigma[1]^2;
Sigma[1, 2] = sigma[1]*sigma[2]*rho1;
Sigma[2, 1] = sigma[1]*sigma[2]*rho1;
Sigma[2, 2] = sigma[2]^2;

d         ~ normal(0, 10);
sigma     ~ cauchy(0, 2.5);
mu1       ~ normal(0, 10);
mu2       ~ normal(0, 10);
for (i in 1:Ns){
delta[i] ~ multi_normal(d,Sigma);
r1A[i]   ~ binomial_logit(N[i], mu1[i]);
r1B[i]   ~ binomial_logit(N[i], mu1[i]+delta[i,1]);
r2A[i]   ~ binomial_logit(N[i], mu2[i]);
r2B[i]   ~ binomial_logit(N[i], mu2[i]+delta[i,2]);

Many thanks


@T_nick the Cholesky factorization is the non-centered parameterization for a multivariate normal distribution.

This applies both for multivariate outcomes and multivariate priors on varying slopes- see both those sections under the regression header of the user’s guide.

it’s not clear to me what your code is attempting to do- so that’s the best I can offer.