Vous êtes sur la page 1sur 17

SES

> x=c(189,144,191,189,287,174,139,128,221,279,241)
> n=length(x)
> initial=x[1]
> alpha1=0.1
> F1=initial
> F1=c()
> for (i in 2:n)
+{
+
+ F1[1]=initial
+ F1[i]=alpha1*x[i]+(1-alpha1)*F1[i-1]
+}
> F1
[1] 189.0000 184.5000 185.1500 185.5350 195.6815 193.5134 188.0620 182.0558
[9] 185.9502 195.2552 199.8297
>
> ###########
> alpha2=0.5
> F2=c()
> for (i in 2:n)
+{
+
+ F2[1]=initial
+ F2[i]=alpha2*x[i]+(1-alpha2)*F2[i-1]

+}
> F2
[1] 189.0000 166.5000 178.7500 183.8750 235.4375 204.7188 171.8594 149.9297
[9] 185.4648 232.2324 236.6162
>
> ###########
> alpha3=0.9
> F3=c()
> for (i in 2:n)
+{
+
+ F3[1]=initial
+ F3[i]=alpha3*x[i]+(1-alpha3)*F3[i-1]
+}
> F3
[1] 189.0000 148.5000 186.7500 188.7750 277.1775 184.3177 143.5318 129.5532
[9] 211.8553 272.2855 244.1286
>
> ############
>
> F1[n]
[1] 199.8297
> F2[n]
[1] 236.6162
> F3[n]

[1] 244.1286

LINIER 1 PARAMETER BROWN

>
x=c(143,152,161,139,137,174,142,141,162,180,164,171,206,193,207,218,229,225,204,227,223,242,239,
266)
> n=length(x)
> initial=x[1]
> alpha=0.2
> F=c()
> for (i in 2:n)
+{
+ F[1]=initial
+ F[i]=alpha*x[i]+(1-alpha)*F[i-1]
+}
>F
[1] 143.0000 144.8000 148.0400 146.2320 144.3856 150.3085 148.6468 147.1174
[9] 150.0939 156.0752 157.6601 160.3281 169.4625 174.1700 180.7360 188.1888
[17] 196.3510 202.0808 202.4647 207.3717 210.4974 216.7979 221.2383 230.1907
> x1=F
> n=length(x1)
> initial=x1[1]
> alpha=0.2
> F1=c()
> for (i in 2:n)
+{
+ F1[1]=initial

+ F1[i]=alpha*x1[i]+(1-alpha)*F1[i-1]
+}
> F1
[1] 143.0000 143.3600 144.2960 144.6832 144.6237 145.7606 146.3379 146.4938
[9] 147.2138 148.9861 150.7209 152.6423 156.0064 159.6391 163.8585 168.7245
[17] 174.2498 179.8160 184.3458 188.9509 193.2602 197.9678 202.6219 208.1356
> deretalpha=c()
> for (i in 1:n)
+{
+ deretalpha[i]=2*F[i]-F1[i]
+}
> deretalpha
[1] 143.0000 146.2400 151.7840 147.7808 144.1475 154.8563 150.9557 147.7411
[9] 152.9741 163.1642 164.5994 168.0139 182.9186 188.7009 197.6135 207.6530
[17] 218.4522 224.3456 220.5836 225.7925 227.7345 235.6280 239.8548 252.2457
> deretalphax=deretalpha[2:n]
> deretalphax
[1] 146.2400 151.7840 147.7808 144.1475 154.8563 150.9557 147.7411 152.9741
[9] 163.1642 164.5994 168.0139 182.9186 188.7009 197.6135 207.6530 218.4522
[17] 224.3456 220.5836 225.7925 227.7345 235.6280 239.8548 252.2457
> coefbeta=(alpha)/(1-alpha)
> deretbeta=coefbeta*(F-F1)
> deretbeta
[1] 0.0000000 0.3600000 0.9360000 0.3872000 -0.0595200 1.1369600
[7] 0.5772288 0.1559117 0.7200323 1.7722681 1.7348084 1.9214418

[13] 3.3640295 3.6327245 4.2193803 4.8660648 5.5253002 5.5661989


