Mathestate Logo

 

Basic Functions

Load the package.

Needs["StableM`"]

doc2_1.gif

doc2_2.gif

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.

doc2_3.gif

doc2_4.gif

doc2_5.gif

doc2_6.gif

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:

doc2_7.gif

doc2_8.gif

doc2_9.gif

doc2_10.gif

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.

doc2_11.gif

doc2_12.gif

doc2_13.gif

doc2_14.gif

doc2_15.gif

doc2_16.gif

doc2_17.gif

doc2_18.gif

doc2_19.gif

doc2_20.gif

doc2_21.gif

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"]]
    

doc2_22.gif

doc2_23.gif

doc2_24.gif

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.

doc2_25.gif

doc2_26.gif

doc2_27.gif

doc2_28.gif

doc2_29.gif

doc2_30.gif

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.

doc2_31.gif

doc2_32.gif

doc2_33.gif

doc2_34.gif

doc2_35.gif

doc2_36.gif

doc2_37.gif

doc2_38.gif

doc2_39.gif

doc2_40.gif

doc2_41.gif

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.

doc2_42.gif

doc2_43.gif

CFFit is reasonably fast and quite accurate.

doc2_44.gif

doc2_45.gif

doc2_46.gif

doc2_47.gif

doc2_48.gif

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.

doc2_49.gif

doc2_50.gif

doc2_51.gif

doc2_52.gif

doc2_53.gif

doc2_54.gif

doc2_55.gif

doc2_56.gif

doc2_57.gif

doc2_58.gif

doc2_59.gif

doc2_60.gif

doc2_61.gif

doc2_62.gif

doc2_63.gif

doc2_64.gif

doc2_65.gif

doc2_66.gif

doc2_67.gif

doc2_68.gif

doc2_69.gif

doc2_70.gif

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.

doc2_71.gif

doc2_72.gif

doc2_73.gif

doc2_74.gif

doc2_75.gif

doc2_76.gif

doc2_77.gif



© Copyright 2007 mathestate    Fri 14 Dec 2007