@@ -2,15 +2,15 @@ using Dates, DelimitedFiles, Plots, Random, ScoreDrivenModels
2
2
3
3
# Define dates and load historical Affluent Natural Energy data
4
4
dates = collect (Date (1961 ): Month (1 ): Date (2000 , 12 ))
5
- y = vec (readdlm (" .. /test/data/ane_northeastern .csv" ))
5
+ y = vec (readdlm (" ./test/data/nie_northeastern .csv" ))
6
6
y_train = y[1 : 400 ]
7
7
y_test = y[401 : 460 ]
8
8
9
9
# Set RNG seed to guarantee consistent results
10
10
Random. seed! (123 )
11
11
12
12
# Specify GAS model: a lognormal model with time-varying μ, constant σ, and lags 4 and 12
13
- gas = Model ([1 , 2 , 3 , 4 ], [1 , 2 , 3 , 10 , 11 , 12 ], LogNormal, 1.0 ; time_varying_params= [1 ])
13
+ gas = Model ([1 ,2 , 3 , 4 ], [1 ,2 , 3 , 10 ,11 ,12 ], LogNormal, 1.0 ; time_varying_params= [1 ])
14
14
15
15
# Obtain initial parameters to start the GAS recursion
16
16
initial_params = dynamic_initial_params (y_train, gas)
@@ -26,6 +26,9 @@ plot(f)
26
26
forec = forecast (y_train, gas, 60 ; S= 1000 , initial_params= initial_params)
27
27
28
28
# Plot results
29
- plot (dates[401 : 460 ], forec. observation_scenarios, color= " grey" , width= 0.05 , label= " " , ylims= (0 , 70 ))
30
- plot! (dates[360 : 460 ], y[360 : 460 ], label= " ANE" , color= " black" , xlabel= " Months" , ylabel= " GWmed" , legend= :topright )
29
+ plotly ()
30
+ plot (dates[401 : 460 ], forec. observation_scenarios, color= " grey" , w= 0.05 , label= " " , ylims= (0 , 70 ));
31
+ plot! (dates[360 : 460 ], y[360 : 460 ], label= " NIE" , color= " black" , xlabel= " Months" , ylabel= " GWmed" , legend= :topright );
31
32
plot! (dates[401 : 460 ], forec. observation_quantiles, label= [" Quantiles" " " " " ], color= " red" , line= :dash )
33
+
34
+ plot (dates[1 : 400 ], y_train, label = " in-sample NIE" , ylabel = " GWmed" , xlabel = " Months" , color = " black" )
0 commit comments