[19] 4.5297262 4.6051945 4.3092865 4.7075339 4.6541109 5.5137557
> forecast=c()
> forecasta=c()
> forecastb=c()
> forecastc=c()
> forecastd=c()
> forecaste=c()
> #####################
> for (i in 1:n)
+{
+ forecast[i]=deretalpha[i]+deretbeta[i] #m=1
+ forecasta[i]=deretalpha[i]+deretbeta[i]*2 #m=2
+ forecastb[i]=deretalpha[i]+deretbeta[i]*3 #m=3
+ forecastc[i]=deretalpha[i]+deretbeta[i]*4 #m=4
+ forecastd[i]=deretalpha[i]+deretbeta[i]*5 #m=5
+ forecaste[i]=deretalpha[i]+deretbeta[i]*6 #m=6
+}
> forecast
[1] 143.0000 146.6000 152.7200 148.1680 144.0880 155.9933 151.5329 147.8970
[9] 153.6941 164.9365 166.3342 169.9353 186.2826 192.3336 201.8329 212.5191
[17] 223.9775 229.9118 225.1133 230.3977 232.0438 240.3356 244.5089 257.7594
> forecast1=forecast[n]
> forecast2=forecasta[n]
> forecast3=forecastb[n]

> forecast4=forecastc[n]
> forecast5=forecastd[n]
> forecast6=forecaste[n]
> forecasttotal=c(forecast1,forecast2,forecast3,forecast4,forecast5,forecast6)
> forecasttotal
[1] 257.7594 263.2732 268.7869 274.3007 279.8145 285.3282
>

BROWN KUADRATIK

>
x=c(143,152,161,139,137,174,142,141,162,180,164,171,206,193,207,218,229,225,204,227,223,242,239,
266)
> n=length(x)
> initial=x[1]
> alpha=0.15
> F=c()
> for (i in 2:n)
+{
+ F[1]=initial
+ F[i]=alpha*x[i]+(1-alpha)*F[i-1]
+}
>F
[1] 143.0000 144.3500 146.8475 145.6704 144.3698 148.8143 147.7922 146.7734
[9] 149.0574 153.6988 155.2439 157.6074 164.8662 169.0863 174.7734 181.2574
[17] 188.4188 193.9059 195.4201 200.1570 203.5835 209.3460 213.7941 221.6250
> x1=F
> n=length(x1)
> initial=x1[1]
> alpha=0.15
> F1=c()
> for (i in 2:n)
+{
+ F1[1]=initial

+ F1[i]=alpha*x1[i]+(1-alpha)*F1[i-1]
+}
> F1
[1] 143.0000 143.2025 143.7492 144.0374 144.0873 144.7963 145.2457 145.4749
[9] 146.0122 147.1652 148.3770 149.7616 152.0273 154.5861 157.6142 161.1607
[17] 165.2494 169.5479 173.4287 177.4380 181.3598 185.5577 189.7932 194.5679
> x2=F1
> n=length(x2)
> initial=x2[1]
> alpha=0.15
> F2=c()
> for (i in 2:n)
+{
+ F2[1]=initial
+ F2[i]=alpha*x2[i]+(1-alpha)*F2[i-1]
+}
> F2
[1] 143.0000 143.0304 143.1382 143.2731 143.3952 143.6054 143.8514 144.0949
[9] 144.3825 144.7999 145.3365 146.0003 146.9043 148.0566 149.4902 151.2408
[17] 153.3421 155.7730 158.4213 161.2738 164.2867 167.4774 170.8247 174.3862
> deretalpha=c()
> for(i in 1:n)
+{
+ deretalpha[i]=3*F[i]-3*F1[i]+F2[i]
+}

> deretalpha
[1] 143.0000 146.4729 152.4330 148.1720 144.2428 155.6594 151.4909 147.9905
[9] 153.5179 164.4006 165.9373 169.5376 185.4212 191.5571 200.9677 211.5308
[17] 222.8502 228.8471 224.3954 229.4311 230.9578 238.8421 242.8274 255.5573
> deretalphax=deretalpha[2:n]
> deretalphax
[1] 146.4729 152.4330 148.1720 144.2428 155.6594 151.4909 147.9905 153.5179
[9] 164.4006 165.9373 169.5376 185.4212 191.5571 200.9677 211.5308 222.8502
[17] 228.8471 224.3954 229.4311 230.9578 238.8421 242.8274 255.5573
> deretbetha=c()
> coefbetha=((0.6*alpha)/(1-alpha)^2)
> for (i in 1:n)
+{
+ deretbetha[i]=coefbetha*((6-5*alpha)*F[i]-(10-8*alpha)*F1[i]+(4-3*alpha)*F2[i])
+}
> deretbetha
[1] -1.416168e-14 6.743250e-01 1.755979e+00 7.299214e-01 -1.212646e-01
[6] 2.101036e+00 1.048771e+00 2.389740e-01 1.270771e+00 3.226842e+00
[11] 3.146260e+00 3.467670e+00 6.130976e+00 6.595359e+00 7.629184e+00
[16] 8.756089e+00 9.886695e+00 9.838198e+00 7.745400e+00 7.709794e+00
[21] 6.983878e+00 7.561629e+00 7.307976e+00 8.770081e+00
> deretbethax=deretbetha[2:n]
> deretbethax
[1] 0.6743250 1.7559787 0.7299214 -0.1212646 2.1010362 1.0487712
[7] 0.2389740 1.2707710 3.2268415 3.1462596 3.4676703 6.1309756

