| 1 |
# Example n. 8 |
| 2 |
|
| 3 |
# estimate a simple model and then perform |
| 4 |
# variance forecasting via simulation |
| 5 |
|
| 6 |
|
| 7 |
set verbose off |
| 8 |
set seed 123 |
| 9 |
include gig.gfn |
| 10 |
|
| 11 |
# estimate a simple model |
| 12 |
|
| 13 |
open nysewk |
| 14 |
rr = ldiff(close) * 100 |
| 15 |
list X = const |
| 16 |
mod = gig_setup(rr, 3, X) |
| 17 |
gig_estimate(&mod, 1) |
| 18 |
|
| 19 |
# now forecast |
| 20 |
scalar horizon = 39 # how many steps ahead? |
| 21 |
scalar rep = 4096 # how many simulations? |
| 22 |
matrix varfore1 = gig_var_fcast(&mod, horizon, rep) |
| 23 |
|
| 24 |
# how many values of the estimated in-sample volatility |
| 25 |
# do we want in the graph? |
| 26 |
|
| 27 |
scalar before = 260 |
| 28 |
|
| 29 |
# do the graph |
| 30 |
gig_vfgraph(varfore1, mod, before, 0.9) |