Multivariate version of known distributions

Hello, I see that for most univariate distributions in the Stan library there is no corresponding multivariate version.
I wanted to ask what is the typical approach when one needs the multivariate version of a common distribution when not available. Custom implementation (when possible), or maybe some clever trick as workaround that can be used generally.

thanks

Right—we only have Student-t and normal multivariate instances. The idea’s the same for everything. If you have a location-scale family, then you can draw independent standard variates from it then push them through a scaling and translation.

For example, to go from standard normal to multivariate normal, you can do this:


parameters {
  vector[N] y_std;
}
transformed parameters {
  vector[N] y = mu + L_Sigma * y_std;
}
model {
  y_std ~ normal(0, 1);
}

The variable y_std has a standard normal distribution and y has a normal(mu, Sigma) distribution, where L_Sigma is the Cholesky decomposition of Sigma.

This trick works for any distribution and conveniently gives you a non-centered parameterization over y. If you replace the univariate normal with a univariate standard-t, you get the multivariate Student-t. You can do the same with logistic or other distributions.

I’m not exactly sure how things like multivariate lognormal, etc. are defined. I think they’re first scaled and translated, then transformed with exp, but you should look that up.

1 Like