## Stable Distribution

### Overview

Stable distributions are a class of probability distributions suitable for
modeling heavy tails and skewness. A linear combination of two independent,
identically-distributed stable-distributed random variables has the same
distribution as the individual variables. In other words, if *X*_{1}, *X*_{2}, ..., *X*_{n} are independent and identically distributed stable random
variables, then for every *n*

$${X}_{1}+{X}_{2}+\dots +{X}_{n}\stackrel{d}{=}{c}_{n}X+{d}_{n}$$

where the constant *c*_{n} > 0 and $${d}_{n}\in \mathbb{R}$$.

The stable distribution is an application of the Generalized Central Limit Theorem, which states that the limit of normalized sums of independent identically distributed variables is stable.

Several different parameterizations exist for the stable distribution. The
implementation in Statistics and Machine Learning Toolbox™ uses the parameterization described in [2]. In this case, a random variable *X* has the stable distribution $$S\left(\alpha ,\beta ,\gamma ,\delta ;0\right)$$ if its characteristic function is given by:

$$E\left({e}^{itX}\right)=\{\begin{array}{c}\mathrm{exp}\left(-{\gamma}^{\alpha}{\left|t\right|}^{\alpha}\left[1+i\beta \text{sign}\left(t\right)\mathrm{tan}\frac{\pi \alpha}{2}\left({\left(\gamma \left|t\right|\right)}^{1-\alpha}-1\right)\right]+i\delta t\right)\text{\hspace{1em}}for\text{\hspace{0.17em}}\alpha \ne 1,\\ \mathrm{exp}\left(-\gamma \left|t\right|\left[1+i\beta \text{sign}\left(t\right)\frac{2}{\pi}\mathrm{ln}\left(\gamma \left|t\right|\right)\right]+i\delta t\right)\text{\hspace{1em}}for\text{\hspace{0.17em}}\alpha =1\end{array}$$

### Parameters

The stable distribution uses the following parameters.

Parameter | Description | Support |
---|---|---|

`alpha` | First shape parameter | 0 < α ≤ 2 |

`beta` | Second shape parameter | -1 ≤ β ≤ 1 |

`gam` | Scale parameter | 0 < γ < ∞ |

`delta` | Location parameter | -∞ < δ < ∞ |

The first shape parameter, α, describes the tails of the distribution. The software computes the densities of the stable distribution using the direct integration method. As explained in [1], numerical difficulties exist with accurately computing the pdf and cdf when the α parameter is close to 1 or 0. If α is close to 1 (specifically, $$0<\left|\alpha -1\right|<0.02$$), then the software rounds α to 1. If α is close to 0, then the densities may not be accurate.

The second shape parameter, β, describes the skewness of the distribution. If β = 0, then the distribution is symmetric. If β > 0, then the distribution is right-skewed. If β < 0, then the distribution is left-skewed. When α is small, the skewness of β is significant. As α increases, the effect of β decreases.

### Probability Density Function

#### Definition

Most members of the stable distribution family do not have an explicit probability density function (pdf). Instead, the pdf is described in terms of the characteristic function [2].

Some special cases of the stable distribution, such as the normal, Cauchy, and Lévy distributions, have closed-form density functions. See Relationship to Other Distributions for more information.

Use `pdf`

to calculate the probability
density function for the stable distribution. The software computes the pdf
using the direct integration method. As explained in [1], numerical difficulties exist with accurately computing the pdf when the α
parameter is close to 1 or 0. If α is close to 1 (specifically, $$0<\left|\alpha -1\right|<0.02$$), then the software rounds α to 1. If α is close to 0, then
the densities may not be accurate.

#### Compare pdfs of Stable Distributions

The following plot compares the probability density functions for stable distributions with different `alpha`

values. In each case, `beta = 0`

, `gam = 1`

, and `delta = 0`

.

pd1 = makedist('Stable','alpha',2,'beta',0,'gam',1,'delta',0); pd2 = makedist('Stable','alpha',1,'beta',0,'gam',1,'delta',0); pd3 = makedist('Stable','alpha',0.5,'beta',0,'gam',1,'delta',0);

Calculate the pdf for each distribution.

x = -5:.1:5; pdf1 = pdf(pd1,x); pdf2 = pdf(pd2,x); pdf3 = pdf(pd3,x);

Plot all three pdf functions on the same figure for visual comparison.

figure plot(x,pdf1,'b-'); hold on plot(x,pdf2,'r-.'); plot(x,pdf3,'k--'); title('Compare Alpha Parameters in Stable Distribution PDF Plots') legend('\alpha = 2','\alpha = 1','\alpha = 0.5','Location','northwest') hold off

The plot illustrates the effect of the `alpha`

parameter on the tails of the distribution.

The next plot compares the probability density functions for stable distributions with different `beta`

values. In each case, `alpha = 0.5`

, `gam = 1`

, and `delta = 0`

.

pd1 = makedist('Stable','alpha',0.5,'beta',0,'gam',1,'delta',0); pd2 = makedist('Stable','alpha',0.5,'beta',0.5,'gam',1,'delta',0); pd3 = makedist('Stable','alpha',0.5,'beta',1,'gam',1,'delta',0);

Calculate the pdf for each distribution.

x = -5:.1:5; pdf1 = pdf(pd1,x); pdf2 = pdf(pd2,x); pdf3 = pdf(pd3,x);

Plot all three pdf functions on the same figure for visual comparison.

figure plot(x,pdf1,'b-'); hold on plot(x,pdf2,'r-.'); plot(x,pdf3,'k--'); title('Compare Beta Parameters in Stable Distribution PDF Plots') legend('\beta = 0','\beta = 0.5','\beta = 1','Location','northwest') hold off

#### Random Number Generation

Use `random`

to generate random numbers
from the stable distribution. The software generates random numbers for the
stable distribution using the method proposed in [3]

### Cumulative Distribution Function

#### Definition

Most members of the stable distribution family do not have an explicit cumulative distribution function (cdf). Instead, the cdf is described in terms of the characteristic function [2].

Use `cdf`

to calculate the cumulative
distribution function for the stable distribution. The software computes the cdf
using the direct integration method. As explained in [1], numerical difficulties exist with accurately computing the cdf when the α
parameter is close to 1 or 0. If α is close to 1 (specifically, $$0<\left|\alpha -1\right|<0.02$$), then the software rounds α to 1. If α is close to 0, then
the densities may not be accurate.

#### Compare CDFs of Stable Distributions

The following plot compares the cumulative distribution functions for stable distributions with different `alpha`

values. In each case, `beta = 0`

, `gam = 1`

, and `delta = 0`

.

pd1 = makedist('Stable','alpha',2,'beta',0,'gam',1,'delta',0); pd2 = makedist('Stable','alpha',1,'beta',0,'gam',1,'delta',0); pd3 = makedist('Stable','alpha',0.5,'beta',0,'gam',1,'delta',0);

Calculate the cdf for each distribution.

x = -5:.1:5; cdf1 = cdf(pd1,x); cdf2 = cdf(pd2,x); cdf3 = cdf(pd3,x);

Plot all three cdf functions on the same figure for visual comparison.

figure plot(x,cdf1,'b-'); hold on plot(x,cdf2,'r-.'); plot(x,cdf3,'k--'); title('Compare Alpha Parameters in Stable Distribution CDF Plots') legend('\alpha = 2','\alpha = 1','\alpha = 0.5','Location','northwest') hold off

The plot illustrates the effect of the `alpha`

parameter on the shape of the cdf.

The next plot compares the cumulative distribution functions for stable distributions with different `beta`

values. In all cases, `alpha = 0.5`

, `gam = 1`

, and `delta = 0`

.

pd1 = makedist('Stable','alpha',0.5,'beta',0,'gam',1,'delta',0); pd2 = makedist('Stable','alpha',0.5,'beta',0.5,'gam',1,'delta',0); pd3 = makedist('Stable','alpha',0.5,'beta',1,'gam',1,'delta',0);

Calculate the cdf for each distribution.

x = -5:.1:5; cdf1 = cdf(pd1,x); cdf2 = cdf(pd2,x); cdf3 = cdf(pd3,x);

Plot all three pdf functions on the same figure for visual comparison.

figure plot(x,cdf1,'b-'); hold on plot(x,cdf2,'r-.'); plot(x,cdf3,'k--'); title('Compare Beta Parameters in Stable Distribution CDF Plots') legend('\beta = 0','\beta = 0.5','\beta = 1','Location','northwest') hold off

### Descriptive Statistics

The mean of the stable distribution is undefined for values of α ≤ 1. For α > 1, the mean of the stable distribution is

$$\text{mean}=\delta -\beta \gamma \mathrm{tan}\left(\frac{\pi \alpha}{2}\right).$$

Use `mean`

to calculate the mean of the
stable distribution.

The variance of the stable distribution is undefined for values of α < 2. For α = 2, the variance of the stable distribution is

$$\mathrm{var}=2{\gamma}^{2}.$$

Use `var`

to calculate the variance of the
stable distribution.

### Relationship to Other Distributions

The stable distribution has three special cases: The normal distribution, the Cauchy distribution, and the Lévy distribution. These distributions are notable because they have closed-form probability density functions.

#### Normal Distribution

The normal, or Gaussian, distribution is a special case of the stable
distribution. The stable distribution with *α* = 2 corresponds to the normal distribution. In other words,

$$N\left(\mu ,{\sigma}^{2}\right)=S\left(2,0,\frac{\sigma}{\sqrt{2}},\mu \right)\text{\hspace{0.17em}}.$$

*μ* is the mean and *σ* is
the standard deviation of the normal distribution.

Although the value of *β* has no effect when *α* = 2, the normal distribution is usually associated with *β*= 0.

The probability density function for the normal distribution is

$$f\left(x\right)=\frac{1}{\sqrt{2\pi}\sigma}\mathrm{exp}\left(-\frac{{\left(x-\mu \right)}^{2}}{2{\sigma}^{2}}\right)\text{\hspace{0.17em}},\text{\hspace{0.17em}}-\infty <x<\infty \text{\hspace{0.17em}}.$$

A plot of the density for a normal distribution is symmetric and has a bell-shaped curve.

#### Cauchy Distribution

The Cauchy distribution is a special case of the stable distribution with α = 1 and β = 0. In other words,

$$Cauchy\left(\delta ,\gamma \right)=S\left(1,0,\gamma ,\delta \right)\text{\hspace{0.17em}},$$

where γ is the scale parameter and δ is location parameter of the Cauchy distribution.

The probability density function for the Cauchy distribution is

$$f\left(x\right)=\frac{1}{\pi}\frac{\gamma}{{\gamma}^{2}+{\left(x-\delta \right)}^{2}}\text{\hspace{0.17em}},\text{\hspace{0.17em}}-\infty <x<\infty \text{\hspace{0.17em}}.$$

A plot of the density for a Cauchy distribution is symmetric and has a bell-shaped curve, but has heavier tails than the density of a normal distribution.

#### Lévy Distribution

The Lévy distribution is a special case of the stable distribution where α = 0.5 and β = 1. In other words,

$$L\xe9vy\left(\delta ,\gamma \right)=S\left(0.5,1,\gamma ,\gamma +\delta \right)\text{\hspace{0.17em}}.$$

where γ is the scale parameter and δ is location parameter of the Lévy distribution.

The probability density function for the Lévy distribution is

$$f\left(x\right)=\sqrt{\frac{\gamma}{2\pi}}\frac{1}{{\left(x-\delta \right)}^{3/2}}\mathrm{exp}\left(-\frac{\gamma}{2\left(x-\delta \right)}\right)\text{\hspace{0.17em}},\text{\hspace{0.17em}}\delta <x<\infty \text{\hspace{0.17em}}.$$

A plot of the density for a Lévy distribution is highly skewed and has heavy tails.

#### Comparison Plot for Stable Distributions

The following plot compares the probability density functions for the standard normal, Cauchy, and Lévy distributions.

Create a probability distribution object for the standard normal, Cauchy, and Lévy distributions.

pd_norm = makedist('Stable','alpha',2,'beta',0,'gam',1/sqrt(2),'delta',0); pd_cauchy = makedist('Stable','alpha',1,'beta',0,'gam',1,'delta',0); pd_levy = makedist('Stable','alpha',0.5,'beta',1,'gam',1,'delta',0);

Calculate the pdf for each distribution.

x = -5:.1:5; pdf_norm = pdf(pd_norm,x); pdf_cauchy = pdf(pd_cauchy,x); pdf_levy = pdf(pd_levy,x);

Plot all three pdf functions on the same figure for visual comparison.

figure plot(x,pdf_norm,'b-'); hold on plot(x,pdf_cauchy,'r.'); plot(x,pdf_levy,'k--'); title('Compare Stable Distributions pdf Plots') legend('Normal','Cauchy','Levy','Location','northwest') hold off

## References

[1] Nolan, John P. “Numerical calculation of stable
densities and distribution functions.” *Communications in
Statistics: Stochastic Models*. Vol. 13, No. 4, 1997, pp.
759–774.

[2] Nolan, John P. *Univariate Stable
Distributions: Models for Heavy Tailed Data*. Springer International
Publishing, 2020. https://doi.org/10.1007/978-3-030-52915-4.

[3] Weron, A. and R. Weron. “Computer simulation of
Lévy α-stable variables and processes.” *Lecture Notes in
Physics*. Vol. 457, 1995, pp. 379–392.