Stable Random Variables

While stable densities and probabilities are difficult to compute, stable random variables are not.  The formulae to generate stable random variables were presented by Chambers, Mallows and Stuck in 1976 (see Reference page).  Thousands of these random variables can be generated very quickly, making simulations easy.  The plot below shows 10,000 random variables for parameters, {α, β, γ, δ} = {1.5, -1, 1, 0}, sorted into an empirical distribution function with equal probabilities assigned to each random variable based on the sample size (blue).  The red curve is the calculated distribution function.

Needs["StableM7`"];
s= SRandom[10000,{3/2,-1},1];
pr=(Range[10000]-0.5)/10000;
p1 =ListPlot[Transpose[{Sort[s],pr}]];
p2=Plot[SCDF[x,{3/2,-1},1],{x,-10,10},PlotStyle->{Red,Thickness[0.005]}];
Show[p1,p2,PlotLabel-> "Empirical Distribution"]

The plot above suggests a way to check on the fit of a stable sample to parameters.  The graph above however will not give a very accurate picture of the tail fit.  For this reason a log-log plot is preferred.  The graph below takes the absolute value of x < 0, so that the tail slopes will be similar; 1-probability is used for x > 0.  A normal distribution fit to the data is shown in green.  Not that the data sample was maximally skewed to the left so the light right tail is not linear and decays very rapidly.

EmpiricCDFList[data_] := Block[{prob,sel,del},
					
					prob= Table[(i-0.5)/Length[data],{i,Length[data]}];
					Transpose[Join[{Sort[data]},{prob}]]];
Clear[DisplayLogStableFit];
scdf[x_?NumericQ,parm_,type_:1,opts___]:=SCDF[x,parm,type,opts];
DisplayLogStableFit[data_,parm_,type_Integer:1]:=Module[{clist,lt,rt,trt,lp1,lp2,lp3,lp4,lp5,nmn,nstd},
clist=EmpiricCDFList[data];
	lt = Select[clist,#[[1]]<0&];
	rt= Select[clist,#[[1]]>0&];
	trt=Transpose[rt];
lp1=ListLogLogPlot[Abs[lt],PlotStyle->Blue,PlotRange->All];
lp2=ListLogLogPlot[Transpose[{trt[[1]],1- trt[[2]]}],PlotStyle->Red,PlotRange->All];
lp3= LogLogPlot[scdf[-x,parm,type],{x,0.0001,-4 Min[data]},PlotStyle->Blue,PlotRange->All];
lp4= LogLogPlot[1-scdf[x,parm,type],{x,0.0001,-4 Min[data]},PlotStyle->Red,PlotRange->All];
nmn=Mean[data];
nstd=StandardDeviation[data];
lp5= LogLogPlot[1-scdf[x,{2,0,nstd /Sqrt[2],nmn},1],{x,0.0001,4 nstd},PlotStyle->Green,PlotRange->All];
Show[lp1,lp2,lp3,lp4,lp5,PlotLabel->"Log Log Left Tail Blue, Right Red, (Normal Green)",AspectRatio->Automatic,PlotRange->All]];
DisplayLogStableFit[s, {3/2,-1,1,0}]

Below is the fit to a random sample size 1000 generated for parameters: {1.5, 0.5, 1, 0}.  The fit for the smaller sample is not so tight.  Since β is no longer maximally skewed the tails in the graphic have the same slope which is minus α, in this kind of plot.

DisplayLogStableFit[SRandom[1000,{3/2,1/2},1],{3/2,1/2,1,0}]

For a detailed exploration of the stable random number generator follow the link.

txcolor=RGBColor[181/255,18/255,27/255];
t1 = Graphics[Text[Hyperlink[Framed[Style["Financial Home", {txcolor, Bold, Larger}]], "../map/Overview.html"], {-5, 0}]];
t2 = Graphics[Text[Hyperlink[Framed[Style["Next", {txcolor, Bold, Larger}]], "../s04/Variance.html"], {0, -0.5}]];
t3 = Graphics[Text[Hyperlink[Framed[Style["Download Notebook", {txcolor, Bold, Larger}]], "../s03/Random.nb"], {5, 0}]];
t4 = Graphics[Text[Hyperlink[Framed[Style["Previous", {txcolor, Bold, Larger}]], "../s02/StableProbability.html"], {0, 0.5}]];
Show[ t1, t2, t3, t4, ImageSize -> 500]
CellPrint[TextCell["\n\n© Copyright " <> ToString[DateList[][[1]]] <> " mathestate    " <> DateString[DateList[], "DateShort"], "Text"]]

© Copyright 2008 mathestate    Fri 19 Dec 2008