[13] 6.5953591 7.6291840 8.7560889 9.8866952 9.8381977 7.7454004


[19] 7.7097941 6.9838779 7.5616289 7.3079756 8.7700812
> deretbetha=c()
> coefbetha=((0.5*alpha)/(1-alpha)^2)
> for (i in 1:n)
+{
+ deretbetha[i]=coefbetha*((6-5*alpha)*F[i]-(10-8*alpha)*F1[i]+(4-3*alpha)*F2[i])
+}
> deretbetha
[1] -1.180140e-14 5.619375e-01 1.463316e+00 6.082678e-01 -1.010538e-01
[6] 1.750863e+00 8.739760e-01 1.991450e-01 1.058976e+00 2.689035e+00
[11] 2.621883e+00 2.889725e+00 5.109146e+00 5.496133e+00 6.357653e+00
[16] 7.296741e+00 8.238913e+00 8.198498e+00 6.454500e+00 6.424828e+00
[21] 5.819898e+00 6.301357e+00 6.089980e+00 7.308401e+00
> deretbethax=deretbetha[2:n]
> deretbethax
[1] 0.5619375 1.4633156 0.6082678 -0.1010538 1.7508635 0.8739760
[7] 0.1991450 1.0589758 2.6890346 2.6218830 2.8897253 5.1091463
[13] 5.4961325 6.3576533 7.2967407 8.2389126 8.1984981 6.4545003
[19] 6.4248285 5.8198983 6.3013574 6.0899797 7.3084010
> deretc=c()
> coefc=((alpha^2)/(1-alpha)^2)
> for (i in 1:n)
+{
+ deretc[i]=coefc*(F[i]-2*F1[i]+F2[i])

+}
> deretc
[1] 0.000000000 0.030375000 0.077456250 0.027050625 -0.012753281
[6] 0.088039723 0.035881495 -0.002535396 0.044078996 0.129807632
[11] 0.119161189 0.127198002 0.240291140 0.248220604 0.281371966
[16] 0.316924151 0.350721327 0.329578846 0.217493624 0.204133328
[21] 0.160400165 0.177754705 0.156720519 0.214109752
> deretcx=deretc[2:n]
> deretcx
[1] 0.030375000 0.077456250 0.027050625 -0.012753281 0.088039723
[6] 0.035881495 -0.002535396 0.044078996 0.129807632 0.119161189
[11] 0.127198002 0.240291140 0.248220604 0.281371966 0.316924151
[16] 0.350721327 0.329578846 0.217493624 0.204133328 0.160400165
[21] 0.177754705 0.156720519 0.214109752
> forecast=c()
> forecasta=c()
> forecastb=c()
> forecastc=c()
> forecastd=c()
> forecaste=c()
>{
+ forecast[i]=deretalpha[i]+deretbeta[i]+0.5*deretc[i] #m=1
+ forecasta[i]=deretalpha[i]+deretbeta[i]*2+2*deretc[i] #m=2
+ forecastb[i]=deretalpha[i]+deretbeta[i]*3+(0.5*9)*deretc[i] #m=3
+ forecastc[i]=deretalpha[i]+deretbeta[i]*4+8*deretc[i] #m=4

+ forecastd[i]=deretalpha[i]+deretbeta[i]*5+(0.5*25)*deretc[i] #m=5
+ forecaste[i]=deretalpha[i]+deretbeta[i]*6+18*deretc[i] #m=6
+}
>
> forecast
[1]

NA

NA

NA

NA

NA

NA

NA

NA

[9]

NA

NA

NA

NA

NA

NA

NA

NA

[17]

NA

NA

NA

NA

NA

NA

NA 261.1781

> for (i in 1:n)


