In the multivariate normal case, we have
mu + L * z
where mu
is the mean vector, L
is the cholesky factor of the covariance matrix and z
are independent standard normal variables. My question is how to correctly incorporate the degrees of freedom parameter nu
into the above formula to create multivariate-t random variables? I remember having seens this somewhere already, but I can’t find it right now…
https://groups.google.com/d/msg/stan-users/nk03n8hX4Us/-pTN5IGjCQAJ
One may optimize it using the inv_chi_square and turn the division in a multiplication.
3 Likes
Thanks, that’s what I was looking for! :-)
T_nick
March 14, 2019, 11:33pm
4
Hello @paul.buerkner @andre.pfeuffer ,
The parameterization: mu+L*z you mentioned for the multivariate normal is valid when the covariance matrix is known (defined in the data block).
Is there any difference when the covariance matrix is unknown (defined in the parameters block)?
Thanks a lot.
T_nick
March 15, 2019, 9:04am
6
I think it’s a bit more complicated in my case. I’ll create a new topic.
Could somebody re-post the solution at the end of this thread?
The link to the google group seems to no longer be valid.
data {
int<lower=1> p;
vector[p] mu;
cholesky_factor_cov[p,p] L;
real<lower=0> nu;
}
parameters {
vector[p] z;
real<lower=0> u;
}
transformed parameters {
vector[p] x;
x = mu + sqrt(nu / u) * (L * z); // distributed multi_student_t
}
model {
target += normal_lpdf(z | 0, 1);
target += chi_square_lpdf(u | nu);
}
3 Likes