Skip to contents

Generates shocks z_t = sqrt(h_t) * eps_t under a GARCH(1,1) recursion, with an optional threshold (leverage) term, for use as sim_psy1(..., e = sim_vol_garch(...)).

Usage

sim_vol_garch(n, omega = 0.1, alpha = 0.1, beta = 0.8, gamma = 0, seed = NULL)

Arguments

n

Number of innovations to generate.

omega, alpha, beta

Positive GARCH(1,1) parameters. Default (omega = 0.1, alpha = 0.1, beta = 0.8) matches Whitehouse, Harvey & Leybourne (2025) and Harvey, Leybourne, Taylor & Zu (2024).

gamma

Non-negative TGARCH leverage parameter. Monschang & Wilfling (2021)'s NASDAQ calibration is omega = 0.4387, alpha = 0, beta = 0.9319, gamma = 0.1306.

seed

An object specifying if and how the random number generator (rng) should be initialized. Either NULL or an integer will be used in a call to set.seed before simulation. If set, the value is saved as "seed" attribute of the returned value. The default, NULL, will not change rng state, and return .Random.seed as the "seed" attribute. Results are reproducible across the parallel and non-parallel option when the same seed is used.

Value

A numeric vector of length n.

Details

$$z_t = \sqrt{h_t}\,\epsilon_t,\quad h_t = \omega + \alpha z_{t-1}^2 + \beta h_{t-1} + \gamma z_{t-1}^2 1\{z_{t-1}<0\}$$

with \(\epsilon_t \sim NIID(0,1)\) and \(h_0 = z_0 = 0\). gamma = 0 (the default) is plain GARCH(1,1); gamma > 0 adds the TGARCH leverage effect (larger response to negative shocks).

References

Whitehouse, E.J., Harvey, D.I. & Leybourne, S.J. (2025). "Real-time monitoring of explosive financial bubbles." Monschang, V. & Wilfling, B. (2021). "Sup-ADF-style bubble-detection methods under test." Empirical Economics, 61, 145-172.

See also

Examples

