I have a suggestion for the manual for the section about von Mises distributions.

Ignore me if you think this is obvious or worse, it is already in the documentation. Maybe this will save someone some pain.

------ Suggestion: ------------

You may be using a von Mises distribution or perhaps a joint probability that includes it. There are two reasons it may end in tears.

Firstly there is a modified bessel function lurking there, which is likely to explode if kappa is large (more than around 100).

â€¦ here the existing section on using the approximation to a gaussian for large kappaâ€¦

Secondly, `von_mises_lpdf()`

works as advertised, but there is a potential problem with the formulation and stanâ€™s idea of gradient driven search. If you have a line like

```
parameters {
real <lower = 0, upper = 2 * pi()> mu;
}
```

then it is possible for the gradient to send stan towards zero or 2 $pi$. This leads to stan pushing against the wall you have built and rejecting moves. This can be avoided by saying

```
parameters {
unit_vector [2] mu_vec;
}
```

and add a section

```
transformed parameters {
real mu = atan2 (mu_vec[2], mu_vec[1]);
}
```

and in your model section, just use mu as you naively would

```
model {
... other stuff ...
mu ~ von_mises (3, 0.5); // a relatively flat prior
y ~ von_mises (mu, kappa);
}
```

Now, when stan pushes mu, there is no limit. The derivative acting on mu pushes the unit vector and it painlessly wraps.