# Joint Probability with von Mises

Hello,

similarly to a Mixture Model of Gaussians with joint probability for Clustering/Classification, I am trying to find a Mixture Model with joint probability but with von Mises distribution.
I have two input data sets which together describe a point, so I guess I have to use a bivariate von Mises distribution, but there is no such ‘multivariate’ function implemented in stan. Nevertheless, is there a way to implement something like this?

Right now I have code inspired from my tests programming with a Gaussian distribution and for only one data set

``````data {
int         K;  // number classes
int         N;  // number of all data points
vector[N] y;
}

parameters{
vector [K] mu;
vector<lower=0, upper=90>[K]  kappa;
simplex [K] weights;
}

model{
for (n in 1:N) {
vector [K] pb;
for (k in 1:K) {
pb[k] = log(weights[k]) + von_mises_lpdf(y[n] | mu[k], kappa[k]);
}
target += log_sum_exp (pb);
}
}
``````

I believe I also then have an array of vectors for my two input data sets

``````vector[2] y[N];
``````

Does anyone have an idea how to realise this?

If you can write down the bivariate von mises distribution, you’ll be able to do it. All you would have to do is write a new distribution function inside the `functions` block.

Looking at the wikipedia article for the bivariate von mises distribution, it doesn’t have the distribution in closed form. If you can write out that `Z` term, it should work ok.