1 | ////////////////////////////////////////////////////////////////////////////// |
---|
2 | // FILE : matVeh_MMS_MDF.error.tol |
---|
3 | // PURPOSE: generar un previsión, que al ser guardada y recuperada, no |
---|
4 | // devuelve correctamente algunas variables |
---|
5 | ////////////////////////////////////////////////////////////////////////////// |
---|
6 | |
---|
7 | |
---|
8 | ////////////////////////////////////////////////////////////////////////////// |
---|
9 | // PARAMETERS |
---|
10 | ////////////////////////////////////////////////////////////////////////////// |
---|
11 | |
---|
12 | // define paths |
---|
13 | Text PathMMS = "C:/Users/jconde/bsd/entity/PrjBysForBysMMS/"; |
---|
14 | Text PathMMSSamples = PathMMS + "trunk/samples/ARIMAX_matVeh/"; |
---|
15 | Text PathSaveResults = "C:/temp/"; |
---|
16 | |
---|
17 | // Compile example |
---|
18 | Set Include(PathMMSSamples + "funPrj.tol"); |
---|
19 | Set Include(PathMMSSamples + "matVeh_MMS_MDV.tol"); |
---|
20 | Set Include(PathMMSSamples + "matVeh_MMS_MDM.tol"); |
---|
21 | Set Include(PathMMSSamples + "matVeh_MMS_MEM_BSR.tol"); |
---|
22 | |
---|
23 | ////////////////////////////////////////////////////////////////////////////// |
---|
24 | // FUNCTIONS |
---|
25 | ////////////////////////////////////////////////////////////////////////////// |
---|
26 | |
---|
27 | Set AllResults_FOR(Real void){ |
---|
28 | Copy( |
---|
29 | EvalSet( |
---|
30 | Select(MMS::GetEstimations(?), Real(NameBlock est) |
---|
31 | { |
---|
32 | And(est::HasResults(?), ClassOf(est)=="@MMS.Forecast") |
---|
33 | }), Set(NameBlock est) |
---|
34 | { |
---|
35 | Text name = est::GetIndex(?); |
---|
36 | Set subMs = est::GetModelResults(?)::GetSubmodels(?); |
---|
37 | Set mainResults = (subMs[1])::GetMainResults(?); |
---|
38 | |
---|
39 | Date iniFor = (subMs[1])::GetForecastFirst(?); |
---|
40 | Date endFor = (subMs[1])::GetForecastLast(?); |
---|
41 | |
---|
42 | Set resultsEST = EvalSet(mainResults, Serie(Serie ser) |
---|
43 | { |
---|
44 | Serie serEST = SubSer(ser, First(ser), Succ(iniFor, Dating(ser), -1)); |
---|
45 | Eval("Serie "+ Name(ser) +".EST = serEST;") |
---|
46 | }); |
---|
47 | |
---|
48 | Set resultsFOR = EvalSet(mainResults, Serie(Serie ser) |
---|
49 | { |
---|
50 | Serie serFOR = SubSer(ser, iniFor, endFor); |
---|
51 | Eval("Serie "+ Name(ser) +".FOR = serFOR;") |
---|
52 | }); |
---|
53 | |
---|
54 | Set effects = (subMs[1])::GetEffects(?); |
---|
55 | Eval("Set "+ name +" = resultsEST << resultsFOR << |
---|
56 | [[iniFor, endFor]] << |
---|
57 | [[ effects, mainResults ]];") |
---|
58 | } |
---|
59 | ) |
---|
60 | ) |
---|
61 | }; |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | ////////////////////////////////////////////////////////////////////////////// |
---|
66 | // CODE |
---|
67 | ////////////////////////////////////////////////////////////////////////////// |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | // fore creation |
---|
72 | Real MMS::CreateForecast([[ |
---|
73 | Text _.name = "F.Avr"; |
---|
74 | @MMS.Estimation _.estimation = estBSR; |
---|
75 | @MMS.SettingsEstimate _.settings = [[ |
---|
76 | Real _.showTraces = True |
---|
77 | ]] |
---|
78 | ]]); |
---|
79 | |
---|
80 | @MMS.Forecast forecast = MMS::GetEstimation( |
---|
81 | Replace(estBSR::GetIndex(?), "BSR", "F.Avr") |
---|
82 | ); |
---|
83 | |
---|
84 | // forecasting interval |
---|
85 | Real forecast::SetForecastInterval( |
---|
86 | ?, |
---|
87 | y2009m05d01, |
---|
88 | y2009m06d01 |
---|
89 | ); |
---|
90 | |
---|
91 | // fore execution |
---|
92 | Real forecast::Execute(?); |
---|
93 | |
---|
94 | // saving estimations and forecastings! |
---|
95 | Text nameEst = estBSR::GetIndex(?); |
---|
96 | Text nameFor = forecast::GetIndex(?); |
---|
97 | Real estBSR::Store(PathSaveResults + nameEst +".oza"); |
---|
98 | Real forecast::Store(PathSaveResults + nameFor +".oza"); |
---|
99 | |
---|
100 | // Forecasting results (series) |
---|
101 | Set Results = AllResults_FOR(?); |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | ////////////////////////////////////////////////////////////////////////////// |
---|
106 | // REMOVE ESTIMATIONS |
---|
107 | ////////////////////////////////////////////////////////////////////////////// |
---|
108 | |
---|
109 | Real MMS::RemoveEstimations(?); |
---|
110 | Real MMS::RemoveModels(?); |
---|
111 | Real MMS::RemoveVariables(?); |
---|
112 | |
---|
113 | |
---|
114 | // includes some needed variables |
---|
115 | Set Include(PathMMSSamples + "funPrj.tol"); |
---|
116 | |
---|
117 | |
---|
118 | // load estimations |
---|
119 | Real MMS::LoadFile(PathSaveResults + nameEst + ".oza"); |
---|
120 | Real MMS::LoadFile(PathSaveResults + nameFor + ".oza"); |
---|
121 | |
---|
122 | // Forecasting results (series) |
---|
123 | Set ResultsFromSavedEstimations = AllResults_FOR(?); |
---|
124 | |
---|
125 | |
---|