![]() Volume 9, Issue 4 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff and Contributors Submissions Subscriptions Advertising Back Issues Contact Information |
Stable Distributions in Mathematica
Using the PackageThe StableDistribution package provides several basic functions needed for the calculation of stable distributions. They are all designed with identical input, output, and default formats. The package comes with a Help Browser that explains in more detail how each function works. It also includes a few more functions that are not described in this paper. The package allows both the 0 and 1 parameterizations for all the following functions, but in the examples and discussion only Place the unzipped folder, StableDistribution (see Additional Material), in the Mathematica applications folder. After rebuilding the Help Browser index, documentation will be available in the Help Browser Add-ons & Links category. The following command loads the program. <<StableDistribution`SMath`
The SPDF function calculates the stable density using a variation of the Zolotarev integral transformation [7]. This transformation permits accurate calculations of both the density and distribution functions across nearly the whole domain of stable parameters. Attempts to simply numerically integrate the inverse Fourier transform of the characteristic function run into difficulties when
Chambers, Mallows, and Stuck [8] published an algorithm for the generation of stable random variables. It is implemented in this package as the function, SRandom. The following example generates a stable random sequence of 10 numbers where p1 is a parameter set,
The SRandom generator makes it easy to experience the behavior of stable distributions. The following graphics array illustrates 10,000 pseudorandom drawings from symmetric stable distributions with
The following example simulates what a series of daily stock market prices might look like if generated by a stable return model with a starting price of 50 and an expected annual return of 7% (there are about 252 trading days in a year); notice the sudden large jumps.
The StableDistribution package also has data analysis capability and can perform a fit to data. The fMLFit function provides a maximum likelihood fit to the data. The algorithm uses a fast Fourier transform of the characteristic function [9] to approximate the stable probability density function rapidly.
The following graph compares the fit to the empirical density of the sample.
The plot of the distribution function follows.
The SQuantile function uses FindRoot to solve for
The density and distribution functions use NIntegrate to make the calculations. A direct integral form for the first derivative of the density function is also provided, but further derivatives can also be calculated using the derivative function in Mathematica.
While the package is able to calculate most all of the range of stable distributions, it can at times be slow and may require adjustment of the input parameters to NIntegrate to obtain accurate results. With such adjustments, however, it is possible to make extremely precise calculations. The following example shows high-precision density calculations for values on the light tail of a maximally skewed stable distribution.
The SMode function can be used to locate the mode of a stable distribution; this is particularly useful when
|
||||||||
About Mathematica | Download Mathematica Player © 2005 Wolfram Media, Inc. All rights reserved. |