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:51:35 +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/t127375873810psbybth4v9ruc.htm/, Retrieved Mon, 06 May 2024 00:15:18 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=75940, Retrieved Mon, 06 May 2024 00:15:18 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsB11A,steven,coomans,ETS,thesis,per3maand
Estimated Impact112
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Croston Forecasting] [B11A,steven,cooma...] [2010-05-13 13:51:35] [d41d8cd98f00b204e9800998ecf8427e] [Current]
Feedback Forum

Post a new message
Dataseries X:
41
31.66666667
23.83333333
12.33333333
30.83333333
20.83333333
25.50166667
5.166666667
11.66666667
0.833333333
2.341666667
0
0.666666667
8.666666667
2.333333333
11.66666667
0.275




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 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 & 2 seconds \tabularnewline
R Server & wessa.org @ wessa.org \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75940&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]2 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]wessa.org @ wessa.org[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75940&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75940&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 time2 seconds
R Serverwessa.org @ wessa.org







Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
18-0.354618308979576-13.4745685128728-8.93329263988188.2240560219226412.7653318949137
19-1.20778653470233-14.3277372953810-9.786461229666957.3708881602622911.9121642259763
20-1.98551809456441-15.1054697751202-10.56419339100436.5931572018755211.1344335859913
21-2.69448305712276-15.8144360675430-11.27315922311435.8841931088688110.4254699532975
22-3.34076172713647-16.4607165068049-11.91943904997735.237915595704339.77919305253198
23-3.92989679215786-17.0498537961597-12.50857556941214.648781985096379.19006021184397
24-4.46694085835052-17.5869005468635-13.04562139091224.111739674211198.65301883016244
25-4.95649978321656-18.0764626133988-13.53518237000543.622182803572258.16346304696565
26-5.40277217686778-18.5227385967577-13.98145711084033.175912757104737.71719424302212
27-5.80958541061629-18.9295558546482-14.38827297583392.769102154601287.31038503341566
28-6.18042844170519-19.3004033275157-14.75911891124572.39826202783536.93954644410536
29-6.51848173569468-19.6384614619544-15.09717537023472.060211898845376.601497990565
30-6.82664454312722-19.9466294881816-15.40534159005371.752052503799256.29334040192713
31-7.1075597644049-20.2275502855488-15.68626045734031.471140928530556.01243075673899
32-7.36363661612802-20.4836330493705-15.94234117477691.215067942520915.75635981711445
33-7.59707129328852-20.7170739534929-16.17577992352900.9816373369519065.5229313669158
34-7.80986580452356-20.9298749858293-16.38857869868300.7688470896359025.31014337678219
35-8.00384514196633-21.1238611184188-16.58256247923340.574872195300765.11617083448614
36-8.18067293294808-21.3006959592754-16.75939487988060.3980490139844034.93935009337925
37-8.3418657077853-21.4618960202758-16.92059241888380.2368610033132074.7781646047052
38-8.48880590601696-21.6088437234593-17.06753752433970.08992571230581174.63123191142541
39-8.62275373263736-21.7427992572944-17.2014903904369-0.04401707483781264.49729179201965
40-8.74485796600747-21.8649113846005-17.3235997853744-0.1661161466405714.3751954525856
41-8.85616581013664-21.9762272948239-17.4349129036391-0.2774187166342034.26389567455067

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
18 & -0.354618308979576 & -13.4745685128728 & -8.9332926398818 & 8.22405602192264 & 12.7653318949137 \tabularnewline
19 & -1.20778653470233 & -14.3277372953810 & -9.78646122966695 & 7.37088816026229 & 11.9121642259763 \tabularnewline
20 & -1.98551809456441 & -15.1054697751202 & -10.5641933910043 & 6.59315720187552 & 11.1344335859913 \tabularnewline
21 & -2.69448305712276 & -15.8144360675430 & -11.2731592231143 & 5.88419310886881 & 10.4254699532975 \tabularnewline
22 & -3.34076172713647 & -16.4607165068049 & -11.9194390499773 & 5.23791559570433 & 9.77919305253198 \tabularnewline
23 & -3.92989679215786 & -17.0498537961597 & -12.5085755694121 & 4.64878198509637 & 9.19006021184397 \tabularnewline
24 & -4.46694085835052 & -17.5869005468635 & -13.0456213909122 & 4.11173967421119 & 8.65301883016244 \tabularnewline
25 & -4.95649978321656 & -18.0764626133988 & -13.5351823700054 & 3.62218280357225 & 8.16346304696565 \tabularnewline
26 & -5.40277217686778 & -18.5227385967577 & -13.9814571108403 & 3.17591275710473 & 7.71719424302212 \tabularnewline
27 & -5.80958541061629 & -18.9295558546482 & -14.3882729758339 & 2.76910215460128 & 7.31038503341566 \tabularnewline
28 & -6.18042844170519 & -19.3004033275157 & -14.7591189112457 & 2.3982620278353 & 6.93954644410536 \tabularnewline
29 & -6.51848173569468 & -19.6384614619544 & -15.0971753702347 & 2.06021189884537 & 6.601497990565 \tabularnewline
30 & -6.82664454312722 & -19.9466294881816 & -15.4053415900537 & 1.75205250379925 & 6.29334040192713 \tabularnewline
31 & -7.1075597644049 & -20.2275502855488 & -15.6862604573403 & 1.47114092853055 & 6.01243075673899 \tabularnewline
32 & -7.36363661612802 & -20.4836330493705 & -15.9423411747769 & 1.21506794252091 & 5.75635981711445 \tabularnewline
33 & -7.59707129328852 & -20.7170739534929 & -16.1757799235290 & 0.981637336951906 & 5.5229313669158 \tabularnewline
34 & -7.80986580452356 & -20.9298749858293 & -16.3885786986830 & 0.768847089635902 & 5.31014337678219 \tabularnewline
35 & -8.00384514196633 & -21.1238611184188 & -16.5825624792334 & 0.57487219530076 & 5.11617083448614 \tabularnewline
36 & -8.18067293294808 & -21.3006959592754 & -16.7593948798806 & 0.398049013984403 & 4.93935009337925 \tabularnewline
37 & -8.3418657077853 & -21.4618960202758 & -16.9205924188838 & 0.236861003313207 & 4.7781646047052 \tabularnewline
38 & -8.48880590601696 & -21.6088437234593 & -17.0675375243397 & 0.0899257123058117 & 4.63123191142541 \tabularnewline
39 & -8.62275373263736 & -21.7427992572944 & -17.2014903904369 & -0.0440170748378126 & 4.49729179201965 \tabularnewline
40 & -8.74485796600747 & -21.8649113846005 & -17.3235997853744 & -0.166116146640571 & 4.3751954525856 \tabularnewline
41 & -8.85616581013664 & -21.9762272948239 & -17.4349129036391 & -0.277418716634203 & 4.26389567455067 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75940&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]18[/C][C]-0.354618308979576[/C][C]-13.4745685128728[/C][C]-8.9332926398818[/C][C]8.22405602192264[/C][C]12.7653318949137[/C][/ROW]
[ROW][C]19[/C][C]-1.20778653470233[/C][C]-14.3277372953810[/C][C]-9.78646122966695[/C][C]7.37088816026229[/C][C]11.9121642259763[/C][/ROW]
[ROW][C]20[/C][C]-1.98551809456441[/C][C]-15.1054697751202[/C][C]-10.5641933910043[/C][C]6.59315720187552[/C][C]11.1344335859913[/C][/ROW]
[ROW][C]21[/C][C]-2.69448305712276[/C][C]-15.8144360675430[/C][C]-11.2731592231143[/C][C]5.88419310886881[/C][C]10.4254699532975[/C][/ROW]
[ROW][C]22[/C][C]-3.34076172713647[/C][C]-16.4607165068049[/C][C]-11.9194390499773[/C][C]5.23791559570433[/C][C]9.77919305253198[/C][/ROW]
[ROW][C]23[/C][C]-3.92989679215786[/C][C]-17.0498537961597[/C][C]-12.5085755694121[/C][C]4.64878198509637[/C][C]9.19006021184397[/C][/ROW]
[ROW][C]24[/C][C]-4.46694085835052[/C][C]-17.5869005468635[/C][C]-13.0456213909122[/C][C]4.11173967421119[/C][C]8.65301883016244[/C][/ROW]
[ROW][C]25[/C][C]-4.95649978321656[/C][C]-18.0764626133988[/C][C]-13.5351823700054[/C][C]3.62218280357225[/C][C]8.16346304696565[/C][/ROW]
[ROW][C]26[/C][C]-5.40277217686778[/C][C]-18.5227385967577[/C][C]-13.9814571108403[/C][C]3.17591275710473[/C][C]7.71719424302212[/C][/ROW]
[ROW][C]27[/C][C]-5.80958541061629[/C][C]-18.9295558546482[/C][C]-14.3882729758339[/C][C]2.76910215460128[/C][C]7.31038503341566[/C][/ROW]
[ROW][C]28[/C][C]-6.18042844170519[/C][C]-19.3004033275157[/C][C]-14.7591189112457[/C][C]2.3982620278353[/C][C]6.93954644410536[/C][/ROW]
[ROW][C]29[/C][C]-6.51848173569468[/C][C]-19.6384614619544[/C][C]-15.0971753702347[/C][C]2.06021189884537[/C][C]6.601497990565[/C][/ROW]
[ROW][C]30[/C][C]-6.82664454312722[/C][C]-19.9466294881816[/C][C]-15.4053415900537[/C][C]1.75205250379925[/C][C]6.29334040192713[/C][/ROW]
[ROW][C]31[/C][C]-7.1075597644049[/C][C]-20.2275502855488[/C][C]-15.6862604573403[/C][C]1.47114092853055[/C][C]6.01243075673899[/C][/ROW]
[ROW][C]32[/C][C]-7.36363661612802[/C][C]-20.4836330493705[/C][C]-15.9423411747769[/C][C]1.21506794252091[/C][C]5.75635981711445[/C][/ROW]
[ROW][C]33[/C][C]-7.59707129328852[/C][C]-20.7170739534929[/C][C]-16.1757799235290[/C][C]0.981637336951906[/C][C]5.5229313669158[/C][/ROW]
[ROW][C]34[/C][C]-7.80986580452356[/C][C]-20.9298749858293[/C][C]-16.3885786986830[/C][C]0.768847089635902[/C][C]5.31014337678219[/C][/ROW]
[ROW][C]35[/C][C]-8.00384514196633[/C][C]-21.1238611184188[/C][C]-16.5825624792334[/C][C]0.57487219530076[/C][C]5.11617083448614[/C][/ROW]
[ROW][C]36[/C][C]-8.18067293294808[/C][C]-21.3006959592754[/C][C]-16.7593948798806[/C][C]0.398049013984403[/C][C]4.93935009337925[/C][/ROW]
[ROW][C]37[/C][C]-8.3418657077853[/C][C]-21.4618960202758[/C][C]-16.9205924188838[/C][C]0.236861003313207[/C][C]4.7781646047052[/C][/ROW]
[ROW][C]38[/C][C]-8.48880590601696[/C][C]-21.6088437234593[/C][C]-17.0675375243397[/C][C]0.0899257123058117[/C][C]4.63123191142541[/C][/ROW]
[ROW][C]39[/C][C]-8.62275373263736[/C][C]-21.7427992572944[/C][C]-17.2014903904369[/C][C]-0.0440170748378126[/C][C]4.49729179201965[/C][/ROW]
[ROW][C]40[/C][C]-8.74485796600747[/C][C]-21.8649113846005[/C][C]-17.3235997853744[/C][C]-0.166116146640571[/C][C]4.3751954525856[/C][/ROW]
[ROW][C]41[/C][C]-8.85616581013664[/C][C]-21.9762272948239[/C][C]-17.4349129036391[/C][C]-0.277418716634203[/C][C]4.26389567455067[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75940&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75940&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
18-0.354618308979576-13.4745685128728-8.93329263988188.2240560219226412.7653318949137
19-1.20778653470233-14.3277372953810-9.786461229666957.3708881602622911.9121642259763
20-1.98551809456441-15.1054697751202-10.56419339100436.5931572018755211.1344335859913
21-2.69448305712276-15.8144360675430-11.27315922311435.8841931088688110.4254699532975
22-3.34076172713647-16.4607165068049-11.91943904997735.237915595704339.77919305253198
23-3.92989679215786-17.0498537961597-12.50857556941214.648781985096379.19006021184397
24-4.46694085835052-17.5869005468635-13.04562139091224.111739674211198.65301883016244
25-4.95649978321656-18.0764626133988-13.53518237000543.622182803572258.16346304696565
26-5.40277217686778-18.5227385967577-13.98145711084033.175912757104737.71719424302212
27-5.80958541061629-18.9295558546482-14.38827297583392.769102154601287.31038503341566
28-6.18042844170519-19.3004033275157-14.75911891124572.39826202783536.93954644410536
29-6.51848173569468-19.6384614619544-15.09717537023472.060211898845376.601497990565
30-6.82664454312722-19.9466294881816-15.40534159005371.752052503799256.29334040192713
31-7.1075597644049-20.2275502855488-15.68626045734031.471140928530556.01243075673899
32-7.36363661612802-20.4836330493705-15.94234117477691.215067942520915.75635981711445
33-7.59707129328852-20.7170739534929-16.17577992352900.9816373369519065.5229313669158
34-7.80986580452356-20.9298749858293-16.38857869868300.7688470896359025.31014337678219
35-8.00384514196633-21.1238611184188-16.58256247923340.574872195300765.11617083448614
36-8.18067293294808-21.3006959592754-16.75939487988060.3980490139844034.93935009337925
37-8.3418657077853-21.4618960202758-16.92059241888380.2368610033132074.7781646047052
38-8.48880590601696-21.6088437234593-17.06753752433970.08992571230581174.63123191142541
39-8.62275373263736-21.7427992572944-17.2014903904369-0.04401707483781264.49729179201965
40-8.74485796600747-21.8649113846005-17.3235997853744-0.1661161466405714.3751954525856
41-8.85616581013664-21.9762272948239-17.4349129036391-0.2774187166342034.26389567455067







Actuals and Interpolation
TimeActualForecast
14133.3763873532711
231.6666666729.6246335440404
323.8333333326.2043027371594
412.3333333323.0857558185012
530.8333333320.2411085776598
620.8333333317.6509908453781
725.5016666715.2895321468614
85.16666666713.1385354672161
911.6666666711.1752719285065
100.8333333339.3864204889596
112.3416666677.75405731874686
1206.2657718954017
130.6666666674.90837511570664
148.6666666673.6707589378187
152.3333333332.54391483550720
1611.666666671.51620952168044
170.2750.581334283101121

\begin{tabular}{lllllllll}
\hline
Actuals and Interpolation \tabularnewline
Time & Actual & Forecast \tabularnewline
1 & 41 & 33.3763873532711 \tabularnewline
2 & 31.66666667 & 29.6246335440404 \tabularnewline
3 & 23.83333333 & 26.2043027371594 \tabularnewline
4 & 12.33333333 & 23.0857558185012 \tabularnewline
5 & 30.83333333 & 20.2411085776598 \tabularnewline
6 & 20.83333333 & 17.6509908453781 \tabularnewline
7 & 25.50166667 & 15.2895321468614 \tabularnewline
8 & 5.166666667 & 13.1385354672161 \tabularnewline
9 & 11.66666667 & 11.1752719285065 \tabularnewline
10 & 0.833333333 & 9.3864204889596 \tabularnewline
11 & 2.341666667 & 7.75405731874686 \tabularnewline
12 & 0 & 6.2657718954017 \tabularnewline
13 & 0.666666667 & 4.90837511570664 \tabularnewline
14 & 8.666666667 & 3.6707589378187 \tabularnewline
15 & 2.333333333 & 2.54391483550720 \tabularnewline
16 & 11.66666667 & 1.51620952168044 \tabularnewline
17 & 0.275 & 0.581334283101121 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75940&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]41[/C][C]33.3763873532711[/C][/ROW]
[ROW][C]2[/C][C]31.66666667[/C][C]29.6246335440404[/C][/ROW]
[ROW][C]3[/C][C]23.83333333[/C][C]26.2043027371594[/C][/ROW]
[ROW][C]4[/C][C]12.33333333[/C][C]23.0857558185012[/C][/ROW]
[ROW][C]5[/C][C]30.83333333[/C][C]20.2411085776598[/C][/ROW]
[ROW][C]6[/C][C]20.83333333[/C][C]17.6509908453781[/C][/ROW]
[ROW][C]7[/C][C]25.50166667[/C][C]15.2895321468614[/C][/ROW]
[ROW][C]8[/C][C]5.166666667[/C][C]13.1385354672161[/C][/ROW]
[ROW][C]9[/C][C]11.66666667[/C][C]11.1752719285065[/C][/ROW]
[ROW][C]10[/C][C]0.833333333[/C][C]9.3864204889596[/C][/ROW]
[ROW][C]11[/C][C]2.341666667[/C][C]7.75405731874686[/C][/ROW]
[ROW][C]12[/C][C]0[/C][C]6.2657718954017[/C][/ROW]
[ROW][C]13[/C][C]0.666666667[/C][C]4.90837511570664[/C][/ROW]
[ROW][C]14[/C][C]8.666666667[/C][C]3.6707589378187[/C][/ROW]
[ROW][C]15[/C][C]2.333333333[/C][C]2.54391483550720[/C][/ROW]
[ROW][C]16[/C][C]11.66666667[/C][C]1.51620952168044[/C][/ROW]
[ROW][C]17[/C][C]0.275[/C][C]0.581334283101121[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75940&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75940&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
14133.3763873532711
231.6666666729.6246335440404
323.8333333326.2043027371594
412.3333333323.0857558185012
530.8333333320.2411085776598
620.8333333317.6509908453781
725.5016666715.2895321468614
85.16666666713.1385354672161
911.6666666711.1752719285065
100.8333333339.3864204889596
112.3416666677.75405731874686
1206.2657718954017
130.6666666674.90837511570664
148.6666666673.6707589378187
152.3333333332.54391483550720
1611.666666671.51620952168044
170.2750.581334283101121







\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=75940&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=75940&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75940&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 = ETS ; 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