# Documentation - multi_normal_cholesky_lpdf

Dear STAN Community,

I am trying to understand this tutorial on multivariate GMM in STAN for which the code can be seen below.

Where can I read a documentation about `multi_normal_cholesky_lpdf` ? Or what it does exactly ?

I did a Google search on “`multi_normal_cholesky_lpdf`”, but I only got STAN source code as result :) . I cannot really read very well C++ :(

Is there some way to figure out what “`multi_normal_cholesky_lpdf`” means ?

Regards,

Jozsef

``````data {
int D; //number of dimensions
int K; //number of gaussians
int N; //number of data
vector[D] y[N]; //data
}

parameters {
simplex[K] theta; //mixing proportions
ordered[D] mu[K]; //mixture component means
cholesky_factor_corr[D] L[K]; //cholesky factor of covariance
}

model {
real ps[K];

for(k in 1:K){
mu[k] ~ normal(0,3);
L[k] ~ lkj_corr_cholesky(4);
}

for (n in 1:N){
for (k in 1:K){
ps[k] = log(theta[k])+multi_normal_cholesky_lpdf(y[n] | mu[k], L[k]); //increment log probability of the gaussian
}
target += log_sum_exp(ps);
}

}

``````

Many thanks @jjramsey ! This is a life saver !

OTOH

I am reading the ScalaStan source code and it is almost the best documentation I found so far :)

I often turn to mc-stan.org/math as a first reference for the Stan language. I think the presentation is often more direct to the code that what is found in the documentation.

Here’s the entry for the mnc_ldpf: http://mc-stan.org/math/d4/d84/namespacestan_1_1math.html#a01a389356ff3fe918b7add26367c87c2

This happens to be a particularly good example as it even includes a citation omitted from the function documentation.

Thanks for the tip @increasechief !

Is it possible to directly “test drive” these functions ?

Without any sampling or anything ?

Just put some numbers into them and calculate/plot what they output ?

Without writing a custom C++ code for that ? (I don’t feel like learning C++ :( - so that I can understand / debug Stan code / functions.)

For example, if I create a likelihood function in Stan, is it possible to “plot it” (as a function of it’s parameters) ? Say using R ?

Cheers,

Jozsef