sim_vol_garch(199, seed = 1)
#>   [1] -0.198102089  0.078758035 -0.415938150  0.896071264  0.216750260
#>   [6] -0.550911921  0.341561368  0.524416619  0.419609294 -0.224929676
#>  [11]  1.109948128  0.315372564 -0.494460495 -1.759600390  1.075833843
#>  [16] -0.043736688 -0.014997977  0.837057465  0.734198110  0.528985544
#>  [21]  0.802543572  0.688338110  0.065303161 -1.681009210  0.605339727
#>  [26] -0.053239132 -0.141081660 -1.280498133 -0.446086304  0.377585168
#>  [31]  1.190082519 -0.095066472  0.343527899 -0.046284343 -1.145694805
#>  [36] -0.367691445 -0.339533308 -0.049793538  0.896405822  0.643786670
#>  [41] -0.138700777 -0.207463388  0.557878558  0.446611962 -0.548803434
#>  [46] -0.565127041  0.292204134  0.606328594 -0.089504624  0.687358701
#>  [51]  0.317013366 -0.480871280  0.267944624 -0.875361753  1.161758511
#>  [56]  1.727337311 -0.368500596 -1.001042614  0.551051235 -0.126605781
#>  [61]  2.154292692 -0.043124919  0.712281976  0.028056452 -0.706377067
#>  [66]  0.176340905 -1.615478146  1.466894380  0.161944694  2.168191769
#>  [71]  0.555930201 -0.785570702  0.652427070 -0.959689167 -1.276329401
#>  [76]  0.304576037 -0.439503518  0.001051945  0.067505897 -0.513967803
#>  [81] -0.487366008 -0.114011965  0.964580548 -1.301153768  0.548485354
#>  [86]  0.300081547  0.926087231 -0.270850703  0.318648447  0.224019670
#>  [91] -0.443332916  0.976710503  0.983604062  0.615050310  1.378868877
#>  [96]  0.528110390 -1.172265360 -0.547463019 -1.135379723 -0.453222789
#> [101] -0.573225983  0.038042005 -0.790385081  0.138197089 -0.553005202
#> [106]  1.480261168  0.672469548  0.838897901  0.354198062  1.497545685
#> [111] -0.622337141 -0.439257520  1.315506565 -0.633526911 -0.196571853
#> [116] -0.356275652 -0.280939930 -0.237580893  0.409095987 -0.144603922
#> [121] -0.402882072  1.060470546 -0.180965767 -0.147221862 -0.080151437
#> [126]  0.557807728 -0.057981495 -0.029085879 -0.518211044 -0.248907852
#> [131]  0.045720182 -0.441574119  0.401024937 -1.147893294  0.254458654
#> [136] -1.246005515 -0.266050482 -0.452037464 -0.547985313 -0.047432058
#> [141] -1.550754296  1.094568613 -1.590171463 -0.482293797 -1.109955476
#> [146] -0.756306550  2.054493667  0.019813021 -1.372087966 -1.796092171
#> [151]  0.529121866 -0.020610040 -0.331546886 -0.920129897 -1.464108708
#> [156] -1.122245441  1.047644452 -0.647952400 -1.392836737  1.963866049
#> [161]  0.497326687 -0.263559110  1.101374616  0.924369678 -0.636166897
#> [166]  2.189267669 -0.298188250 -1.562140498 -0.165026850  0.222328230
#> [171]  2.334400330  0.127988695  0.515483618 -0.082536909 -0.336700350
#> [176] -0.033386159  0.721697986  1.883494046  1.084250209  1.271782966
#> [181] -1.319636802  1.074662216  0.237875083 -1.497443525  0.560553099
#> [186] -0.163248849  1.426451772 -0.789606256 -0.432835299 -0.892397504
#> [191] -0.170098616  0.368637799 -0.648856840  0.729179960 -1.060134857
#> [196] -0.953863098  1.331601335 -0.995482776  0.405192347
# NASDAQ-calibrated TGARCH (Monschang & Wilfling 2021)
sim_vol_garch(199, omega = 0.4387, alpha = 0, beta = 0.9319, gamma = 0.1306, seed = 1)
#>   [1] -0.414928124  0.171292007 -0.934060000  2.090376539  0.470491497
#>   [6] -1.254712462  0.819067838  1.293669649  1.045914806 -0.572447375
#>  [11]  2.929863435  0.773703434 -1.259343828 -4.685172098  3.075817777
#>  [16] -0.122278772 -0.043869100  2.546764376  2.207200309  1.590338687
#>  [21]  2.452293792  2.080346412  0.197725032 -5.260109776  2.014916131
#>  [26] -0.180020270 -0.493383080 -4.608066610 -1.681017354  1.467324296
#>  [31]  4.691926195 -0.349355212  1.298544716 -0.177592896 -4.482398797
#>  [36] -1.492626121 -1.409839147 -0.210648750  3.841968585  2.622302500
#>  [41] -0.556495024 -0.845676615  2.302560818  1.813209058 -2.213259731
#>  [46] -2.314417212  1.215256179  2.524821237 -0.363983712  2.819234604
#>  [51]  1.257614960 -1.909911644  1.078191031 -3.526190265  4.784528133
#>  [56]  6.516361844 -1.191536024 -3.372965719  1.944515055 -0.453885821
#>  [61]  7.962052881 -0.128245394  2.223784646  0.089104957 -2.335669699
#>  [66]  0.607472605 -5.732576605  5.509137241  0.565317467  7.869275463
#>  [71]  1.692201001 -2.483866765  2.172292406 -3.266493628 -4.559520595
#>  [76]  1.146722740 -1.709146014  0.004234138  0.279277982 -2.173278935
#>  [81] -2.106412427 -0.502243570  4.302167145 -5.464988404  2.400113506
#>  [86]  1.317408409  4.121286031 -1.156051648  1.388109849  0.983334736
#>  [91] -1.961299846  4.375162376  4.129740717  2.449931188  5.461766607
#>  [96]  1.892172867 -4.260030660 -2.081691958 -4.464870724 -1.859560263
#> [101] -2.424151749  0.165466344 -3.507140029  0.629321567 -2.553518114
#> [106]  6.951429863  2.762499947  3.439881326  1.424576302  6.123662729
#> [111] -2.273430129 -1.666468160  5.153230300 -2.300756026 -0.741390463
#> [116] -1.384384010 -1.120615903 -0.968146973  1.695671873 -0.599005718
#> [121] -1.687106180  4.489048537 -0.706807105 -0.585006259 -0.322724356
#> [126]  2.267266327 -0.231121746 -0.116873003 -2.093026452 -1.014953082
#> [131]  0.187395036 -1.813247942  1.655603361 -4.675336298  1.067633744
#> [136] -5.264796484 -1.165701041 -2.018228291 -2.489260793 -0.219090313
#> [141] -7.229796776  5.334566105 -7.370294171 -2.354171667 -5.601873548
#> [146] -3.974445275 11.164758883  0.090564960 -6.520584182 -8.976811401
#> [151]  2.806472329 -0.112367573 -1.870912553 -5.349997423 -8.807331709
#> [156] -7.070203740  6.875007556 -4.143578517 -9.197305090 13.559178706
#> [161]  2.989970578 -1.628069025  7.033632746  5.716419373 -3.876798681
#> [166] 13.764177120 -1.545274874 -8.423198693 -0.939026160  1.311974142
#> [171] 14.167276648  0.630856861  2.647839061 -0.434547807 -1.830182920
#> [176] -0.186544238  4.118023875 10.563872560  5.094298306  5.836938182
#> [181] -5.801523960  4.970567018  1.082392165 -7.038480511  2.774332222
#> [186] -0.822789105  7.404355546 -3.773071644 -2.146888517 -4.560363501
#> [191] -0.898728899  1.991558324 -3.532859677  4.050202523 -5.744333316
#> [196] -5.324926487  7.653261052 -5.251012384  2.216243851