| 1 | |
|---|
| 2 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 3 | // Definición |
|---|
| 4 | |
|---|
| 5 | Real PutRandomSeed(2143); |
|---|
| 6 | |
|---|
| 7 | Date begin = y2010; |
|---|
| 8 | Date end = y2010m12d31; |
|---|
| 9 | |
|---|
| 10 | Serie noise = SubSer(Gaussian(0,0.1), begin, end); |
|---|
| 11 | Serie input1 = SubSer(Gaussian(0,1), Succ(begin,C,-2), end); |
|---|
| 12 | Serie input2 = SubSer(Gaussian(0,1), begin, end); |
|---|
| 13 | Serie output = noise + (0.2-0.1*B^2):input1 + 0.15*input2; |
|---|
| 14 | |
|---|
| 15 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 16 | // Estimación 0 |
|---|
| 17 | |
|---|
| 18 | Set mod00 = @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, input2) ]], Copy(Empty) ); |
|---|
| 21 | |
|---|
| 22 | Real Show(0, "ALL"); |
|---|
| 23 | Set est00 = Estimate(mod00); |
|---|
| 24 | Real Show(1, "ALL"); |
|---|
| 25 | |
|---|
| 26 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 27 | // Estimación 1 (anteponiendo ceros a input2 para que no falle) |
|---|
| 28 | |
|---|
| 29 | Set mod01 = @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, CalInd(W,C)<<input2) ]], Copy(Empty) ); |
|---|
| 32 | |
|---|
| 33 | Real Show(0, "ALL"); |
|---|
| 34 | Set est01 = Estimate(mod01); |
|---|
| 35 | Real Show(1, "ALL"); |
|---|
| 36 | |
|---|
| 37 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 38 | // Estimación 2 (anteponiendo numeros muy altos a input 2 para que no falle) |
|---|
| 39 | |
|---|
| 40 | Set mod02 = @ModelDef(output, 1,0,1,0, 1, SetOfPolyn(1-0.1*B), SetOfPolyn(1), |
|---|
| 41 | [[ @InputDef(0.1+0.1*B^2, input1), |
|---|
| 42 | @InputDef(0.1, (10^10*CalInd(C,C))<<input2) ]], Copy(Empty) ); |
|---|
| 43 | |
|---|
| 44 | Real Show(0, "ALL"); |
|---|
| 45 | Set est02 = Estimate(mod02); |
|---|
| 46 | Real Show(1, "ALL"); |
|---|
| 47 | |
|---|
| 48 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 49 | // Estimación 3 (separando el input1 en dos para que no falle) |
|---|
| 50 | |
|---|
| 51 | Set mod03 = @ModelDef(output, 1,0,1,0, 1, SetOfPolyn(1-0.1*B), SetOfPolyn(1), |
|---|
| 52 | [[ @InputDef(0.1, input1), |
|---|
| 53 | @InputDef(0.1, (B^2):input1), |
|---|
| 54 | @InputDef(0.1, input2) ]], Copy(Empty) ); |
|---|
| 55 | |
|---|
| 56 | Real Show(0, "ALL"); |
|---|
| 57 | Set est03 = Estimate(mod03); |
|---|
| 58 | Real Show(1, "ALL"); |
|---|
| 59 | |
|---|
| 60 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 61 | // Comparación |
|---|
| 62 | |
|---|
| 63 | Set parametros = est00::ParameterInfo << est01::ParameterInfo |
|---|
| 64 | << est02::ParameterInfo << est03::ParameterInfo; |
|---|
| 65 | |
|---|
| 66 | Set residuos = [[ est00::Series::Residuals, est01::Series::Residuals, |
|---|
| 67 | est02::Series::Residuals, est03::Series::Residuals ]]; |
|---|
| 68 | |
|---|
| 69 | ////////////////////////////////////////////////////////////////////////////// |
|---|