# GARCHProcessにおけるボラティリティクラスタリング

GARCHProcessのシミュレーションを実行する．

 In[1]:= Xgarch\[ScriptCapitalP] = GARCHProcess[.5, {.6}, {.3}]; BlockRandom[SeedRandom[44]; data = RandomFunction[garch\[ScriptCapitalP], {0, 10^6}]];

 In[2]:= Xvar = MovingMap[StandardDeviation, data, 10]; ListLinePlot[TimeSeriesResample[var, 100], PlotRange -> {0, 40}, Ticks -> {Table[{10^5 k, k}, {k, 10}], Automatic}, AxesLabel -> {"\[Times] 10^5", None}, ImageSize -> Medium]
 Out[2]=

 In[4]:= XcondVar[pd_, v_] := Module[{cd, n, var, p0, p1}, {p0, p1} = cfBinarySearch[pd[[All, 1]], v + Abs[v] {-0.1, 0.1}]; cd = Take[pd, {p0 - 1, p1}]; n = Length[cd]; If[n > 10, {Mean[cd[[All, 1]]], StandardDeviation[cd[[All, 2]]]}, {Indeterminate, Indeterminate}]]

 In[5]:= XQuantile[data, {0, 0.01, 0.05, 0.95, 0.99, 1}]
 Out[5]=
 In[6]:= Xvlist = Join[#, -#] &[{1, 2, 4, 6, 8, 10, 15, 20, 25, 30, 35, 40}]; Block[{pd = SortBy[Partition[data["Values"], 2, 1], First]}, sdEst = Table[condVar[pd, v], {v, Sort[vlist]}]];
 In[7]:= XListLinePlot[SortBy[sdEst, First]]
 Out[7]=

ARMA過程のサンプルのグラフと比較する．この過程の条件付き標準偏差は一定である．

 In[8]:= Xarma\[ScriptCapitalP] = ARMAProcess[{.6, 0.1}, {.3}, 1]; BlockRandom[SeedRandom[44]; data2 = RandomFunction[arma\[ScriptCapitalP], {10^6}]];
 In[9]:= XQuantile[data2, {0, 0.01, 0.05, 0.25, 0.75, 0.95, 0.99, 1}]
 Out[9]=
 In[10]:= Xvlist = Join[#, -#] &[{0.5, 1, 2, 3, 4, 5}]; Block[{pd2 = SortBy[Partition[data2["Values"], 2, 1], First]}, sdEst2 = Table[condVar[pd2, v], {v, Sort[vlist]}]];
 In[11]:= XListLinePlot[SortBy[sdEst2, First], PlotRange -> {0, 2}]
 Out[11]=

## Mathematica

Questions? Comments? Contact a Wolfram expert »