Basic Functions
Load the package.
Needs["StableM`"]
Stable densities. All of the routines in this section can be used in the 0-parameterization or the 1-parameterization, using param equal to 0 or 1. No other parameterizations are implemented. For plotting where high accuracy is not needed performance can be improved by reducing AccuracyGoal → 4. Plot option PerformanceGoal → "Speed" is also important.
The current SPDF, SCDF, and SQuantile routines are not set up to take a list for the input parameters. If you need that capability you can do it with a simple wrapper function:
Note the error in the plot. This is caused because the Table[x, {x, -5, 5, 0.1}], set up a value for x very close to zero but not zero. The program does not automatically round off inputs that might cause errors. In the 1-parameterization, the integral routines do not function well very close to x = zero, but the results are known exactly for x = 0. You can solve the problem a number of ways, including writing your own rounding routines near zero. Below the function Chop is used. Rationalizing input parameters will sometimes help.
It is possible to take derivatives of these functions.
a={1.3,1};
stl=Table[{Hue[i],Thickness[0.005]},{i,0.7,1,0.1}];
Quiet[Plot[{SCDF[x,a,0],SPDF[x,a,0],
StableM`Private`D1SPDF[x,a,0],
D[SPDF[t,a,0],{t,2}]/.t->x},{x,-5,5},
PlotStyle→stl,PlotRange→All,PerformanceGoal->"Speed"]]
Table[{p,SQuantile[p,{1.3,0.5}]},{p,0,1,0.1}]//TableForm
| 0. | -∞ |
| 0.1 | -2.56229 |
| 0.2 | -1.92258 |
| 0.3 | -1.51185 |
| 0.4 | -1.15793 |
| 0.5 | -0.807542 |
| 0.6 | -0.421853 |
| 0.7 | 0.0542609 |
| 0.8 | 0.750101 |
| 0.9 | 2.2028 |
| 1. | ∞ |
SQuantile uses FindRoot to solve x at a value of the SCDF of p. If you are trying to work near p = 0 or p = 1, or close to alpha = 1, expect difficulties. You may also need to adjust the parameters for NIntegrate and FindRoot; options for NIntegrate can be passed via the function.
It is possible that the above method which increases the accuracy of SPDF may not work. It is possible to perterb the initial point with the variable qstart which by default is set to 0.
The quantile method is fast but not usually so accurate as the CFFit method. The method is included for historical purposes but is now obsolete unless a very fast approximation is needed.
CFFit is reasonably fast and quite accurate.
SFFit first uses CFFit and then uses a FFT routine to approximate the stable density for maximum likelihood fitting. It is usually more accurate than CFFit but quite a bit slower. The trade off between accuracy and speed can be managed by the NN (size) and SR (sampling rate) options which are passed to FMLFit.
FLogLikelihood is faster but less accurate. It is a little less likely to try to take the log of a zero value that might be generated if the SPDF integral does not converge.
© Copyright 2007 mathestate Fri 14 Dec 2007