Generates shocks z_t = sigma_t * eps_t with a persistent AR(1)
log-variance, for use as sim_psy1(..., e = sim_vol_sv(...)).
Arguments
- n
Number of innovations to generate.
- phi
AR(1) log-variance persistence, in (0, 1).
- tau
Positive standard deviation of the log-variance innovations.
- log_sigma0_sq
Starting value of
log(sigma^2). Defaults to 0.- 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.seedbefore 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.
Details
$$\log\sigma_t^2 = \phi\log\sigma_{t-1}^2 + \eta_t,\quad \eta_t \sim iid\, N(0, \tau^2)$$
with phi close to (but below) 1 for the "double local-to-unity"
near-integrated-variance case studied in the source.
Examples
sim_vol_sv(199, seed = 1)
#> [1] 0.411974712 -0.369324726 0.400688011 1.585970293 1.615657826
#> [6] -0.342444013 -2.268295576 2.540687705 0.703834852 0.587217120
#> [11] -0.014291898 0.586044974 -0.192028807 0.474957518 -0.403524807
#> [16] -1.461119063 1.049666385 1.611600145 -0.342819628 -1.446927000
#> [21] 0.761626182 -0.055324103 -2.220776758 0.002728201 -0.726649027
#> [26] -0.404310781 -1.362934333 2.101468719 -0.357459941 -1.689634225
#> [31] 0.211691359 0.301955891 -1.122205575 -3.344261329 -0.737278661
#> [36] 0.611309903 -0.062593913 -0.100794372 0.573755046 -1.281869345
#> [41] 1.229164018 -0.005926494 0.772927964 1.168041813 0.258917859
#> [46] -0.980691333 1.250079421 -2.186383356 -0.617739666 -0.287558140
#> [51] -0.194796630 1.216791253 0.156980963 0.475936060 -0.076709157
#> [56] -0.292441737 0.903784837 1.454649975 -2.880817006 0.703879157
#> [61] 0.455543040 -0.580676130 1.287954148 -0.542339923 -0.394101298
#> [66] 1.137619285 2.290267694 0.326753887 -0.547569469 -1.546072247
#> [71] -0.477282316 -1.377528367 -0.363497091 0.566948581 -1.160272991
#> [76] 3.368190016 0.200302928 1.412185433 -2.847687156 0.921212219
#> [81] -1.581923546 1.070528875 0.458854385 -0.496771556 1.489936148
#> [86] -0.810830072 -0.680651202 -1.233691179 -0.807632044 1.159381087
#> [91] 0.536941257 1.205964943 -0.495385250 0.504062716 0.336682138
#> [96] -2.115444366 2.691185420 0.189295933 1.040325701 1.213327409
#> [101] -0.062432469 -0.364511866 1.063703917 -1.186912950 2.246229214
#> [106] -0.421949107 1.983663648 1.872804635 0.107074226 0.742446523
#> [111] -1.450892333 0.440034820 1.380718134 0.140028178 -0.617004681
#> [116] -0.876386753 -0.046800833 1.363593573 -0.605746362 -0.154550855
#> [121] -1.630254236 0.604343360 1.703236643 1.918580884 1.029654777
#> [126] -2.340321675 0.622418248 0.583828192 -0.449259169 0.208468742
#> [131] -1.035349291 0.813406607 -0.378982141 -1.861423109 -0.402664236
#> [136] 1.515509568 -0.343117066 0.740497827 0.931461775 0.004190924
#> [141] -0.335050219 -0.458208220 0.680511723 -0.901848987 0.204685550
#> [146] -0.228454717 -1.729627670 -1.200700422 0.783864055 -0.153966029
#> [151] 0.598254495 1.446217810 1.134292396 0.515693195 0.277688584
#> [156] -0.131626832 1.028693129 0.412151245 -0.792260375 -0.098817779
#> [161] -1.349889915 -0.141299481 -1.865722253 1.003678689 -0.510190083
#> [166] -0.336121058 -0.148523972 0.531617290 0.550090385 0.459179825
#> [171] -0.469712598 -1.260229598 -0.361810085 0.265032226 -0.782649978
#> [176] -0.064440138 -1.092563555 -0.008097664 0.139379861 -0.165847043
#> [181] -0.197445789 1.990093654 0.901757328 1.324349748 -1.018675567
#> [186] 0.185756531 1.291816917 -0.067877718 -2.452097965 0.387566102
#> [191] -2.039299836 -0.859548794 1.429796991 0.639959034 1.181988633
#> [196] 0.312016633 -0.106343045 -0.959642642 1.570717876
