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

Ticket #786: ejemplo2.tol

File ejemplo2.tol, 2.0 KB (added by pgea@…, 15 years ago)
Line 
1
2//////////////////////////////////////////////////////////////////////////////
3// Definición
4
5Real PutRandomSeed(2143);
6
7Date begin = y2010;
8Date end = y2010m12d31;
9
10Serie noise = SubSer(Gaussian(0,0.1), begin, end);
11Serie input1 = SubSer(Gaussian(0,1), Succ(begin,C,-2), end);
12Serie input2 = SubSer(Gaussian(0,1), begin, end);
13Serie output = noise + (0.2-0.1*B^2):input1 + 0.15*input2;
14
15//////////////////////////////////////////////////////////////////////////////
16// Estimación 1 (anteponiendo ceros a input2 para que no falle)
17
18Set mod01 = @ModelDef(output, 1,0,1,0, 1, SetOfPolyn(1-0.1*B), SetOfPolyn(1),
19  [[ @InputDef(0.1+0.1*B^2, input1),
20     @InputDef(0.1, CalInd(W,C)<<input2) ]], Copy(Empty) );
21
22Real Show(0, "ALL");
23Set est01 = Estimate(mod01);
24Real Show(1, "ALL");
25
26//////////////////////////////////////////////////////////////////////////////
27// Estimación 2 (anteponiendo numeros muy altos a input 2 para que no falle)
28
29Set mod02 = @ModelDef(output, 1,0,1,0, 1, SetOfPolyn(1-0.1*B), SetOfPolyn(1),
30  [[ @InputDef(0.1+0.1*B^2, input1),
31     @InputDef(0.1, (10^10*CalInd(C,C))<<input2) ]], Copy(Empty) );
32
33Real Show(0, "ALL");
34Set est02 = Estimate(mod02);
35Real Show(1, "ALL");
36
37//////////////////////////////////////////////////////////////////////////////
38// Estimación 3 (separando el input1 en dos para que no falle)
39
40Set mod03 = @ModelDef(output, 1,0,1,0, 1, SetOfPolyn(1-0.1*B), SetOfPolyn(1),
41  [[ @InputDef(0.1, input1),
42     @InputDef(0.1, (B^2):input1),
43     @InputDef(0.1, input2) ]], Copy(Empty) );
44
45Real Show(0, "ALL");
46Set est03 = Estimate(mod03);
47Real Show(1, "ALL");
48
49//////////////////////////////////////////////////////////////////////////////
50// Comparación
51
52Set parametros = est01::ParameterInfo << est02::ParameterInfo
53  << est03::ParameterInfo;
54
55Set residuos = [[ est01::Series::Residuals, est02::Series::Residuals,
56 est03::Series::Residuals ]];
57
58//////////////////////////////////////////////////////////////////////////////