Background: I’m trying to figure out how to do a mixed parameterisation (as per @betanalpha 's excellent course & case studies) but where effects are correlated across responses.
Simpler problem: I’m wondering what actually defines the centered vs non-centered parameterisations - is it the existence of the parameter, or the positioning of the prior?
e.g.
theta = mu + tau * theta_tilde;
mu ~ normal(0, 5);
tau ~ normal(0, 5);
theta_tilde ~ normal(0, 1);
vs
theta = mu + tau * theta_tilde;
mu ~ normal(0, 5);
tau ~ normal(0, 5);
theta ~ normal(mu, tau);
Is #2 enough to define it as centered, or is the existence of an unconstrained theta_tilde
enough to define it as non-centered?
If #2 is centered, I could correlate levels across responses with a mixed parameterisation, something like this (not tested, so please excuse what may amount to a whole lot of rubbish)!
data {
...
int<lower=1> M; // Number of responses;
int<lower=1> K; // Number of levels
int<lower=0, upper=K> K_cp; // Number of levels for centered parameterisation
int<lower=1, upper=K> cp_idx[K_cp]; Index for cp levels
int<lower=0, upper=K> K_ncp; // Number of levels for non-centered parameterisation
int<lower=1, upper=K> ncp_idx[K_ncp]; // Index for ncp levels
}
parameters {
...
cholesky_factor_corr[M] L_u; // Correlation matrix amongst responses
matrix[M, K] z_u; // Matrix of levels, standardised for the ncp & non-standardised for the cp levels.
vector<lower=0>[M] tau;
}
transformed parameters {
...
matrix[M, K] theta;
theta[1:M, ncp_idx] = diag_pre_multiply(tau, L_u) * z_u[1:M, ncp_idx];
theta[1:M, cp_idx] = L_u * z_u[1:M, cp_idx];
}
model {
// Let's assume mu = 0;
tau ~ normal(0, 5);
L_u ~ lkj_corr_cholesky(1.0);
to_vector(z_u[1:M, ncp_idx]) ~ std_normal();
to_vector(theta[1:M, cp_idx]) ~ normal(0, tau);
...
}
Thoughts/comments welcome, but please be gentle!