-
Notifications
You must be signed in to change notification settings - Fork 18
Home
Welcome to the pylevy wiki!
Here I will put some details of the implementation of the Lévy function.
They are four:
- alpha: regulates how heavy is the tail; range: (0, 2].
- beta: regulates how asymmetric is the variable; range: [-1, 1]
- mu: regulates where is the centre of the distribution; range: (-\infty, \infty)
- sigma: regulates how wide is the bulk of the distribution; range: (0, \infty)
Internally, the program uses the 0 parametrization (see Nolan); however, parameters in parametrization 1 can be given by specifying par=1 in the functions; note that the only parameter that changes is mu.
The random number generation of Lévy-stable variables is the easiest part of them, since there is an exact method to do it; this is implemented here, as well as in the scipy library.
This is the hard part. In principle they can be calculated by taking the Fourier transform of the analytical expression of the Lévy-stable characteristic function; this means that each pdf(x) we want to compute require an integration (which is implemented in _calculate_levy). This is highly impractical, hence what we do is to build a lookup table for many values of alpha and beta, and the required pdf is interpolated from them. However, we know that there is an approximation for the tails (see Zolotarev), which we also implement here. In fact, the program will compute the interpolation before a certain limit, after which will compute the approximation. This results in a small 'bump' in the pdf/cdf, however its effect is minimal in the maximum likelihood, which is the important application of it.