**Status, 10 May 2016: I have not updated this package for many years, but José María Miotto has recently made some improvements to it. José's version is available on github.**

PyLevy is a Python package for working with Levy alpha-stable distributions. PyLevy can:

- Quickly calculate probability density function and cumulative density function for alpha-stable distributions, based on cubic spline interpolation from a pre-calculated table. The interpolation is smooth along all axes (x, alpha, beta), making it suitable for use with numerical optimization techniques that estimate gradient and curvature.

- Fit an alpha-stable distribution to data, using the Maximum Likelihood method.

- Generate alpha-stable distributed random numbers.

Caveat: PyLevy will not calculate alpha-stable distributions with alpha less than 0.5.

I wrote this package as a tool to help investigate my theory of autism. However Levy stable distributions may be expected to crop up in all sorts of places. Anywhere you currently use Gaussian statistics or least-squares modelling you should consider using this robust family of distributions instead.

## Parameterization notes

PyLevy uses the standard S(alpha,beta;0) parameterization.

Alpha is the tail thickness parameter -- the tails fall off as x^{ -(alpha+1)} [1]. This can range from 0.0 to 2.0, but PyLevy can only calculate distributions in the range 0.5 to 2.0. Alpha=2.0 is the Gaussian distribution. Alpha=1.0 is the Cauchy distribution. In general, the higher the alpha value the thinner the tails of the distribution.

Beta is the skewness parameter, and can range from -1.0 to 1.0. Beta=0.0 yields a symmetric distribution. Beta=1.0 yields a distribution with a very thin right hand tail. Beta=-1.0 yields a distribution with a very thin left hand tail.

[1] With the exception of alpha=2.0, where they fall off as e^{ -x2}. Also, for alpha close to 2.0 this tail behaviour only manifests far out along the distribution.

## Significance

Ideally PyLevy would provide error bounds and significance estimates. It does not currently do this. For estimating significance I would suggest some form of numerical simulation, e.g. using PyLevy's random number generator.

Jiří Baum sent me these preliminary results for Gaussian distributed random values.

## Download

PyLevy requires numpy and scipy. PyLevy is distributed under the GPL.

If for some bizarre reason you are still using Numeric, try this version:

## See also

- John Nolan's page on stable distributions: good set of introductory papers, plus "free as in beer" Windows utilities to do much the same things as PyLevy.