Free Statistics

of Irreproducible Research!

Author's title

Author*Unverified author*
R Software ModulePatrick.Wessarwasp_demand_forecasting_croston.wasp
Title produced by softwareCroston Forecasting
Date of computationThu, 13 May 2010 13:31:23 +0000
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2010/May/13/t1273757525ersa4g2mglge9fc.htm/, Retrieved Mon, 06 May 2024 05:14:51 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=75938, Retrieved Mon, 06 May 2024 05:14:51 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsFM22,steven,coomans,thesis,Arima;per2maand
Estimated Impact106
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Croston Forecasting] [FM22,steven,cooma...] [2010-05-13 13:31:23] [d41d8cd98f00b204e9800998ecf8427e] [Current]
Feedback Forum

Post a new message
Dataseries X:
724
762.275
721.125
653.275
663.7125
735.5125
628.1375
792.55
636.5
800.825
728.05
618.2625
450.625
767.525
675.65
583.25
690.7875
208.0625
142.5
205.925
462.5625
251.4375
195.725
191.625
137.25




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Serverwessa.org @ wessa.org

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 3 seconds \tabularnewline
R Server & wessa.org @ wessa.org \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75938&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]3 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]wessa.org @ wessa.org[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75938&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75938&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Serverwessa.org @ wessa.org







Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
26137.817252242887-139.550119579668-43.5435239723977319.178028458171415.184624065441
27112.748907964002-181.930777701299-79.9317818228467305.429597750850407.428593629303
2887.6805636851168-223.349298765180-115.690932066036291.052059436269398.710426135413
2962.6122194062318-263.950230253707-150.915489220509276.139928032972389.17466906617
3037.5438751273468-303.845186970356-185.678434283499260.766184538193378.93293722505
3112.4755308484619-343.122486457595-220.03751499206244.988576688984368.073548154519
32-12.5928134304231-381.853436979765-254.039357314079228.853730453232356.667810118919
33-37.6611577093081-420.096598399757-287.722251485783212.399936067167344.774282981141
34-62.7295019881931-457.900761682199-321.11810020416195.659096227774332.441757705813
35-87.797846267078-495.307088714654-354.253817780831178.658125246674319.711396180498
36-112.866190545963-532.350684743599-387.152358302675161.419977210749306.618303651673
37-137.934534824848-569.061777137714-419.833486383715143.964416734018293.192707488018
38-163.002879103733-605.466614630551-452.314365148296126.30860694083279.460856423085
39-188.071223382618-641.588164023644-484.610011780761108.467565015525265.445717258408
40-213.139567661503-677.446657463549-516.73365537067490.4545200476682251.167522140543
41-238.207911940388-713.060027690644-548.69702150671372.2811976259367236.644203809868
42-263.276256219273-748.444258074861-580.51056115273153.9580487141853221.891745636316
43-288.344600498158-783.613666982825-612.1836365854435.4944355891236206.924465986510
44-313.412944777043-818.581140934168-643.72467384712116.8987842930355191.755251380082
45-338.481289055928-853.358327387113-675.141288801354-1.82128931050204176.395749275258
46-363.549633334813-887.955795381697-706.440392171961-20.6588744976646160.856528712071
47-388.617977613698-922.383170357466-737.628277695573-39.6076775318226145.147215130071
48-413.686321892583-956.64924804578-768.710696591794-58.661947193372129.276604260614
49-438.754666171468-990.76209127451-799.692920860398-77.8164114825378113.252758931575

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
26 & 137.817252242887 & -139.550119579668 & -43.5435239723977 & 319.178028458171 & 415.184624065441 \tabularnewline
27 & 112.748907964002 & -181.930777701299 & -79.9317818228467 & 305.429597750850 & 407.428593629303 \tabularnewline
28 & 87.6805636851168 & -223.349298765180 & -115.690932066036 & 291.052059436269 & 398.710426135413 \tabularnewline
29 & 62.6122194062318 & -263.950230253707 & -150.915489220509 & 276.139928032972 & 389.17466906617 \tabularnewline
30 & 37.5438751273468 & -303.845186970356 & -185.678434283499 & 260.766184538193 & 378.93293722505 \tabularnewline
31 & 12.4755308484619 & -343.122486457595 & -220.03751499206 & 244.988576688984 & 368.073548154519 \tabularnewline
32 & -12.5928134304231 & -381.853436979765 & -254.039357314079 & 228.853730453232 & 356.667810118919 \tabularnewline
33 & -37.6611577093081 & -420.096598399757 & -287.722251485783 & 212.399936067167 & 344.774282981141 \tabularnewline
34 & -62.7295019881931 & -457.900761682199 & -321.11810020416 & 195.659096227774 & 332.441757705813 \tabularnewline
35 & -87.797846267078 & -495.307088714654 & -354.253817780831 & 178.658125246674 & 319.711396180498 \tabularnewline
36 & -112.866190545963 & -532.350684743599 & -387.152358302675 & 161.419977210749 & 306.618303651673 \tabularnewline
37 & -137.934534824848 & -569.061777137714 & -419.833486383715 & 143.964416734018 & 293.192707488018 \tabularnewline
38 & -163.002879103733 & -605.466614630551 & -452.314365148296 & 126.30860694083 & 279.460856423085 \tabularnewline
39 & -188.071223382618 & -641.588164023644 & -484.610011780761 & 108.467565015525 & 265.445717258408 \tabularnewline
40 & -213.139567661503 & -677.446657463549 & -516.733655370674 & 90.4545200476682 & 251.167522140543 \tabularnewline
41 & -238.207911940388 & -713.060027690644 & -548.697021506713 & 72.2811976259367 & 236.644203809868 \tabularnewline
42 & -263.276256219273 & -748.444258074861 & -580.510561152731 & 53.9580487141853 & 221.891745636316 \tabularnewline
43 & -288.344600498158 & -783.613666982825 & -612.18363658544 & 35.4944355891236 & 206.924465986510 \tabularnewline
44 & -313.412944777043 & -818.581140934168 & -643.724673847121 & 16.8987842930355 & 191.755251380082 \tabularnewline
45 & -338.481289055928 & -853.358327387113 & -675.141288801354 & -1.82128931050204 & 176.395749275258 \tabularnewline
46 & -363.549633334813 & -887.955795381697 & -706.440392171961 & -20.6588744976646 & 160.856528712071 \tabularnewline
47 & -388.617977613698 & -922.383170357466 & -737.628277695573 & -39.6076775318226 & 145.147215130071 \tabularnewline
48 & -413.686321892583 & -956.64924804578 & -768.710696591794 & -58.661947193372 & 129.276604260614 \tabularnewline
49 & -438.754666171468 & -990.76209127451 & -799.692920860398 & -77.8164114825378 & 113.252758931575 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75938&T=1

[TABLE]
[ROW][C]Demand Forecast[/C][/ROW]
[ROW][C]Point[/C][C]Forecast[/C][C]95% LB[/C][C]80% LB[/C][C]80% UB[/C][C]95% UB[/C][/ROW]
[ROW][C]26[/C][C]137.817252242887[/C][C]-139.550119579668[/C][C]-43.5435239723977[/C][C]319.178028458171[/C][C]415.184624065441[/C][/ROW]
[ROW][C]27[/C][C]112.748907964002[/C][C]-181.930777701299[/C][C]-79.9317818228467[/C][C]305.429597750850[/C][C]407.428593629303[/C][/ROW]
[ROW][C]28[/C][C]87.6805636851168[/C][C]-223.349298765180[/C][C]-115.690932066036[/C][C]291.052059436269[/C][C]398.710426135413[/C][/ROW]
[ROW][C]29[/C][C]62.6122194062318[/C][C]-263.950230253707[/C][C]-150.915489220509[/C][C]276.139928032972[/C][C]389.17466906617[/C][/ROW]
[ROW][C]30[/C][C]37.5438751273468[/C][C]-303.845186970356[/C][C]-185.678434283499[/C][C]260.766184538193[/C][C]378.93293722505[/C][/ROW]
[ROW][C]31[/C][C]12.4755308484619[/C][C]-343.122486457595[/C][C]-220.03751499206[/C][C]244.988576688984[/C][C]368.073548154519[/C][/ROW]
[ROW][C]32[/C][C]-12.5928134304231[/C][C]-381.853436979765[/C][C]-254.039357314079[/C][C]228.853730453232[/C][C]356.667810118919[/C][/ROW]
[ROW][C]33[/C][C]-37.6611577093081[/C][C]-420.096598399757[/C][C]-287.722251485783[/C][C]212.399936067167[/C][C]344.774282981141[/C][/ROW]
[ROW][C]34[/C][C]-62.7295019881931[/C][C]-457.900761682199[/C][C]-321.11810020416[/C][C]195.659096227774[/C][C]332.441757705813[/C][/ROW]
[ROW][C]35[/C][C]-87.797846267078[/C][C]-495.307088714654[/C][C]-354.253817780831[/C][C]178.658125246674[/C][C]319.711396180498[/C][/ROW]
[ROW][C]36[/C][C]-112.866190545963[/C][C]-532.350684743599[/C][C]-387.152358302675[/C][C]161.419977210749[/C][C]306.618303651673[/C][/ROW]
[ROW][C]37[/C][C]-137.934534824848[/C][C]-569.061777137714[/C][C]-419.833486383715[/C][C]143.964416734018[/C][C]293.192707488018[/C][/ROW]
[ROW][C]38[/C][C]-163.002879103733[/C][C]-605.466614630551[/C][C]-452.314365148296[/C][C]126.30860694083[/C][C]279.460856423085[/C][/ROW]
[ROW][C]39[/C][C]-188.071223382618[/C][C]-641.588164023644[/C][C]-484.610011780761[/C][C]108.467565015525[/C][C]265.445717258408[/C][/ROW]
[ROW][C]40[/C][C]-213.139567661503[/C][C]-677.446657463549[/C][C]-516.733655370674[/C][C]90.4545200476682[/C][C]251.167522140543[/C][/ROW]
[ROW][C]41[/C][C]-238.207911940388[/C][C]-713.060027690644[/C][C]-548.697021506713[/C][C]72.2811976259367[/C][C]236.644203809868[/C][/ROW]
[ROW][C]42[/C][C]-263.276256219273[/C][C]-748.444258074861[/C][C]-580.510561152731[/C][C]53.9580487141853[/C][C]221.891745636316[/C][/ROW]
[ROW][C]43[/C][C]-288.344600498158[/C][C]-783.613666982825[/C][C]-612.18363658544[/C][C]35.4944355891236[/C][C]206.924465986510[/C][/ROW]
[ROW][C]44[/C][C]-313.412944777043[/C][C]-818.581140934168[/C][C]-643.724673847121[/C][C]16.8987842930355[/C][C]191.755251380082[/C][/ROW]
[ROW][C]45[/C][C]-338.481289055928[/C][C]-853.358327387113[/C][C]-675.141288801354[/C][C]-1.82128931050204[/C][C]176.395749275258[/C][/ROW]
[ROW][C]46[/C][C]-363.549633334813[/C][C]-887.955795381697[/C][C]-706.440392171961[/C][C]-20.6588744976646[/C][C]160.856528712071[/C][/ROW]
[ROW][C]47[/C][C]-388.617977613698[/C][C]-922.383170357466[/C][C]-737.628277695573[/C][C]-39.6076775318226[/C][C]145.147215130071[/C][/ROW]
[ROW][C]48[/C][C]-413.686321892583[/C][C]-956.64924804578[/C][C]-768.710696591794[/C][C]-58.661947193372[/C][C]129.276604260614[/C][/ROW]
[ROW][C]49[/C][C]-438.754666171468[/C][C]-990.76209127451[/C][C]-799.692920860398[/C][C]-77.8164114825378[/C][C]113.252758931575[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75938&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75938&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
26137.817252242887-139.550119579668-43.5435239723977319.178028458171415.184624065441
27112.748907964002-181.930777701299-79.9317818228467305.429597750850407.428593629303
2887.6805636851168-223.349298765180-115.690932066036291.052059436269398.710426135413
2962.6122194062318-263.950230253707-150.915489220509276.139928032972389.17466906617
3037.5438751273468-303.845186970356-185.678434283499260.766184538193378.93293722505
3112.4755308484619-343.122486457595-220.03751499206244.988576688984368.073548154519
32-12.5928134304231-381.853436979765-254.039357314079228.853730453232356.667810118919
33-37.6611577093081-420.096598399757-287.722251485783212.399936067167344.774282981141
34-62.7295019881931-457.900761682199-321.11810020416195.659096227774332.441757705813
35-87.797846267078-495.307088714654-354.253817780831178.658125246674319.711396180498
36-112.866190545963-532.350684743599-387.152358302675161.419977210749306.618303651673
37-137.934534824848-569.061777137714-419.833486383715143.964416734018293.192707488018
38-163.002879103733-605.466614630551-452.314365148296126.30860694083279.460856423085
39-188.071223382618-641.588164023644-484.610011780761108.467565015525265.445717258408
40-213.139567661503-677.446657463549-516.73365537067490.4545200476682251.167522140543
41-238.207911940388-713.060027690644-548.69702150671372.2811976259367236.644203809868
42-263.276256219273-748.444258074861-580.51056115273153.9580487141853221.891745636316
43-288.344600498158-783.613666982825-612.1836365854435.4944355891236206.924465986510
44-313.412944777043-818.581140934168-643.72467384712116.8987842930355191.755251380082
45-338.481289055928-853.358327387113-675.141288801354-1.82128931050204176.395749275258
46-363.549633334813-887.955795381697-706.440392171961-20.6588744976646160.856528712071
47-388.617977613698-922.383170357466-737.628277695573-39.6076775318226145.147215130071
48-413.686321892583-956.64924804578-768.710696591794-58.661947193372129.276604260614
49-438.754666171468-990.76209127451-799.692920860398-77.8164114825378113.252758931575







Actuals and Interpolation
TimeActualForecast
1724723.250932184245
2762.275708.951659916233
3721.125709.122505687033
4653.275688.027750893318
5663.7125650.13316612633
6735.5125630.378745649382
7628.1375643.244311473
8792.55612.847273246156
9636.5652.317786039178
10800.825621.589491648231
11728.05660.842815301877
12618.2625659.888667071522
13450.625619.88373918091
14767.525534.087282375116
15675.65592.774139057074
16583.25597.440724777523
17690.7875567.280936817024
18208.0625586.525266208221
19142.5425.668945310045
20205.925299.002937771023
21462.5625240.53933481731
22251.4375295.130267176479
23195.725254.38547660905
24191.625208.270449663097
25137.25177.229915639438

\begin{tabular}{lllllllll}
\hline
Actuals and Interpolation \tabularnewline
Time & Actual & Forecast \tabularnewline
1 & 724 & 723.250932184245 \tabularnewline
2 & 762.275 & 708.951659916233 \tabularnewline
3 & 721.125 & 709.122505687033 \tabularnewline
4 & 653.275 & 688.027750893318 \tabularnewline
5 & 663.7125 & 650.13316612633 \tabularnewline
6 & 735.5125 & 630.378745649382 \tabularnewline
7 & 628.1375 & 643.244311473 \tabularnewline
8 & 792.55 & 612.847273246156 \tabularnewline
9 & 636.5 & 652.317786039178 \tabularnewline
10 & 800.825 & 621.589491648231 \tabularnewline
11 & 728.05 & 660.842815301877 \tabularnewline
12 & 618.2625 & 659.888667071522 \tabularnewline
13 & 450.625 & 619.88373918091 \tabularnewline
14 & 767.525 & 534.087282375116 \tabularnewline
15 & 675.65 & 592.774139057074 \tabularnewline
16 & 583.25 & 597.440724777523 \tabularnewline
17 & 690.7875 & 567.280936817024 \tabularnewline
18 & 208.0625 & 586.525266208221 \tabularnewline
19 & 142.5 & 425.668945310045 \tabularnewline
20 & 205.925 & 299.002937771023 \tabularnewline
21 & 462.5625 & 240.53933481731 \tabularnewline
22 & 251.4375 & 295.130267176479 \tabularnewline
23 & 195.725 & 254.38547660905 \tabularnewline
24 & 191.625 & 208.270449663097 \tabularnewline
25 & 137.25 & 177.229915639438 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75938&T=2

[TABLE]
[ROW][C]Actuals and Interpolation[/C][/ROW]
[ROW][C]Time[/C][C]Actual[/C][C]Forecast[/C][/ROW]
[ROW][C]1[/C][C]724[/C][C]723.250932184245[/C][/ROW]
[ROW][C]2[/C][C]762.275[/C][C]708.951659916233[/C][/ROW]
[ROW][C]3[/C][C]721.125[/C][C]709.122505687033[/C][/ROW]
[ROW][C]4[/C][C]653.275[/C][C]688.027750893318[/C][/ROW]
[ROW][C]5[/C][C]663.7125[/C][C]650.13316612633[/C][/ROW]
[ROW][C]6[/C][C]735.5125[/C][C]630.378745649382[/C][/ROW]
[ROW][C]7[/C][C]628.1375[/C][C]643.244311473[/C][/ROW]
[ROW][C]8[/C][C]792.55[/C][C]612.847273246156[/C][/ROW]
[ROW][C]9[/C][C]636.5[/C][C]652.317786039178[/C][/ROW]
[ROW][C]10[/C][C]800.825[/C][C]621.589491648231[/C][/ROW]
[ROW][C]11[/C][C]728.05[/C][C]660.842815301877[/C][/ROW]
[ROW][C]12[/C][C]618.2625[/C][C]659.888667071522[/C][/ROW]
[ROW][C]13[/C][C]450.625[/C][C]619.88373918091[/C][/ROW]
[ROW][C]14[/C][C]767.525[/C][C]534.087282375116[/C][/ROW]
[ROW][C]15[/C][C]675.65[/C][C]592.774139057074[/C][/ROW]
[ROW][C]16[/C][C]583.25[/C][C]597.440724777523[/C][/ROW]
[ROW][C]17[/C][C]690.7875[/C][C]567.280936817024[/C][/ROW]
[ROW][C]18[/C][C]208.0625[/C][C]586.525266208221[/C][/ROW]
[ROW][C]19[/C][C]142.5[/C][C]425.668945310045[/C][/ROW]
[ROW][C]20[/C][C]205.925[/C][C]299.002937771023[/C][/ROW]
[ROW][C]21[/C][C]462.5625[/C][C]240.53933481731[/C][/ROW]
[ROW][C]22[/C][C]251.4375[/C][C]295.130267176479[/C][/ROW]
[ROW][C]23[/C][C]195.725[/C][C]254.38547660905[/C][/ROW]
[ROW][C]24[/C][C]191.625[/C][C]208.270449663097[/C][/ROW]
[ROW][C]25[/C][C]137.25[/C][C]177.229915639438[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75938&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75938&T=2

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Actuals and Interpolation
TimeActualForecast
1724723.250932184245
2762.275708.951659916233
3721.125709.122505687033
4653.275688.027750893318
5663.7125650.13316612633
6735.5125630.378745649382
7628.1375643.244311473
8792.55612.847273246156
9636.5652.317786039178
10800.825621.589491648231
11728.05660.842815301877
12618.2625659.888667071522
13450.625619.88373918091
14767.525534.087282375116
15675.65592.774139057074
16583.25597.440724777523
17690.7875567.280936817024
18208.0625586.525266208221
19142.5425.668945310045
20205.925299.002937771023
21462.5625240.53933481731
22251.4375295.130267176479
23195.725254.38547660905
24191.625208.270449663097
25137.25177.229915639438







\begin{tabular}{lllllllll}
\hline
What is next? \tabularnewline
Simulate Time Series \tabularnewline
Generate Forecasts \tabularnewline
Forecast Analysis \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75938&T=3

[TABLE]
[ROW][C]What is next?[/C][/ROW]
[ROW][C]Simulate Time Series[/C][/ROW]
[ROW][C]Generate Forecasts[/C][/ROW]
[ROW][C]Forecast Analysis[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75938&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75938&T=3

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

What is next?
Simulate Time Series
Generate Forecasts
Forecast Analysis



Parameters (Session):
par1 = Input box ; par2 = ARIMA ; par3 = NA ; par4 = NA ; par5 = ZZZ ; par6 = 12 ; par7 = dum ; par8 = dumresult ; par9 = 3 ; par10 = 0.1 ;
Parameters (R input):
par1 = Input box ; par2 = ARIMA ; par3 = NA ; par4 = NA ; par5 = ZZZ ; par6 = 12 ; par7 = dum ; par8 = dumresult ; par9 = 3 ; par10 = 0.1 ;
R code (references can be found in the software module):
if(par3!='NA') par3 <- as.numeric(par3) else par3 <- NA
if(par4!='NA') par4 <- as.numeric(par4) else par4 <- NA
par6 <- as.numeric(par6) #Seasonal Period
par9 <- as.numeric(par9) #Forecast Horizon
par10 <- as.numeric(par10) #Alpha
library(forecast)
if (par1 == 'CSV') {
xarr <- read.csv(file=paste('tmp/',par7,'.csv',sep=''),header=T)
numseries <- length(xarr[1,])-1
n <- length(xarr[,1])
nmh <- n - par9
nmhp1 <- nmh + 1
rarr <- array(NA,dim=c(n,numseries))
farr <- array(NA,dim=c(n,numseries))
parr <- array(NA,dim=c(numseries,8))
colnames(parr) = list('ME','RMSE','MAE','MPE','MAPE','MASE','ACF1','TheilU')
for(i in 1:numseries) {
sindex <- i+1
x <- xarr[,sindex]
if(par2=='Croston') {
if (i==1) m <- croston(x,alpha=par10)
if (i==1) mydemand <- m$model$demand[]
fit <- croston(x[1:nmh],h=par9,alpha=par10)
}
if(par2=='ARIMA') {
m <- auto.arima(ts(x,freq=par6),d=par3,D=par4)
mydemand <- forecast(m)
fit <- auto.arima(ts(x[1:nmh],freq=par6),d=par3,D=par4)
}
if(par2=='ETS') {
m <- ets(ts(x,freq=par6),model=par5)
mydemand <- forecast(m)
fit <- ets(ts(x[1:nmh],freq=par6),model=par5)
}
try(rarr[,i] <- mydemand$resid,silent=T)
try(farr[,i] <- mydemand$mean,silent=T)
if (par2!='Croston') parr[i,] <- accuracy(forecast(fit,par9),x[nmhp1:n])
if (par2=='Croston') parr[i,] <- accuracy(fit,x[nmhp1:n])
}
write.csv(farr,file=paste('tmp/',par8,'_f.csv',sep=''))
write.csv(rarr,file=paste('tmp/',par8,'_r.csv',sep=''))
write.csv(parr,file=paste('tmp/',par8,'_p.csv',sep=''))
}
if (par1 == 'Input box') {
numseries <- 1
n <- length(x)
if(par2=='Croston') {
m <- croston(x)
mydemand <- m$model$demand[]
}
if(par2=='ARIMA') {
m <- auto.arima(ts(x,freq=par6),d=par3,D=par4)
mydemand <- forecast(m)
}
if(par2=='ETS') {
m <- ets(ts(x,freq=par6),model=par5)
mydemand <- forecast(m)
}
summary(m)
}
bitmap(file='test1.png')
op <- par(mfrow=c(2,1))
if (par2=='Croston') plot(m)
if ((par2=='ARIMA') | par2=='ETS') plot(forecast(m))
plot(mydemand$resid,type='l',main='Residuals', ylab='residual value', xlab='time')
par(op)
dev.off()
bitmap(file='pic2.png')
op <- par(mfrow=c(2,2))
acf(mydemand$resid, lag.max=n/3, main='Residual ACF', ylab='autocorrelation', xlab='time lag')
pacf(mydemand$resid,lag.max=n/3, main='Residual PACF', ylab='partial autocorrelation', xlab='time lag')
cpgram(mydemand$resid, main='Cumulative Periodogram of Residuals')
qqnorm(mydemand$resid); qqline(mydemand$resid, col=2)
par(op)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Demand Forecast',6,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Point',header=TRUE)
a<-table.element(a,'Forecast',header=TRUE)
a<-table.element(a,'95% LB',header=TRUE)
a<-table.element(a,'80% LB',header=TRUE)
a<-table.element(a,'80% UB',header=TRUE)
a<-table.element(a,'95% UB',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(mydemand$mean)) {
a<-table.row.start(a)
a<-table.element(a,i+n,header=TRUE)
a<-table.element(a,as.numeric(mydemand$mean[i]))
a<-table.element(a,as.numeric(mydemand$lower[i,2]))
a<-table.element(a,as.numeric(mydemand$lower[i,1]))
a<-table.element(a,as.numeric(mydemand$upper[i,1]))
a<-table.element(a,as.numeric(mydemand$upper[i,2]))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Actuals and Interpolation',3,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Time',header=TRUE)
a<-table.element(a,'Actual',header=TRUE)
a<-table.element(a,'Forecast',header=TRUE)
a<-table.row.end(a)
for (i in 1:n) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,x[i])
a<-table.element(a,x[i] - as.numeric(m$resid[i]))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'What is next?',1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,hyperlink(paste('https://automated.biganalytics.eu/Patrick.Wessa/rwasp_demand_forecasting_simulate.wasp',sep=''),'Simulate Time Series','',target=''))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,hyperlink(paste('https://automated.biganalytics.eu/Patrick.Wessa/rwasp_demand_forecasting_croston.wasp',sep=''),'Generate Forecasts','',target=''))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,hyperlink(paste('https://automated.biganalytics.eu/Patrick.Wessa/rwasp_demand_forecasting_analysis.wasp',sep=''),'Forecast Analysis','',target=''))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable0.tab')
-SERVER-wessa.org