[ANN] StableDistributions.jl: stable distributions in Julia

I am happy to announce that Julia now has a feature-complete stable distributions package (see Wikipedia) StableDistributions.jl. This class of distributions is crucially important when dealing with data exhibiting heavy, power law tails. These tools were already available in NumPy, Matlab and R, now they are also in Julia.

This package fully complies with Distributions.jl interface:

  • distribution variables have Stable <: Distribution,
  • for generation there is rand,
  • you can fit data with fit, which uses ecf fitting technique, this is considered to be the best contemporary method next maximum likelihood estimation (which is much, much more computationally demanding),
  • for moments mean, 'var`, etc. (these are often infinite for this class),
  • probability density pdf, similarly cdf, mgf, cf, quantile, etc,
  • affine transformations of stable distributions are available, you can multiply them and add constants,
  • two stable distribution with the same stability index can be convolved with convolve.

This started as a PR to add those features to Distributions.jl, but there was no response, it seems the maintainers are too busy. Merging it in the future would be a good idea, but the package still would have raison d’être, as there are some advanced features which should be tried out elsewhere before possibly moving them to Distributions.

In the future adding the maximum likelihood estimation and some classes of multivariate stable distributions (mainly elliptic and discrete measure ones) would be useful.


Many thanks for the effort, much easier to use the new package than the PR.

Encore bravo for the good work.

1 Like

Great stuff! How does it compare with GitHub - org-arl/AlphaStableDistributions.jl: Alpha stable and sub-Gaussian distributions in Julia ?

I see it has less dependencies which is good :slight_smile:

AlphaStableDistributions.jl is a very small package which ports some functionality from arply. It just has 2 methods: rand and fit. Moreover their fit method is McCulloch quantile method, which nowadays should not be used as a primary estimation tool.

This package is much more extensive and was written from scratch using modernised algorithms, mostly from John P. Nolan 2020 book.

What is currently not available here and is there are multivariate elliptic stable distributions (they call them “subgaussian”, this name appears in many places, but is confusing). I know how to implement at least basic elliptic stable functionality, I will add it in few months.


Thanks for the review ! Since I did not like their dependencies too much I actually moved a bit of their code (the only bit that I use) inside my package there The only call to it is on the bottom of this file.

Would you help me translate this to use your package ? I think I simply need to remove this file and change the call to the distribution to match your definitions of the parameters, but i’d like to have your oppinon

Both libraries use Distributions.jl interface, so this is very similar. If I understand it correctly at that line you make stable distributions variable, and somewhere deeper in the code corresponding rand is called. Check if just switching AlphaStable call to

Stable(1/G.θ, 1,cos(π/(2G.θ))^G.θ, (G.θ == 1 ? 1 : 0) )