Open jtobin opened 9 years ago
In https://github.com/ocramz/sde I have implemented the symmetric Levy stable distribution, which gives the Laplace for alpha==1. Here's my code; the samples "look ok" but I haven't verified the results against known CDFs (apart from the Gaussian special case, alpha==2), so use it with caution.
alphaStable100 :: PrimMonad m => Double -> Prob m Double
alphaStable100 al = do
u0 <- uniform
w <- exponential 1
let u = pi * u0 - 0.5 * pi -- uniform on (-pi/2, pi/2)
t1 = sin (al * u)
t2 = cos u**(-1/al)
t3 = (cos ((al-1) * u) / w)**((1-al)/al)
z = t1 * t2 * t3
case al of 1 -> return $ tan u
_ -> return z
Thanks Marco, I'll take a look in a few days. Currently in Bali ringing in the new year - happy 2017! :smile:
Here's to a smashing new year! All the best from Sweden!
@jtobin Jared, I think the multivariate distributions need a good story for matrix algebra. Do you have any suggestions? I think adding hmatrix as a dependency here would be excessive, though. My own sparse-linear-algebra
is still not ready for prime time, sadly
Currently missing:
Multivariate
Matrix-valued