I am trying to define sine-skewed von mises distribution(SSVM).
SSVM was not implemented in scipy.stats
so I have to write it by my self.
Most of the random
methods in pymc3 seem to be using scipy.stats.rvs
or inverse transform sampling.
Is it ok to implement custom _random
method with reject sampling?
(the cumulative density function of SSVM looks too complicated for inverse transform sampling…)
If it’s ok, how can I include it properly in custom density distribution?
Sine-skewed von mises distribution(SSVM)
Reference : Characterization of Sine- Skewed von Mises Distribution
1.Probability density function
f(\theta)=(1+\lambda\sin(\theta-\mu)) \frac{1}{2\pi I_{0}(\kappa)}\exp(\kappa \cos(\theta - \mu))
where \lambda is skewness(|\lambda| \leq 1), \mu is the mean(|\mu| \leq \pi),
\kappa is the concentration(0 \leq \kappa), I_{0} is the modified Bessel function of order zero.
2.Cumulative density function
F(\theta) = \frac{1}{2\pi} \left[ (\pi + \theta -\mu) + \
2\sum_{j=1}^{\infty} \frac{I_j(\kappa)}{j} \sin(j(\theta-\mu)) \right] + \
\frac{\lambda}{2\pi I_0(\kappa)}(\exp^{-\kappa} - \exp^{\kappa\cos(\theta-\mu)})
where
I_j(\kappa) = \left( \frac{\kappa}{2} \right)^j \sum_{i=0}^{\infty} \
\left[ \left( \frac{\kappa}{2} \right)^{2i} \left( \frac{1}{i!(j+1)} \right) \right]
Simple rejection sampling works well.