Volatility, Measured as Stable Gamma: 

A New Market Paradigm

Needs["Stable`"];
LogReturn[data_]:=Differences[Log[N[data]]];
ScaleS1[n_,s1params_List] := {s1params[[1]],s1params[[2]],n^(1/s1params[[1]])s1params[[3]],n s1params[[4]]};
EmpiricCDFList[data_] := Block[{prob,sel,del},
					
					prob= Table[(i-0.5)/Length[data],{i,Length[data]}];
					Transpose[Join[{Sort[data]},{prob}]]];

ft={0.5,0.1,0.05,0.01,0.005,0.001,0.0001};
lfticks=Transpose[{ft,ft}];
rfticks=Transpose[{ft,1-ft}];
Clear[DisplayLogStableFit];
DisplayLogStableFit[data_,parm_,type_Integer:1]:=Module[{clist,lt,rt,trt,lp1,lp2,lp3,lp4,lp5,nmn,nstd,xlim,xlim0},
clist=EmpiricCDFList[data];
	lt = Select[clist,#[[1]]<0&];
	rt= Select[clist,#[[1]]>0&];
	trt=Transpose[rt];
xlim0=Min[rt,Abs[lt]];
xlim=Max[{-Min[data],Max[data]}];
lp1=ListLogLogPlot[Abs[lt],PlotStyle->Blue,PlotRange->All,Frame->True,FrameTicks->{True,lfticks,None,rfticks},Axes->False];
lp2=ListLogLogPlot[Transpose[{trt[[1]],1- trt[[2]]}],PlotStyle->Red,PlotRange->All,Frame->True];
lp3= LogLogPlot[StableCDF[-x,parm,type],{x,xlim0,xlim},PlotStyle->Blue,PlotRange->All];
lp4= LogLogPlot[1-StableCDF[x,parm,type],{x,xlim0,xlim},PlotStyle->Red,PlotRange->All];
nmn=Mean[data];
nstd=StandardDeviation[data];
lp5= LogLogPlot[1-StableCDF[x,{2,0,nstd /Sqrt[2],nmn},1],{x,xlim0,4.5 nstd},PlotStyle->Green,PlotRange->All];
Show[lp1,lp2,lp3,lp4,lp5,PlotLabel->"Log Log Stable Distribution\nLeft Tail Blue, Right Red, (Normal Green)",PlotRange->All,FrameLabel->{"Abs[x]","Left Tail",None,"Right Tail"}]];

In the section on fitting market data, we presented the idea that a non-stationary stable distribution which has a varying γ or scale parameter might be a reasonably accurate model for financial data.  In this section we take the concept another step forward and suggest that the γ parameter is the best measure of volatility.  Traditionally, volatility is measured using the sample standard deviation.  This will work if you want to sort a portfolio to find the order of risk in its components, but the process of measuring a sample standard deviation implies that this measure exists for the distribution from which the data are drawn.  The variance and standard deviation (square root of variance) do not exist for stable distributions other than the normal distribution.  (See Variance Page).  

We have developed a method of estimating the γ parameter of any stable distribution that is independent of the other parameters and will use that in this section.  While all stable parameters are needed to calculate stable probabilities, the γ parameter is the most important for financial data, for the following reasons.
	1.  It is generally many times larger than δ, which is close to zero for high frequency data.
	2.   β is generally near zero and does not add a lot to the probability calculation.
	3.  For most financial data, α is in a narrow range, 1.7 - 1.9, if the data is corrected for a non-stationary γ parameter or calculated over a short time frame.

A popular market volatility index, the VIX, has been updated, but it is still based on standard deviation and assumptions based on the normal distribution.  We think the best method to measure volatility will prove to be the stable gamma parameter with intraday data.  The intraday stable γ, on the actively traded SPY ETF, may be a better and simpler market volatility measure than the VIX.  We have been tracking the intraday minute log returns on the SPY ETF since July 5, 2007 and will demonstrate that data.

data=<<"C:\\Mathematica 7\\Portfolio\\OneMinuteData\\SPY";
lr=LogReturn[data[[All,2]]];
absecf0=Compile[{t,{s,_Real,1}},Abs[Mean[Exp[I t s]]]-1/E];
ABSECF0[t_?NumericQ,s_]:=absecf0[t,s];
SScale[s_]:=Module[{cc,c0,c1},
c1=MeanDeviation[s];
(*generally this loop should not be entered*)
While[absecf0[1/c1,s]<0,c1=2c1;Print["Upper Bound Loop"]];
c0=c1;
While[absecf0[1/c0,s]>0,c1=c0;c0=0.8 c0];(*bracket solution from above*)
cc/.FindRoot[ABSECF0[1/cc,s],{cc,  c0,c1},Method->"Brent"]
];
(*partition data by days*)
dtt=Rest[data[[All,1]]];
dtlr=Transpose[{dtt,lr}];
dtlr1=Split[dtlr,Take[#1[[1]],3]===Take[#2[[1]],3]&];
lrp=#[[All,2]]&/@dtlr1;
(*end day partition routine*)
scl=SScale/@lrp;
dtpr=Last/@Split[Rest[data][[All,{1,2}]],Take[#1[[1]],3]===Take[#2[[1]],3]&];
dt=Last[#][[1]]&/@dtlr1;
vix=FinancialData["^VIX",{2007,7,5}];
vq=Mean[vix[[All,2]]]/Mean[scl];
Clear[rticks]
rticks[min_,max_]:=Table[{i,Round[i /vq 10000]/10000.},{i,Ceiling[min],Floor[max],30}]
DateListPlot[{Transpose[{dt,vq scl}],vix},PlotRange->All,Joined-> True,PlotStyle->{Darker[Red],Darker[Blue]}, FrameTicks->{Automatic,Automatic,None,rticks},FrameLabel-> {None,"VIX",None,"SPY Stable γ"},PlotLabel-> "VIX - Blue\nSPY Stable γ - Red"]

The graph above shows the VIX in blue and stable γ in red.  Looking closely at the graphs, it appears that stable γ may actually lead the VIX index and it has a much larger dynamic range.  The advantage of using stable γ over the VIX is that it actually applies to the known stable distributions and can be used to calculate probabilities.

Below are calculated the mean of the stable parameters of the intraday time series of log returns obtained by a maximum likelihood fit of each day's data.  The graph shows each day's stable α, with the 95% confidence intervals shown in red.  α is surprisingly constant in the range of 1.8, but in 2009 it appears to be declining.  This appears to be related to higher kurtosis in the daily data without necessarily heavier tails.

parm=Quiet[StableMLFit/@lrp];
gq0=DateListPlot[Transpose[{dt,parm[[All,1]]}],PlotRange->All,PlotLabel->"SPY Alpha"];
{ma,mb,mc,md}= Mean[parm];
Needs["Stable`"];
ci=StableMLEConfidenceInterval[{ma,mb,mc,md},391][[1]];
gq0a=Plot[{ma+ci,ma-ci},{x,AbsoluteTime[First[dt]],AbsoluteTime[Last[dt]]},PlotStyle-> {{Thickness[0.008],Darker[Red]}}];
TableForm[{ToString[#,TraditionalForm]&/@{ma,mb,mc,md}},TableHeadings-> {None,{"α","β","γ","δ"}},TableSpacing-> {1,5}]
Show[gq0,gq0a]

The following graph compares the stable γ obtained by maximum likelihood fit (which is time consuming) to a rapid method based on the stable characteristic function.  They are essentially identical, so the rapid method can be used as a measure of volatility, calculated from intraday SPY ETF one-minute returns.

DateListPlot[{Transpose[{dt,parm[[All,3]]}],Transpose[{dt,scl}]},Joined->True, PlotRange->All,PlotLabel->"Stable γ\nMaximum Likelihood Method - Blue\nQuick Characteristic Function Method - Red" ]

Both the VIX and stable γ show strong serial autocorrelation, but the VIX appears smoothed and over shoots the zero line by a greater degree as autocorrelation decays.

AutoCorrelationF[data_,lag_]:=Module[{dataf,dataf1},dataf=Fourier[Join[data-Mean[data] ,Table[0.`,{lag}]]];
dataf1=Take[Chop[Fourier[Abs[dataf]^2]],lag+1] ;
(dataf1/(dataf1[[1]]))];
ListPlot[{AutoCorrelationF[vix[[All,2]],200],AutoCorrelationF[scl,200]},PlotRange->All,Joined->True,PlotLabel->"VIX  -- Blue\nStable γ  -- Red",Frame->True,Axes->{True,False},FrameLabel->{"Lag in Days","Autocorrelation"}]

The following graph shows the relationship between price and volatility.  The recent market price collapse is clearly associated with marked increase in market volatility.

prticks=Table[{i,2.5i+80},{i,0,88,4}];
gticks=Table[{i,i/10000.},{i,0,30,5}];
DateListPlot[{{#1,(#2-80)/2.5}&@@@dtpr,Transpose[{dt,10000scl}]},Joined->True,PlotLabel->"SPY Close - Blue\nGamma - Red",FrameLabel -> {None,"Price ",None,"Gamma "},FrameTicks-> {Automatic,prticks,Automatic,gticks},PlotRange->All]

The next graphic shows a power tail model for the decay of volatility.  The peak is taken from the recent peak in volatility seen on October 10, 2008, and fit to a power tail model of decay.  Such a model suggests that we may see very high volatility for a long while.

decay={AbsoluteTime[#1],#2}&@@@Drop[Transpose[{dt,scl}],321];
lst={{{2010,3,31},0}};
g6=DateListPlot[{decay,lst},Joined->True,PlotRange->All,PlotStyle->{Darker[Red],White},PlotRange->All,PlotLabel->"SPY Intraday Gamma Projection"];
model= k (t^(-a));
decay1=decay[[All,2]];
m=FindFit[decay1,model,{k,a},t];
g1=Plot[model/.m/.t->( w-AbsoluteTime[{2008,10,10}])/(60 60 24),{w,AbsoluteTime[{2008,10,10}],AbsoluteTime[lst[[1]][[1]]]},PlotRange-> {All,{0,First[decay1]}}];
nlm=NonlinearModelFit[decay1,model,{k,a},t];
ptable=nlm["ParameterConfidenceIntervals"];
kk=ptable[[1]];
aa=ptable[[2]];
g1a=Plot[ Evaluate[model/.{m,{k->kk[[1]],a->aa[[2]]},{k->kk[[2]],a->aa[[1]]}}/.t->( w-AbsoluteTime[{2008,10,10}])/(60 60 24)],{w,AbsoluteTime[{2008,10,10}],AbsoluteTime[lst[[1]][[1]]]},(*PlotRange->All,*)PlotStyle->{Darker[Blue],Darker[Purple],Darker[Purple]}];
Show[g6,g1,g1a,Frame->True,FrameLabel-> {None,"Stable Gamma "}]

Below is another model, based on a logarithmic decay; there was a lot of variation at the beginning, but the fit is appearing closer now.  Using projections like these or other models, future stable gamma could be used to estimate a convolution of stable probabilities for estimation of immediate market risk.  It should be noted, however, that as in September and October 2008, the dynamics may change very rapidly.  We will periodically update this page.

model1=k Exp[-r t];
mm=FindFit[decay1,model1,{k,r},t];
g4=Plot[model1/.mm,{t,0,370}];
g7=ListLinePlot[decay1,PlotStyle->Darker[Red],PlotRange->All,Frame->True,Axes->False];
Show[g7,g4,FrameLabel->{"Days","Stable Gamma "}]

We conclude by again suggesting that the best way to view financial data is with a non-stationary model.  A stable distribution with a varying γ parameter seems to well describe actual financial time series.  We believe that the above measures of volatility will prove to be more accurate than indices such as the VIX and certainly more useful since the model underlying the VIX is still based on standard deviation and the normal distribution assumption that scaling is based on (Sqrt[time]), rather than (time^(1/α)).  We find α as determined by a stable fit to be about 1.8, rather than the normal assumption where α = 2.  The intraday γ which we have shown may be scaled to any number, n, of days using the formula below, where 391 is the number of minute returns per day in our sample.

ScaledGamma=IntraDayGamma (((391 n))^(1/α))

The same methods can be applied to individual securities if they are actively traded, allowing probability calculations which are specific to an individual stock.

Futures prices show the same phenomenon as stock prices, but they are more difficult to deal with because the contracts are expiring.  The Energy Information Administration keeps track of energy related futures prices, adjusting the forward contracts as they expire.  We have prepared a page on oil prices using their data.   There is a page on Treasury bond volatility, using data from the Federal Reserve FRED database.

We do not believe that the algorithm to find stable γ independently of other parameters is published anywhere, so we provide a full explanation of it.

Here is a link to a page showing similar results for long range volatility estimated from daily data.

We have developed a new measure of volatility Log[High/Low] derived from the daily high low prices.  It gives the same volatility information, but is much more readily accessible from data bases.  Follow the link to see how closely this measure is related to the stable γ measure of volatility.

Link to most recent intra-day volality for SP500 index.  This is updated in real time at 20 second intervals during New York market hours.

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}]],  "../r07c/VolatilityModel.html"], {5,0}]];
t3 = Graphics[Text[Hyperlink[Framed[Style["Download Notebook", {txcolor, Bold, Larger}]], "../r07/Volatility.nb"], {5, 0}]];
t4 = Graphics[Text[Hyperlink[Framed[Style["Previous", {txcolor, Bold, Larger}]],  "../r06/MarketData.html"], {0, 0}]];

Show[ t1, t2, (*t3,*)t4, ImageSize -> 500]
CellPrint[TextCell["\n\n© Copyright " <>ToString[DateList[][[1]]]<>" mathestate    "<>DateString[DateList[],"DateShort"], "Text"]]

© Copyright 2010 mathestate    Wed 24 Mar 2010