Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
data{
int<lower=0> N;
vector[3] X[N];
}
parameters{
vector[3] mu;
real<lower=0> sig[3];
real<lower=-1,upper=1> rho;
}
transformed parameters{
cov_matrix[3] Sigma;
Sigma[1,1] = sig[1]*sig[1];
Sigma[2,2] = sig[2]*sig[2];
Sigma[3,3] = sig[3]*sig[3];
Sigma[1,2] = sig[1]*sig[2]*rho;
Sigma[1,3] = sig[1]*sig[3]*rho;
Sigma[2,3] = sig[2]*sig[3]*rho;
Sigma[2,1] = Sigma[1,2];
Sigma[3,1] = Sigma[1,3];
Sigma[3,2] = Sigma[2,3];
}
model{
X ~ multi_normal(mu,Sigma);
mu ~ normal(60,100);
rho ~ uniform(-1,1);
sig ~ cauchy(0,2.5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment