SPB Git

spb/wp46_uqo

Public

WP46: cross-check table generator, GAS nesting test, R test fixes

Simon-Pierre Boucher committed (Nov 9, 2026) parent 0ec77f6 Browse files

6 changed files +949 −8

modified results/metrics/rugarch_crosscheck.json +895 −1
@@ -1 +1,895 @@
1−{"rugarch_version":"1.5.6","garch11_t":{"converged":true,"loglik":-3379.50279602402,"coef":{"mu":0.0272520855544271,"omega":0.0174152246241149,"alpha1":0.0766441622812045,"beta1":0.897925769946588,"shape":6.92334228660823},"sigma2_last5":[0.331218279727791,0.332580388365619,0.386557106650745,0.41489230427875,0.395462742973217],"fc":[0.373396880254564,0.381316596907874,0.389034914629954,0.396556955009274,0.403887709391963,0.411032042193878,0.417994694128454,0.424780285352459,0.431393318531763,0.437838181829138,0.444119151816078,0.450240396310574,0.456205977142725,0.462019852850014,0.467685881304048,0.473207822270496,0.478589339903933,0.483834005179235,0.488945298261143,0.493926610813575,0.498781248250204,0.503512431927809]},"gjr11_t":{"converged":true,"loglik":-3372.99049098085,"coef":{"mu":0.0223490291478538,"omega":0.0174956405075909,"alpha1":0.0426372227127993,"beta1":0.900398468982572,"gamma1":0.0620237392157647,"shape":7.00993566707479},"sigma2_last5":[0.332335215434199,0.340484527422025,0.419369166473932,0.463058113854574,0.441677271920104],"fc":[0.416282527426611,0.422974621160647,0.429493038742298,0.435842287491262,0.442026757751298,0.448050725926038,0.453918357436013,0.45963370959893,0.465200734435209,0.470623281400702,0.475905100048492,0.481049842621618,0.486061066578505,0.490942237052855,0.495696729249701,0.500327830779275,0.504838743930304,0.509232587884315,0.513512400872467,0.51768114227641,0.521741694674624,0.525696865835649]},"egarch11_t":{"converged":true,"loglik":-3376.68334976327,"coef":{"mu":0.0188171893640434,"omega":-0.0170849884697369,"alpha1":-0.0444147835573704,"beta1":0.968708686881274,"gamma1":0.156456196163122,"shape":6.99039734118426},"sigma2_last5":[0.328885250801329,0.350822965161747,0.436863315480211,0.499447742972208,0.479693397387017],"fc":[0.440981758288812,0.444761569483677,0.448453995963031,0.452060109871317,0.455581032094569,0.45901792729419,0.462371999182192,0.4656444860341,0.468836656435033,0.471949805253863,0.474985249839914,0.477944326436176,0.480828386802756,0.483638795043929,0.486376924632017,0.489044155621135,0.491641872043739,0.494171459482879,0.49663430281301,0.499031784102273,0.501365280669172,0.503636163286671]},"aparch11_t":{"converged":true,"loglik":-3372.84892807275,"coef":{"mu":0.0219498032140538,"omega":0.0182869465555667,"alpha1":0.0734928958434684,"beta1":0.901720469927853,"gamma1":0.230203192227028,"delta":1.84060080476714,"shape":7.0279389234871},"sigma2_last5":[0.332682598703389,0.342687583247142,0.423457812590537,0.47031035284744,0.448241954551476],"fc":[0.420729778911146,0.426946162214478,0.433001778704925,0.438900519070086,0.444646200595584,0.450242566618973,0.455693286232804,0.461001954204718,0.46617209108646,0.471207143487254,0.476110484489945,0.48088541419098,0.485535160347515,0.490062879116947,0.494471655875874,0.498764506106986,0.502944376343734,0.507014145163756,0.510976624223076,0.514834559323999,0.518590631510407,0.522247458184874]},"figarch11_t":{"converged":true,"loglik":-3381.97980336414,"coef":{"mu":0.028208711165193,"omega":0.0134114399389171,"alpha1":0.26282947219305,"beta1":0.780139313197165,"delta":0.631140189523463,"shape":6.41803885552558},"sigma2_last5":[0.299696988917735,0.316330648317056,0.390432077409812,0.384885199689091,0.343022844513784],"fc":[0.339059269752477,0.367590095570308,0.368843743107776,0.370160945435298,0.373457632868578,0.377938383945126,0.382963124329593,0.388198567929454,0.393484081477849,0.398744620082659,0.403945640040183,0.409071431842686,0.414115967772256,0.419078001693844,0.423958280305449,0.42875861007803,0.433481497208184,0.438129181396169,0.442704763673238,0.447212036971553,0.451653257516078,0.456031281967143]},"igarch11_t":{"converged":true,"loglik":-3385.51714991758,"coef":{"mu":0.0273555996213812,"omega":0.00822664842815519,"alpha1":0.0911285633973949,"beta1":0.908871436602605,"shape":5.98132454596413},"sigma2_last5":[0.301577365761645,0.303442040727677,0.367868964109828,0.402485492370637,0.380584653228751],"fc":[0.355184003263419,0.363410651691574,0.371637300119729,0.379863948547884,0.388090596976039,0.396317245404194,0.40454389383235,0.412770542260505,0.42099719068866,0.429223839116815,0.43745048754497,0.445677135973126,0.453903784401281,0.462130432829436,0.470357081257591,0.478583729685746,0.486810378113901,0.495037026542057,0.503263674970212,0.511490323398367,0.519716971826522,0.527943620254678]},"cgarch11_t":{"converged":true,"loglik":-3379.76186721388,"coef":{"mu":0.0273402099302754,"omega":0.0178411646698263,"alpha1":0.0472240690102781,"beta1":0.926336229155417,"eta11":0.973560849178106,"eta21":0.0299126275164861,"shape":6.89529147023611},"sigma2_last5":[0.331806400268661,0.333156933397685,0.387466733404178,0.415888052702624,0.3961973946619],"fc":[0.373894792219397,0.410734909756006,0.417716681277378,0.424513858333285,0.431131321506913,0.437573822341324,0.443845986751214,0.449952318344464,0.455897201655865,0.461684905295354,0.467319585013005,0.472805286682989,0.478145949208632,0.483345407350674,0.488407394480744,0.493335545262035,0.498133398259106,0.50280439847868,0.507351899843266,0.511779167599379,0.516089380662085,0.520285633897565]},"nagarch11_t":{"converged":true,"loglik":-3373.35050140171,"coef":{"mu":0.0213271608385587,"omega":0.0169277508131017,"alpha1":0.0706508464116506,"beta1":0.895992701235594,"eta21":0.339825862746243,"shape":7.06871565857494},"sigma2_last5":[0.320085472046233,0.335215163198902,0.410709126156738,0.458799430333668,0.445128729120879],"fc":[0.423373945827428,0.429633698461851,0.435735720488707,0.441683986337342,0.447482370291107,0.453134649010792,0.458644503994484,0.464015523975432,0.469251207259498,0.474354964003706,0.479330118437384,0.484179911027331,0.488907500588426,0.493515966341068,0.498008309916754,0.502387457313138,0.50665626079982,0.510817500776111,0.514873887581995,0.518828063263449,0.522682603293291,0.526440018248661]},"tgarch11_t":{"converged":true,"loglik":-3378.26565819207,"coef":{"mu":0.0185075851662991,"omega":0.0237242658452512,"alpha1":0.0806721422971265,"beta1":0.908415590277261,"eta11":0.278262852619424,"shape":7.02369203281082},"sigma2_last5":[0.339303507806645,0.361929596403121,0.446541788728846,0.509029924970293,0.488014547239253],"fc":[0.446902528383541,0.451531432310373,0.456042749975163,0.460438686643197,0.464721461954639,0.468893304636195,0.472956447662954,0.476913123839437,0.480765561770887,0.484515982197637,0.488166594667179,0.49171959452015,0.495177160168002,0.498541450641537,0.501814603390865,0.504998732318567,0.508095926029051,0.511108246278208,0.514037726608485,0.516886371155493,0.519656153613176,0.522349016345428]},"realgarch11_n":{"converged":false},"garch11_skewt":{"converged":true,"loglik":-3379.31479592696,"coef":{"mu":0.0247602319116539,"omega":0.017295740459104,"alpha1":0.0762213395583014,"beta1":0.89844516796877,"skew":0.984514907132941,"shape":6.94374052154004},"sigma2_last5":[0.330905238634026,0.332071373500861,0.385400191269274,0.413348758343739,0.394040260337795],"fc":[0.372159534757372,0.380027174443972,0.387695499339791,0.395169558784582,0.402454274200687,0.40955444233363,0.41647473841062,0.423219719219034,0.429793826106908,0.436201387907421,0.442446623789292,0.448533646034957,0.454466462748379,0.460248980494249,0.465885006870329,0.471378253014633,0.476732336049089,0.481950781461291,0.487037025425924,0.491994417067363,0.496826220664968,0.501535617802502]}} 1+{
2+ "rugarch": {
3+ "rugarch_version": "1.5.6",
4+ "garch11_t": {
5+ "converged": true,
6+ "loglik": -3379.50279602402,
7+ "coef": {
8+ "mu": 0.0272520855544271,
9+ "omega": 0.0174152246241149,
10+ "alpha1": 0.0766441622812045,
11+ "beta1": 0.897925769946588,
12+ "shape": 6.92334228660823
13+ },
14+ "sigma2_last5": [
15+ 0.331218279727791,
16+ 0.332580388365619,
17+ 0.386557106650745,
18+ 0.41489230427875,
19+ 0.395462742973217
20+ ],
21+ "fc": [
22+ 0.373396880254564,
23+ 0.381316596907874,
24+ 0.389034914629954,
25+ 0.396556955009274,
26+ 0.403887709391963,
27+ 0.411032042193878,
28+ 0.417994694128454,
29+ 0.424780285352459,
30+ 0.431393318531763,
31+ 0.437838181829138,
32+ 0.444119151816078,
33+ 0.450240396310574,
34+ 0.456205977142725,
35+ 0.462019852850014,
36+ 0.467685881304048,
37+ 0.473207822270496,
38+ 0.478589339903933,
39+ 0.483834005179235,
40+ 0.488945298261143,
41+ 0.493926610813575,
42+ 0.498781248250204,
43+ 0.503512431927809
44+ ]
45+ },
46+ "gjr11_t": {
47+ "converged": true,
48+ "loglik": -3372.99049098085,
49+ "coef": {
50+ "mu": 0.0223490291478538,
51+ "omega": 0.0174956405075909,
52+ "alpha1": 0.0426372227127993,
53+ "beta1": 0.900398468982572,
54+ "gamma1": 0.0620237392157647,
55+ "shape": 7.00993566707479
56+ },
57+ "sigma2_last5": [
58+ 0.332335215434199,
59+ 0.340484527422025,
60+ 0.419369166473932,
61+ 0.463058113854574,
62+ 0.441677271920104
63+ ],
64+ "fc": [
65+ 0.416282527426611,
66+ 0.422974621160647,
67+ 0.429493038742298,
68+ 0.435842287491262,
69+ 0.442026757751298,
70+ 0.448050725926038,
71+ 0.453918357436013,
72+ 0.45963370959893,
73+ 0.465200734435209,
74+ 0.470623281400702,
75+ 0.475905100048492,
76+ 0.481049842621618,
77+ 0.486061066578505,
78+ 0.490942237052855,
79+ 0.495696729249701,
80+ 0.500327830779275,
81+ 0.504838743930304,
82+ 0.509232587884315,
83+ 0.513512400872467,
84+ 0.51768114227641,
85+ 0.521741694674624,
86+ 0.525696865835649
87+ ]
88+ },
89+ "egarch11_t": {
90+ "converged": true,
91+ "loglik": -3376.68334976327,
92+ "coef": {
93+ "mu": 0.0188171893640434,
94+ "omega": -0.0170849884697369,
95+ "alpha1": -0.0444147835573704,
96+ "beta1": 0.968708686881274,
97+ "gamma1": 0.156456196163122,
98+ "shape": 6.99039734118426
99+ },
100+ "sigma2_last5": [
101+ 0.328885250801329,
102+ 0.350822965161747,
103+ 0.436863315480211,
104+ 0.499447742972208,
105+ 0.479693397387017
106+ ],
107+ "fc": [
108+ 0.440981758288812,
109+ 0.444761569483677,
110+ 0.448453995963031,
111+ 0.452060109871317,
112+ 0.455581032094569,
113+ 0.45901792729419,
114+ 0.462371999182192,
115+ 0.4656444860341,
116+ 0.468836656435033,
117+ 0.471949805253863,
118+ 0.474985249839914,
119+ 0.477944326436176,
120+ 0.480828386802756,
121+ 0.483638795043929,
122+ 0.486376924632017,
123+ 0.489044155621135,
124+ 0.491641872043739,
125+ 0.494171459482879,
126+ 0.49663430281301,
127+ 0.499031784102273,
128+ 0.501365280669172,
129+ 0.503636163286671
130+ ]
131+ },
132+ "aparch11_t": {
133+ "converged": true,
134+ "loglik": -3372.84892807275,
135+ "coef": {
136+ "mu": 0.0219498032140538,
137+ "omega": 0.0182869465555667,
138+ "alpha1": 0.0734928958434684,
139+ "beta1": 0.901720469927853,
140+ "gamma1": 0.230203192227028,
141+ "delta": 1.84060080476714,
142+ "shape": 7.0279389234871
143+ },
144+ "sigma2_last5": [
145+ 0.332682598703389,
146+ 0.342687583247142,
147+ 0.423457812590537,
148+ 0.47031035284744,
149+ 0.448241954551476
150+ ],
151+ "fc": [
152+ 0.420729778911146,
153+ 0.426946162214478,
154+ 0.433001778704925,
155+ 0.438900519070086,
156+ 0.444646200595584,
157+ 0.450242566618973,
158+ 0.455693286232804,
159+ 0.461001954204718,
160+ 0.46617209108646,
161+ 0.471207143487254,
162+ 0.476110484489945,
163+ 0.48088541419098,
164+ 0.485535160347515,
165+ 0.490062879116947,
166+ 0.494471655875874,
167+ 0.498764506106986,
168+ 0.502944376343734,
169+ 0.507014145163756,
170+ 0.510976624223076,
171+ 0.514834559323999,
172+ 0.518590631510407,
173+ 0.522247458184874
174+ ]
175+ },
176+ "figarch11_t": {
177+ "converged": true,
178+ "loglik": -3381.97980336414,
179+ "coef": {
180+ "mu": 0.028208711165193,
181+ "omega": 0.0134114399389171,
182+ "alpha1": 0.26282947219305,
183+ "beta1": 0.780139313197165,
184+ "delta": 0.631140189523463,
185+ "shape": 6.41803885552558
186+ },
187+ "sigma2_last5": [
188+ 0.299696988917735,
189+ 0.316330648317056,
190+ 0.390432077409812,
191+ 0.384885199689091,
192+ 0.343022844513784
193+ ],
194+ "fc": [
195+ 0.339059269752477,
196+ 0.367590095570308,
197+ 0.368843743107776,
198+ 0.370160945435298,
199+ 0.373457632868578,
200+ 0.377938383945126,
201+ 0.382963124329593,
202+ 0.388198567929454,
203+ 0.393484081477849,
204+ 0.398744620082659,
205+ 0.403945640040183,
206+ 0.409071431842686,
207+ 0.414115967772256,
208+ 0.419078001693844,
209+ 0.423958280305449,
210+ 0.42875861007803,
211+ 0.433481497208184,
212+ 0.438129181396169,
213+ 0.442704763673238,
214+ 0.447212036971553,
215+ 0.451653257516078,
216+ 0.456031281967143
217+ ]
218+ },
219+ "igarch11_t": {
220+ "converged": true,
221+ "loglik": -3385.51714991758,
222+ "coef": {
223+ "mu": 0.0273555996213812,
224+ "omega": 0.00822664842815519,
225+ "alpha1": 0.0911285633973949,
226+ "beta1": 0.908871436602605,
227+ "shape": 5.98132454596413
228+ },
229+ "sigma2_last5": [
230+ 0.301577365761645,
231+ 0.303442040727677,
232+ 0.367868964109828,
233+ 0.402485492370637,
234+ 0.380584653228751
235+ ],
236+ "fc": [
237+ 0.355184003263419,
238+ 0.363410651691574,
239+ 0.371637300119729,
240+ 0.379863948547884,
241+ 0.388090596976039,
242+ 0.396317245404194,
243+ 0.40454389383235,
244+ 0.412770542260505,
245+ 0.42099719068866,
246+ 0.429223839116815,
247+ 0.43745048754497,
248+ 0.445677135973126,
249+ 0.453903784401281,
250+ 0.462130432829436,
251+ 0.470357081257591,
252+ 0.478583729685746,
253+ 0.486810378113901,
254+ 0.495037026542057,
255+ 0.503263674970212,
256+ 0.511490323398367,
257+ 0.519716971826522,
258+ 0.527943620254678
259+ ]
260+ },
261+ "cgarch11_t": {
262+ "converged": true,
263+ "loglik": -3379.76186721388,
264+ "coef": {
265+ "mu": 0.0273402099302754,
266+ "omega": 0.0178411646698263,
267+ "alpha1": 0.0472240690102781,
268+ "beta1": 0.926336229155417,
269+ "eta11": 0.973560849178106,
270+ "eta21": 0.0299126275164861,
271+ "shape": 6.89529147023611
272+ },
273+ "sigma2_last5": [
274+ 0.331806400268661,
275+ 0.333156933397685,
276+ 0.387466733404178,
277+ 0.415888052702624,
278+ 0.3961973946619
279+ ],
280+ "fc": [
281+ 0.373894792219397,
282+ 0.410734909756006,
283+ 0.417716681277378,
284+ 0.424513858333285,
285+ 0.431131321506913,
286+ 0.437573822341324,
287+ 0.443845986751214,
288+ 0.449952318344464,
289+ 0.455897201655865,
290+ 0.461684905295354,
291+ 0.467319585013005,
292+ 0.472805286682989,
293+ 0.478145949208632,
294+ 0.483345407350674,
295+ 0.488407394480744,
296+ 0.493335545262035,
297+ 0.498133398259106,
298+ 0.50280439847868,
299+ 0.507351899843266,
300+ 0.511779167599379,
301+ 0.516089380662085,
302+ 0.520285633897565
303+ ]
304+ },
305+ "nagarch11_t": {
306+ "converged": true,
307+ "loglik": -3373.35050140171,
308+ "coef": {
309+ "mu": 0.0213271608385587,
310+ "omega": 0.0169277508131017,
311+ "alpha1": 0.0706508464116506,
312+ "beta1": 0.895992701235594,
313+ "eta21": 0.339825862746243,
314+ "shape": 7.06871565857494
315+ },
316+ "sigma2_last5": [
317+ 0.320085472046233,
318+ 0.335215163198902,
319+ 0.410709126156738,
320+ 0.458799430333668,
321+ 0.445128729120879
322+ ],
323+ "fc": [
324+ 0.423373945827428,
325+ 0.429633698461851,
326+ 0.435735720488707,
327+ 0.441683986337342,
328+ 0.447482370291107,
329+ 0.453134649010792,
330+ 0.458644503994484,
331+ 0.464015523975432,
332+ 0.469251207259498,
333+ 0.474354964003706,
334+ 0.479330118437384,
335+ 0.484179911027331,
336+ 0.488907500588426,
337+ 0.493515966341068,
338+ 0.498008309916754,
339+ 0.502387457313138,
340+ 0.50665626079982,
341+ 0.510817500776111,
342+ 0.514873887581995,
343+ 0.518828063263449,
344+ 0.522682603293291,
345+ 0.526440018248661
346+ ]
347+ },
348+ "tgarch11_t": {
349+ "converged": true,
350+ "loglik": -3378.26565819207,
351+ "coef": {
352+ "mu": 0.0185075851662991,
353+ "omega": 0.0237242658452512,
354+ "alpha1": 0.0806721422971265,
355+ "beta1": 0.908415590277261,
356+ "eta11": 0.278262852619424,
357+ "shape": 7.02369203281082
358+ },
359+ "sigma2_last5": [
360+ 0.339303507806645,
361+ 0.361929596403121,
362+ 0.446541788728846,
363+ 0.509029924970293,
364+ 0.488014547239253
365+ ],
366+ "fc": [
367+ 0.446902528383541,
368+ 0.451531432310373,
369+ 0.456042749975163,
370+ 0.460438686643197,
371+ 0.464721461954639,
372+ 0.468893304636195,
373+ 0.472956447662954,
374+ 0.476913123839437,
375+ 0.480765561770887,
376+ 0.484515982197637,
377+ 0.488166594667179,
378+ 0.49171959452015,
379+ 0.495177160168002,
380+ 0.498541450641537,
381+ 0.501814603390865,
382+ 0.504998732318567,
383+ 0.508095926029051,
384+ 0.511108246278208,
385+ 0.514037726608485,
386+ 0.516886371155493,
387+ 0.519656153613176,
388+ 0.522349016345428
389+ ]
390+ },
391+ "realgarch11_n": {
392+ "converged": false
393+ },
394+ "garch11_skewt": {
395+ "converged": true,
396+ "loglik": -3379.31479592696,
397+ "coef": {
398+ "mu": 0.0247602319116539,
399+ "omega": 0.017295740459104,
400+ "alpha1": 0.0762213395583014,
401+ "beta1": 0.89844516796877,
402+ "skew": 0.984514907132941,
403+ "shape": 6.94374052154004
404+ },
405+ "sigma2_last5": [
406+ 0.330905238634026,
407+ 0.332071373500861,
408+ 0.385400191269274,
409+ 0.413348758343739,
410+ 0.394040260337795
411+ ],
412+ "fc": [
413+ 0.372159534757372,
414+ 0.380027174443972,
415+ 0.387695499339791,
416+ 0.395169558784582,
417+ 0.402454274200687,
418+ 0.40955444233363,
419+ 0.41647473841062,
420+ 0.423219719219034,
421+ 0.429793826106908,
422+ 0.436201387907421,
423+ 0.442446623789292,
424+ 0.448533646034957,
425+ 0.454466462748379,
426+ 0.460248980494249,
427+ 0.465885006870329,
428+ 0.471378253014633,
429+ 0.476732336049089,
430+ 0.481950781461291,
431+ 0.487037025425924,
432+ 0.491994417067363,
433+ 0.496826220664968,
434+ 0.501535617802502
435+ ]
436+ },
437+ "garchx_return_eq_n": {
438+ "converged": true,
439+ "loglik": -3439.50244888177,
440+ "coef": {
441+ "mu": 0.0278142395098893,
442+ "omega": 0.0167914737741274,
443+ "alpha1": 0.0689220579092629,
444+ "beta1": 0.905579848348357,
445+ "vxreg1": 1.11213028413993e-08
446+ }
447+ },
448+ "gas_t": {
449+ "converged": false,
450+ "note": "no likelihood returned"
451+ },
452+ "msgarch2_n": {
453+ "converged": true,
454+ "loglik": -3379.75350473294,
455+ "par": {
456+ "alpha0_1": 0.0121433325060601,
457+ "alpha1_1": 0.0585182450578886,
458+ "beta_1": 0.894015416316548,
459+ "alpha0_2": 0.0482276387341687,
460+ "alpha1_2": 0.0517716333302828,
461+ "beta_2": 0.947079214860811,
462+ "P_1_1": 0.881774029508407,
463+ "P_2_1": 0.693342491750305
464+ },
465+ "vol_forecast": [
466+ 0.615970885558516,
467+ 0.6303617363426,
468+ 0.631160337243255,
469+ 0.639653937388817,
470+ 0.645631332725677,
471+ 0.653465609161924,
472+ 0.65295344788399,
473+ 0.6615238072602,
474+ 0.660162321917012,
475+ 0.669886959891323,
476+ 0.66992066156622,
477+ 0.673526448521064,
478+ 0.666070626136798,
479+ 0.6755850647223,
480+ 0.678013440089674,
481+ 0.689272697602726,
482+ 0.685925162264115,
483+ 0.695463106233779,
484+ 0.705379153873899,
485+ 0.689972030311842,
486+ 0.693895637178063,
487+ 0.704494938686491
488+ ],
489+ "mean_removed": 0.0148342275072134
490+ }
491+ },
492+ "ours": {
493+ "garch11_t": {
494+ "loglik": -3379.461796995996,
495+ "params": {
496+ "mu": 0.0272552165475274,
497+ "omega": 0.017418392193745573,
498+ "alpha[1]": 0.0766713206199158,
499+ "beta[1]": 0.8979047644168446,
500+ "nu": 6.915683563286161
501+ },
502+ "converged": true
503+ },
504+ "gjr11_t": {
505+ "loglik": -3372.953632113916,
506+ "params": {
507+ "mu": 0.02234711621886731,
508+ "omega": 0.017500497241068884,
509+ "alpha[1]": 0.04266800772043423,
510+ "gamma[1]": 0.062034959552290915,
511+ "beta[1]": 0.9003610818426231,
512+ "nu": 7.002485146679242
513+ },
514+ "converged": true
515+ },
516+ "egarch11_t": {
517+ "loglik": -3376.6704308851477,
518+ "params": {
519+ "mu": 0.018828915964200128,
520+ "omega": -0.011034952859929866,
521+ "alpha[1]": 0.15651669565747273,
522+ "gamma[1]": -0.044438618764715755,
523+ "beta[1]": 0.9686789065580167,
524+ "nu": 6.98363424230133
525+ },
526+ "converged": true
527+ },
528+ "aparch11_t": {
529+ "loglik": -3372.7593223523118,
530+ "params": {
531+ "mu": 0.021873566385943646,
532+ "omega": 0.01845096728792146,
533+ "alpha[1]": 0.0741123489743683,
534+ "gamma[1]": 0.23185125233775555,
535+ "beta[1]": 0.9019093525442575,
536+ "delta": 1.810851742298129,
537+ "nu": 7.017009293700917
538+ },
539+ "converged": true
540+ },
541+ "figarch11_t": {
542+ "loglik": -3383.4506039107964,
543+ "params": {
544+ "mu": 0.027341455003779366,
545+ "omega": 0.018557454873431037,
546+ "phi": 0.2272419820409831,
547+ "d": 0.545516035918098,
548+ "beta": 0.6927227001090212,
549+ "nu": 6.4546568465574365
550+ },
551+ "converged": true
552+ },
553+ "garch11_skewt": {
554+ "loglik": -3379.275642878361,
555+ "params": {
556+ "mu": 0.0247698562671931,
557+ "omega": 0.017301334377567416,
558+ "alpha[1]": 0.07625585117671085,
559+ "beta[1]": 0.8984117763911253,
560+ "eta": 6.936304710964621,
561+ "lambda": -0.01552668380206145
562+ },
563+ "converged": true
564+ },
565+ "igarch11_t": {
566+ "loglik": -3385.466983993589,
567+ "params": {
568+ "mu": 0.027354323480404286,
569+ "omega": 0.008236861969721824,
570+ "alpha": 0.09116543468488557,
571+ "nu": 5.973513461861548
572+ },
573+ "converged": true
574+ },
575+ "cgarch11_t": {
576+ "loglik": -3379.461678802403,
577+ "params": {
578+ "mu": 0.027257000911121945,
579+ "omega": 0.01736733788836256,
580+ "rho": 0.9746416050735823,
581+ "phi": 0.03393172704779641,
582+ "alpha": 0.04272735073115051,
583+ "beta": 0.9317694810875947,
584+ "nu": 6.9169232979627395
585+ },
586+ "converged": true
587+ },
588+ "nagarch11_t": {
589+ "loglik": -3373.3123413949697,
590+ "params": {
591+ "mu": 0.02133256452316757,
592+ "omega": 0.016934592629425642,
593+ "alpha": 0.07068774289404209,
594+ "theta": 0.3397290537185268,
595+ "beta": 0.8959513510919638,
596+ "nu": 7.06163608387285
597+ },
598+ "converged": true
599+ },
600+ "realgarch11_n": {
601+ "loglik": -4989.212643221531,
602+ "params": {
603+ "mu": 0.01677936657297113,
604+ "omega": -0.0310098669169496,
605+ "beta": 0.7043221645737289,
606+ "gamma": 0.2567538036768552,
607+ "xi": 0.04191198028547544,
608+ "phi": 1.0024048779109547,
609+ "tau1": 0.0010267719765093414,
610+ "tau2": 0.013224579404035812,
611+ "log_sigma_u": -0.9137863869883917
612+ },
613+ "converged": true
614+ },
615+ "tgarch11_t": {
616+ "loglik": -3377.90868846069,
617+ "params": {
618+ "mu": 0.01844910102802636,
619+ "omega": 0.023611385500910617,
620+ "alpha[1]": 0.057964365256935116,
621+ "gamma[1]": 0.044879036112941945,
622+ "beta[1]": 0.9087627957941734,
623+ "nu": 7.008124248061719
624+ }
625+ },
626+ "garchx_return_eq_n": {
627+ "loglik_return_eq": -3438.586220723607,
628+ "params": {
629+ "mu": 0.02479808355478625,
630+ "omega": 0.012594718447088777,
631+ "alpha": 0.06357846956031842,
632+ "gamma": 0.03014516962527771,
633+ "beta": 0.8836427005054038,
634+ "omega_r": 0.02806809415988359,
635+ "alpha_r": 0.25763411206863546,
636+ "beta_r": 0.703096461404205
637+ }
638+ },
639+ "gas_t": {
640+ "loglik": -3382.3247298931783,
641+ "params": {
642+ "mu": 0.026563394804317145,
643+ "omega": 0.01752968423127462,
644+ "alpha": 0.07009304684270816,
645+ "beta": 0.9731633946984728,
646+ "nu": 7.482311787452809
647+ }
648+ },
649+ "msgarch2_n": {
650+ "loglik": -3380.1503040341104,
651+ "params": {
652+ "mu": 0.028792532353829083,
653+ "p11": 0.8525826361976698,
654+ "p22": 0.2884378038218934,
655+ "omega1": 0.010424987363004993,
656+ "alpha1": 0.05685929239804599,
657+ "beta1": 0.8958063753292224,
658+ "omega2": 0.06784174791879186,
659+ "alpha2": 0.07829796399601435,
660+ "beta2": 0.9217015511532453
661+ },
662+ "var_forecast": [
663+ 0.3882185430826159,
664+ 0.4044774039047424,
665+ 0.41326620367625855,
666+ 0.42075509939894873,
667+ 0.42782720411159547,
668+ 0.43461678979854085,
669+ 0.441151672526237,
670+ 0.4474442041543941,
671+ 0.4535041795225775,
672+ 0.4593406834445015,
673+ 0.46496237003000207,
674+ 0.47037751887572055,
675+ 0.47559405863822757,
676+ 0.48061958504571256,
677+ 0.48546137724718086,
678+ 0.49012641311300276,
679+ 0.494621383630559,
680+ 0.4989527064677157,
681+ 0.5031265387627439,
682+ 0.5071487891935675,
683+ 0.5110251293749857,
684+ 0.5147610046287768
685+ ]
686+ }
687+ },
688+ "comparison": {
689+ "garch11_t": {
690+ "rugarch_loglik": -3379.50279602402,
691+ "ours_loglik": -3379.461796995996,
692+ "rugarch_coef": {
693+ "mu": 0.0272520855544271,
694+ "omega": 0.0174152246241149,
695+ "alpha1": 0.0766441622812045,
696+ "beta1": 0.897925769946588,
697+ "shape": 6.92334228660823
698+ },
699+ "ours_params": {
700+ "mu": 0.0272552165475274,
701+ "omega": 0.017418392193745573,
702+ "alpha[1]": 0.0766713206199158,
703+ "beta[1]": 0.8979047644168446,
704+ "nu": 6.915683563286161
705+ },
706+ "diff": 0.04099902802408906
707+ },
708+ "gjr11_t": {
709+ "rugarch_loglik": -3372.99049098085,
710+ "ours_loglik": -3372.953632113916,
711+ "rugarch_coef": {
712+ "mu": 0.0223490291478538,
713+ "omega": 0.0174956405075909,
714+ "alpha1": 0.0426372227127993,
715+ "beta1": 0.900398468982572,
716+ "gamma1": 0.0620237392157647,
717+ "shape": 7.00993566707479
718+ },
719+ "ours_params": {
720+ "mu": 0.02234711621886731,
721+ "omega": 0.017500497241068884,
722+ "alpha[1]": 0.04266800772043423,
723+ "gamma[1]": 0.062034959552290915,
724+ "beta[1]": 0.9003610818426231,
725+ "nu": 7.002485146679242
726+ },
727+ "diff": 0.036858866934380785
728+ },
729+ "egarch11_t": {
730+ "rugarch_loglik": -3376.68334976327,
731+ "ours_loglik": -3376.6704308851477,
732+ "rugarch_coef": {
733+ "mu": 0.0188171893640434,
734+ "omega": -0.0170849884697369,
735+ "alpha1": -0.0444147835573704,
736+ "beta1": 0.968708686881274,
737+ "gamma1": 0.156456196163122,
738+ "shape": 6.99039734118426
739+ },
740+ "ours_params": {
741+ "mu": 0.018828915964200128,
742+ "omega": -0.011034952859929866,
743+ "alpha[1]": 0.15651669565747273,
744+ "gamma[1]": -0.044438618764715755,
745+ "beta[1]": 0.9686789065580167,
746+ "nu": 6.98363424230133
747+ },
748+ "diff": 0.01291887812249115
749+ },
750+ "aparch11_t": {
751+ "rugarch_loglik": -3372.84892807275,
752+ "ours_loglik": -3372.7593223523118,
753+ "rugarch_coef": {
754+ "mu": 0.0219498032140538,
755+ "omega": 0.0182869465555667,
756+ "alpha1": 0.0734928958434684,
757+ "beta1": 0.901720469927853,
758+ "gamma1": 0.230203192227028,
759+ "delta": 1.84060080476714,
760+ "shape": 7.0279389234871
761+ },
762+ "ours_params": {
763+ "mu": 0.021873566385943646,
764+ "omega": 0.01845096728792146,
765+ "alpha[1]": 0.0741123489743683,
766+ "gamma[1]": 0.23185125233775555,
767+ "beta[1]": 0.9019093525442575,
768+ "delta": 1.810851742298129,
769+ "nu": 7.017009293700917
770+ },
771+ "diff": 0.08960572043815773
772+ },
773+ "figarch11_t": {
774+ "rugarch_loglik": -3381.97980336414,
775+ "ours_loglik": -3383.4506039107964,
776+ "rugarch_coef": {
777+ "mu": 0.028208711165193,
778+ "omega": 0.0134114399389171,
779+ "alpha1": 0.26282947219305,
780+ "beta1": 0.780139313197165,
781+ "delta": 0.631140189523463,
782+ "shape": 6.41803885552558
783+ },
784+ "ours_params": {
785+ "mu": 0.027341455003779366,
786+ "omega": 0.018557454873431037,
787+ "phi": 0.2272419820409831,
788+ "d": 0.545516035918098,
789+ "beta": 0.6927227001090212,
790+ "nu": 6.4546568465574365
791+ },
792+ "diff": -1.4708005466563918
793+ },
794+ "igarch11_t": {
795+ "rugarch_loglik": -3385.51714991758,
796+ "ours_loglik": -3385.466983993589,
797+ "rugarch_coef": {
798+ "mu": 0.0273555996213812,
799+ "omega": 0.00822664842815519,
800+ "alpha1": 0.0911285633973949,
801+ "beta1": 0.908871436602605,
802+ "shape": 5.98132454596413
803+ },
804+ "ours_params": {
805+ "mu": 0.027354323480404286,
806+ "omega": 0.008236861969721824,
807+ "alpha": 0.09116543468488557,
808+ "nu": 5.973513461861548
809+ },
810+ "diff": 0.05016592399078945
811+ },
812+ "cgarch11_t": {
813+ "rugarch_loglik": -3379.76186721388,
814+ "ours_loglik": -3379.461678802403,
815+ "rugarch_coef": {
816+ "mu": 0.0273402099302754,
817+ "omega": 0.0178411646698263,
818+ "alpha1": 0.0472240690102781,
819+ "beta1": 0.926336229155417,
820+ "eta11": 0.973560849178106,
821+ "eta21": 0.0299126275164861,
822+ "shape": 6.89529147023611
823+ },
824+ "ours_params": {
825+ "mu": 0.027257000911121945,
826+ "omega": 0.01736733788836256,
827+ "rho": 0.9746416050735823,
828+ "phi": 0.03393172704779641,
829+ "alpha": 0.04272735073115051,
830+ "beta": 0.9317694810875947,
831+ "nu": 6.9169232979627395
832+ },
833+ "diff": 0.3001884114769382
834+ },
835+ "nagarch11_t": {
836+ "rugarch_loglik": -3373.35050140171,
837+ "ours_loglik": -3373.3123413949697,
838+ "rugarch_coef": {
839+ "mu": 0.0213271608385587,
840+ "omega": 0.0169277508131017,
841+ "alpha1": 0.0706508464116506,
842+ "beta1": 0.895992701235594,
843+ "eta21": 0.339825862746243,
844+ "shape": 7.06871565857494
845+ },
846+ "ours_params": {
847+ "mu": 0.02133256452316757,
848+ "omega": 0.016934592629425642,
849+ "alpha": 0.07068774289404209,
850+ "theta": 0.3397290537185268,
851+ "beta": 0.8959513510919638,
852+ "nu": 7.06163608387285
853+ },
854+ "diff": 0.038160006740326935
855+ },
856+ "garch11_skewt": {
857+ "rugarch_loglik": -3379.31479592696,
858+ "ours_loglik": -3379.275642878361,
859+ "rugarch_coef": {
860+ "mu": 0.0247602319116539,
861+ "omega": 0.017295740459104,
862+ "alpha1": 0.0762213395583014,
863+ "beta1": 0.89844516796877,
864+ "skew": 0.984514907132941,
865+ "shape": 6.94374052154004
866+ },
867+ "ours_params": {
868+ "mu": 0.0247698562671931,
869+ "omega": 0.017301334377567416,
870+ "alpha[1]": 0.07625585117671085,
871+ "beta[1]": 0.8984117763911253,
872+ "eta": 6.936304710964621,
873+ "lambda": -0.01552668380206145
874+ },
875+ "diff": 0.0391530485990188
876+ },
877+ "realgarch11_n": {
878+ "rugarch_loglik": null,
879+ "ours_loglik": -4989.212643221531,
880+ "rugarch_coef": null,
881+ "ours_params": {
882+ "mu": 0.01677936657297113,
883+ "omega": -0.0310098669169496,
884+ "beta": 0.7043221645737289,
885+ "gamma": 0.2567538036768552,
886+ "xi": 0.04191198028547544,
887+ "phi": 1.0024048779109547,
888+ "tau1": 0.0010267719765093414,
889+ "tau2": 0.013224579404035812,
890+ "log_sigma_u": -0.9137863869883917
891+ },
892+ "diff": null
893+ }
894+ }
895+}
\ No newline at end of file
modified scripts/build_paper.py +3 −0
@@ -99,6 +99,9 @@ def main() -> None:
99 TB.pooled_table(P, tierA, labels, tdir / "tab_pooled_tierA.tex") 99 TB.pooled_table(P, tierA, labels, tdir / "tab_pooled_tierA.tex")
100 TB.pooled_table(P, tierB, labels, tdir / "tab_pooled_tierB.tex") 100 TB.pooled_table(P, tierB, labels, tdir / "tab_pooled_tierB.tex")
101 TB.accounting_table(A, labels, tdir / "tab_accounting.tex") 101 TB.accounting_table(A, labels, tdir / "tab_accounting.tex")
102+ cc = ROOT / "results" / "metrics" / "rugarch_crosscheck.json"
103+ if cc.exists():
104+ TB.crosscheck_table(json.load(open(cc)), tdir / "tab_crosscheck.tex")
102 # --- figures 105 # --- figures
103 F.ratio_heatmap(per_symbol, 1, tierA, F.FIG / "fig_heatmap_h1_tierA.pdf", "Tier A, h = 1") 106 F.ratio_heatmap(per_symbol, 1, tierA, F.FIG / "fig_heatmap_h1_tierA.pdf", "Tier A, h = 1")
104 F.ratio_heatmap(per_symbol, 22, tierA, F.FIG / "fig_heatmap_h22_tierA.pdf", "Tier A, h = 22") 107 F.ratio_heatmap(per_symbol, 22, tierA, F.FIG / "fig_heatmap_h22_tierA.pdf", "Tier A, h = 22")
modified src/wp46/reporting/tables.py +32 −0
@@ -40,3 +40,35 @@ def accounting_table(A: pd.DataFrame, labels: dict, path: Path) -> None:
40 rows.append(f"{labels.get(r.spec_id, r.spec_id)} & {fmt(100*r.failed,1)} & {fmt(100*r.inadmissible,1)} & {fmt(100*r.coverage,1)} & {fmt(r.fit_time_median,3)} & {fmt(r.iter_mean,0)} \\\\") 40 rows.append(f"{labels.get(r.spec_id, r.spec_id)} & {fmt(100*r.failed,1)} & {fmt(100*r.inadmissible,1)} & {fmt(100*r.coverage,1)} & {fmt(r.fit_time_median,3)} & {fmt(r.iter_mean,0)} \\\\")
41 head = "\\begin{tabular}{lrrrrr}\n\\toprule\nModel & Failed (\\%) & Inadmissible (\\%) & Coverage (\\%) & Median refit (s) & Iterations \\\\\n\\midrule\n" 41 head = "\\begin{tabular}{lrrrrr}\n\\toprule\nModel & Failed (\\%) & Inadmissible (\\%) & Coverage (\\%) & Median refit (s) & Iterations \\\\\n\\midrule\n"
42 path.write_text(head + "\n".join(rows) + "\n\\bottomrule\n\\end{tabular}\n") 42 path.write_text(head + "\n".join(rows) + "\n\\bottomrule\n\\end{tabular}\n")
43+
44+
45+def crosscheck_table(cc: dict, path: Path) -> None:
46+ """results/metrics/rugarch_crosscheck.json -> LaTeX rows (model, R package/model, R loglik, ours, difference, note)."""
47+ R, O = cc.get("rugarch", {}), cc.get("ours", {})
48+ rows = []
49+ spec = [("garch11_t", "GARCH(1,1)-$t$", "rugarch sGARCH"), ("garch11_skewt", "GARCH(1,1)-skew-$t$", "rugarch sGARCH/sstd"),
50+ ("gjr11_t", "GJR(1,1)-$t$", "rugarch gjrGARCH"), ("tgarch11_t", "TGARCH(1,1)-$t$", "rugarch fGARCH/TGARCH"),
51+ ("egarch11_t", "EGARCH(1,1)-$t$", "rugarch eGARCH"), ("aparch11_t", "APARCH(1,1)-$t$", "rugarch apARCH"),
52+ ("figarch11_t", "FIGARCH(1,$d$,1)-$t$", "rugarch fiGARCH"), ("igarch11_t", "IGARCH(1,1)-$t$", "rugarch iGARCH"),
53+ ("cgarch11_t", "Component GARCH-$t$", "rugarch csGARCH"), ("nagarch11_t", "NAGARCH(1,1)-$t$", "rugarch fGARCH/NAGARCH"),
54+ ("realgarch11_n", "Realized GARCH(1,1)-N", "rugarch realGARCH"), ("garchx_return_eq_n", "GARCH-X(1,1)-N (return eq.)", "rugarch sGARCH + vxreg"),
55+ ("msgarch2_n", "MS-GARCH(2)-N", "MSGARCH FitML"), ("gas_t", "GAS-$t$(1,1)", "GAS (scale parameterization; reference)")]
56+ for key, lab, pkg in spec:
57+ r = R.get(key, {}); o = O.get(key, {})
58+ rl = r.get("loglik") if r.get("converged") else None
59+ rl = float(np.ravel(rl)[0]) if rl is not None and np.size(rl) else None
60+ ol = o.get("loglik_return_eq", o.get("loglik"))
61+ note = ""
62+ if key == "realgarch11_n" and rl is None:
63+ note = "R fit did not converge"
64+ if key == "garchx_return_eq_n":
65+ note = "per-observation comparison (R drops one obs.)"
66+ if key == "msgarch2_n" and r.get("converged") and o.get("var_forecast"):
67+ vf = np.asarray(r["vol_forecast"]) ** 2; rel = np.max(np.abs(np.asarray(o["var_forecast"]) - vf) / vf)
68+ note = f"22-step variance forecasts within {100*rel:.1f}\\%"
69+ if key == "gas_t":
70+ note = "different parameterization, not comparable"
71+ diff = fmt(ol - rl) if (ol is not None and rl is not None and key not in ("garchx_return_eq_n", "gas_t")) else "--"
72+ rows.append(f"{lab} & {pkg} & {fmt(rl, 2) if rl is not None else '--'} & {fmt(ol, 2) if ol is not None else '--'} & {diff} & {note} \\\\")
73+ head = "\\begin{tabular}{llrrrl}\n\\toprule\nModel & R reference & R log-lik. & Ours & Diff. & Note \\\\\n\\midrule\n"
74+ path.write_text(head + "\n".join(rows) + "\n\\bottomrule\n\\end{tabular}\n")
modified tests/replication/rugarch_crosscheck.R +1 −1
@@ -37,7 +37,7 @@ if (requireNamespace("GAS", quietly = TRUE)) {
37 suppressPackageStartupMessages(library(GAS)) 37 suppressPackageStartupMessages(library(GAS))
38 gs <- UniGASSpec(Dist = "std", ScalingType = "Inv", GASPar = list(location = FALSE, scale = TRUE, shape = FALSE)) 38 gs <- UniGASSpec(Dist = "std", ScalingType = "Inv", GASPar = list(location = FALSE, scale = TRUE, shape = FALSE))
39 gf <- tryCatch(UniGASFit(gs, r), error = function(e) NULL) 39 gf <- tryCatch(UniGASFit(gs, r), error = function(e) NULL)
40− out2$gas_t <- tryCatch(if (!is.null(gf)) list(converged = TRUE, loglik = as.numeric(gf@Estimates$lLik), coef = as.list(gf@Estimates$lParList)) else list(converged = FALSE), error = function(e) list(converged = FALSE, error = conditionMessage(e))) 40+ out2$gas_t <- tryCatch(if (!is.null(gf) && length(gf@Estimates$lLik) > 0) list(converged = TRUE, loglik = as.numeric(gf@Estimates$lLik)[1], coef = as.list(gf@Estimates$lParList), note = "GAS package parameterizes the t scale, not the variance: inverse-information scaling is not invariant, so this is a reference value, not the same model") else list(converged = FALSE, note = "no likelihood returned"), error = function(e) list(converged = FALSE, error = conditionMessage(e)))
41 } 41 }
42 if (requireNamespace("MSGARCH", quietly = TRUE)) { 42 if (requireNamespace("MSGARCH", quietly = TRUE)) {
43 suppressPackageStartupMessages(library(MSGARCH)) 43 suppressPackageStartupMessages(library(MSGARCH))
modified tests/replication/test_rugarch.py +7 −6
@@ -93,22 +93,23 @@ def test_extended_crosschecks():
93 ours["garchx_return_eq_n"] = dict(loglik_return_eq=ll_r, params=dict(zip(fx.param_names, map(float, fx.params)))) 93 ours["garchx_return_eq_n"] = dict(loglik_return_eq=ll_r, params=dict(zip(fx.param_names, map(float, fx.params))))
94 rg = R["rugarch"].get("garchx_return_eq_n", {}) 94 rg = R["rugarch"].get("garchx_return_eq_n", {})
95 if rg.get("converged"): 95 if rg.get("converged"):
96− # rugarch drops the first observation (lagged regressor): compare per-observation averages 96+ # rugarch drops the first observation (lagged regressor) and may stop at gamma = 0 (nested in our model):
97− assert abs(ll_r / len(r) - rg["loglik"] / (len(r) - 1)) < 0.01 97+ # our return-equation likelihood per observation must not be below rugarch's
98− assert abs(fx.param("gamma") - rg["coef"]["vxreg1"]) < 0.05 98+ assert ll_r / len(r) >= rg["loglik"] / (len(r) - 1) - 0.005, (ll_r / len(r), rg["loglik"] / (len(r) - 1))
99 # GAS-t 99 # GAS-t
100 fg = GAST11().fit(r, dist="t") 100 fg = GAST11().fit(r, dist="t")
101 ours["gas_t"] = dict(loglik=fg.loglik, params=dict(zip(fg.param_names, map(float, fg.params)))) 101 ours["gas_t"] = dict(loglik=fg.loglik, params=dict(zip(fg.param_names, map(float, fg.params))))
102 rg = R["rugarch"].get("gas_t", {}) 102 rg = R["rugarch"].get("gas_t", {})
103− if rg.get("converged"): 103+ if rg.get("converged") and np.size(rg.get("loglik")) > 0:
104− assert abs(fg.loglik - rg["loglik"]) < 2.0, (fg.loglik, rg["loglik"]) 104+ ours["gas_t"]["r_gas_loglik_reference"] = float(np.ravel(rg["loglik"])[0]) # different parameterization: reference only
105 # MS-GARCH 105 # MS-GARCH
106 fm = MSGARCH2().fit(r, dist="normal") 106 fm = MSGARCH2().fit(r, dist="normal")
107 fc = MSGARCH2().forecast(fm, r, None, 22) 107 fc = MSGARCH2().forecast(fm, r, None, 22)
108 ours["msgarch2_n"] = dict(loglik=fm.loglik, params=dict(zip(fm.param_names, map(float, fm.params))), var_forecast=[float(v) for v in fc.step_var]) 108 ours["msgarch2_n"] = dict(loglik=fm.loglik, params=dict(zip(fm.param_names, map(float, fm.params))), var_forecast=[float(v) for v in fc.step_var])
109 rg = R["rugarch"].get("msgarch2_n", {}) 109 rg = R["rugarch"].get("msgarch2_n", {})
110 if rg.get("converged"): 110 if rg.get("converged"):
111− assert fm.loglik >= rg["loglik"] - 2.0, (fm.loglik, rg["loglik"]) 111+ rl = float(np.ravel(rg["loglik"])[0])
112+ assert fm.loglik >= rl - 2.0, (fm.loglik, rl)
112 vf = np.asarray(rg["vol_forecast"]) ** 2 113 vf = np.asarray(rg["vol_forecast"]) ** 2
113 rel = np.abs(fc.step_var - vf) / vf 114 rel = np.abs(fc.step_var - vf) / vf
114 assert np.max(rel) < 0.10, rel # same multi-step recursion up to the parameter estimates 115 assert np.max(rel) < 0.10, rel # same multi-step recursion up to the parameter estimates
modified tests/unit/test_custom_models.py +11 −0
@@ -117,3 +117,14 @@ def test_qgarch_recovery_and_positivity():
117 assert f.converged and f.admissible 117 assert f.converged and f.admissible
118 assert abs(f.param("gamma") - ga) < 0.03 and abs(f.param("beta") - be) < 0.05 118 assert abs(f.param("gamma") - ga) < 0.03 and abs(f.param("beta") - be) < 0.05
119 assert f.param("gamma") ** 2 < 4 * f.param("alpha") * f.param("omega") 119 assert f.param("gamma") ** 2 < 4 * f.param("alpha") * f.param("omega")
120+
121+
122+def test_gas_t_nests_garch_as_nu_to_infinity():
123+ """With nu -> inf the GAS-t score is eps^2 - f, so the recursion equals GARCH(1,1) with alpha_G = alpha, beta_G = beta - alpha."""
124+ from wp46.models.custom import rec_garch, rec_gas_t
125+ eps = R[:1500] - R[:1500].mean(); s0 = float(np.var(eps))
126+ om, al, be = 0.05, 0.07, 0.95
127+ f = rec_gas_t(eps, om, al, be, 1e9, s0)
128+ g = rec_garch(eps, om, al, be - al, s0)
129+ # initializations differ (GAS starts at s0, GARCH at omega + (alpha+beta) s0) and the gap decays at rate beta_G
130+ assert np.max(np.abs(f[-300:] - g[-300:]) / g[-300:]) < 1e-6
120 131
Menu

Theme