close Warning: Can't synchronize with repository "(default)" (/var/svn/mms does not appear to be a Subversion repository.). Look in the Trac log for more information.

Ticket #273: matVeh_MMS_MDF.error.tol

File matVeh_MMS_MDF.error.tol, 3.7 KB (added by jconde, 15 years ago)
Line 
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
13Text PathMMS = "C:/Users/jconde/bsd/entity/PrjBysForBysMMS/";
14Text PathMMSSamples = PathMMS + "trunk/samples/ARIMAX_matVeh/";
15Text PathSaveResults = "C:/temp/";
16
17// Compile example
18Set Include(PathMMSSamples + "funPrj.tol");
19Set Include(PathMMSSamples + "matVeh_MMS_MDV.tol");
20Set Include(PathMMSSamples + "matVeh_MMS_MDM.tol");
21Set Include(PathMMSSamples + "matVeh_MMS_MEM_BSR.tol");
22
23//////////////////////////////////////////////////////////////////////////////
24// FUNCTIONS
25//////////////////////////////////////////////////////////////////////////////
26
27Set 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
72Real 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
85Real forecast::SetForecastInterval(
86  ?,
87  y2009m05d01,
88  y2009m06d01
89);
90
91// fore execution
92Real forecast::Execute(?);
93
94// saving estimations and forecastings!
95Text nameEst = estBSR::GetIndex(?);
96Text nameFor = forecast::GetIndex(?);
97Real estBSR::Store(PathSaveResults + nameEst +".oza");
98Real forecast::Store(PathSaveResults + nameFor +".oza");
99
100// Forecasting results (series)
101Set Results = AllResults_FOR(?);
102
103
104
105//////////////////////////////////////////////////////////////////////////////
106// REMOVE ESTIMATIONS
107//////////////////////////////////////////////////////////////////////////////
108
109Real MMS::RemoveEstimations(?);
110Real MMS::RemoveModels(?);
111Real MMS::RemoveVariables(?);
112
113
114// includes some needed variables
115Set Include(PathMMSSamples + "funPrj.tol");
116
117
118// load estimations
119Real MMS::LoadFile(PathSaveResults + nameEst + ".oza");
120Real MMS::LoadFile(PathSaveResults + nameFor + ".oza");
121
122// Forecasting results (series)
123Set ResultsFromSavedEstimations = AllResults_FOR(?);
124
125