I am trying to fit a 2D multivariate mixture of gaussian model where I would like to set the variances of the covariance terms to be equal. Is there a way of explicitly doing that?
Currently I just ask that sigma_1[k] ~ cauchy(0, 5);
mixture_model = '
data {
int D; //number of dimensions
int K; //number of gaussians
int N; //number of data
vector[D] pheno1[N]; //data
}
parameters {
simplex[K] theta; //mixing proportions
vector<lower=0>[D] sigma_1[K];
ordered[D] mu_1[K]; //mixture component means
cholesky_factor_corr[D] L_1[K]; //cholesky factor of covariance
}
model {
real ps[K];
for(k in 1:K){
mu_1[k] ~ normal(0,.5);
sigma_1[k] ~ cauchy(0, 5);
L_1[k] ~ lkj_corr_cholesky(4);
}
for (n in 1:N){
for (k in 1:K){
ps[k] = log(theta[k])+multi_normal_cholesky_lpdf(pheno1[n] | mu_1[k], diag_pre_multiply(sigma_1[k], L_1[k]));
}
target += log_sum_exp(ps);
}
}
generated quantities {
matrix[D,D] Omega[K];
Omega[1] <- multiply_lower_tri_self_transpose(L_1[1]);
Omega[2] <- multiply_lower_tri_self_transpose(L_1[2]);
}
’