+{
+ forecast[i]=deretalpha[i]+deretbeta[i]+0.5*deretc[i] #m=1
+ forecasta[i]=deretalpha[i]+deretbeta[i]*2+2*deretc[i] #m=2
+ forecastb[i]=deretalpha[i]+deretbeta[i]*3+(0.5*9)*deretc[i] #m=3
+ forecastc[i]=deretalpha[i]+deretbeta[i]*4+8*deretc[i] #m=4
+ forecastd[i]=deretalpha[i]+deretbeta[i]*5+(0.5*25)*deretc[i] #m=5
+ forecaste[i]=deretalpha[i]+deretbeta[i]*6+18*deretc[i] #m=6
+}
>
> forecast
[1] 143.0000 146.8481 153.4077 148.5727 144.1769 156.8404 152.0860 148.1451
[9] 154.2600 166.2377 167.7316 171.5226 188.9054 195.3140 205.3277 216.5553
[17] 228.5508 234.5781 229.0338 234.1383 235.3473 243.6385 247.5599 261.1781
> forecast1=forecast[n]
> forecast2=forecasta[n]
> forecast3=forecastb[n]

> forecast4=forecastc[n]
> forecast5=forecastd[n]
> forecast6=forecaste[n]
> forecasttotal=c(forecast1,forecast2,forecast3,forecast4,forecast5,forecast6)
> forecasttotal
[1] 261.1781 267.0130 273.0620 279.3252 285.8024 292.4938
> forecast=c()
> forecasta=c()
> forecastb=c()
> forecastc=c()
> forecastd=c()
> forecaste=c()
>
> for (i in 1:n)
+{
+ forecast[i]=deretalpha[i]+deretbeta[i]+0.5*deretc[i] #m=1
+ forecasta[i]=deretalpha[i]+deretbeta[i]*2+2*deretc[i] #m=2
+ forecastb[i]=deretalpha[i]+deretbeta[i]*3+(0.5*9)*deretc[i] #m=3
+ forecastc[i]=deretalpha[i]+deretbeta[i]*4+8*deretc[i] #m=4
+ forecastd[i]=deretalpha[i]+deretbeta[i]*5+(0.5*25)*deretc[i] #m=5
+ forecaste[i]=deretalpha[i]+deretbeta[i]*6+18*deretc[i] #m=6
+}
>
> forecast
[1] 143.0000 146.8481 153.4077 148.5727 144.1769 156.8404 152.0860 148.1451

[9] 154.2600 166.2377 167.7316 171.5226 188.9054 195.3140 205.3277 216.5553


[17] 228.5508 234.5781 229.0338 234.1383 235.3473 243.6385 247.5599 261.1781
> forecast1=forecast[n]
> forecast2=forecasta[n]
> forecast3=forecastb[n]
> forecast4=forecastc[n]
> forecast5=forecastd[n]
> forecast6=forecaste[n]
> forecasttotal=c(forecast1,forecast2,forecast3,forecast4,forecast5,forecast6)
> forecasttotal
[1] 261.1781 267.0130 273.0620 279.3252 285.8024 292.4938
> forecast=c()
> forecasta=c()
> forecastb=c()
> forecastc=c()
> forecastd=c()
> forecaste=c()
>
> for (i in 1:n)
+{
+ forecast[i]=deretalpha[i]+deretbetha[i]+0.5*deretc[i] #m=1
+ forecasta[i]=deretalpha[i]+deretbetha[i]*2+2*deretc[i] #m=2
+ forecastb[i]=deretalpha[i]+deretbetha[i]*3+(0.5*9)*deretc[i] #m=3
+ forecastc[i]=deretalpha[i]+deretbetha[i]*4+8*deretc[i] #m=4
+ forecastd[i]=deretalpha[i]+deretbetha[i]*5+(0.5*25)*deretc[i] #m=5

+ forecaste[i]=deretalpha[i]+deretbetha[i]*6+18*deretc[i] #m=6
+}
>
> forecast
[1] 143.0000 147.0500 153.9350 148.7937 144.1354 157.4543 152.3828 148.1883
[9] 154.5989 167.1545 168.6187 172.4909 190.6505 197.1774 207.4660 218.9860
[17] 231.2644 237.2104 230.9586 235.9580 236.8579 245.2324 248.9958 262.9727
> forecast1=forecast[n]
> forecast2=forecasta[n]
> forecast3=forecastb[n]
> forecast4=forecastc[n]
> forecast5=forecastd[n]
> forecast6=forecaste[n]
> forecasttotal=c(forecast1,forecast2,forecast3,forecast4,forecast5,forecast6)
> forecasttotal
[1] 262.9727 270.6023 278.4460 286.5038 294.7757 303.2617
>

Vous aimerez peut-être aussi