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:23:18 +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/t1273757036mvau1jn8z7bl48v.htm/, Retrieved Mon, 06 May 2024 05:54:36 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=75932, Retrieved Mon, 06 May 2024 05:54:36 +0000
QR Codes:

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

Post a new message
Dataseries X:
22.325
94.125
12.275
7.125
18.925
38.025
28.138
2.386
13.225
26.25
31.975
31.275
34.4875
52.1375
15.675
48.9
16.5
37
54.125
34.4875
44.4875
40.2
52.13
49.575
44.3625




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=75932&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=75932&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75932&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
2634.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
2734.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
2834.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
2934.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3034.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3134.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3234.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3334.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3434.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3534.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3634.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3734.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3834.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3934.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4034.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4134.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4234.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4334.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4434.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4534.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4634.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4734.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4834.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4934.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
26 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
27 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
28 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
29 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
30 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
31 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
32 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
33 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
34 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
35 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
36 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
37 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
38 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
39 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
40 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
41 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
42 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
43 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
44 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
45 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
46 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
47 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
48 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
49 & 34.004660000026 & -3.51342843642327 & 9.47290056402003 & 58.536419436032 & 71.5227484364753 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75932&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]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]27[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]28[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]29[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]30[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]31[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]32[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]33[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]34[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]35[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]36[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]37[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]38[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]39[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]40[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]41[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]42[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]43[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]44[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]45[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]46[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]47[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]48[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[ROW][C]49[/C][C]34.004660000026[/C][C]-3.51342843642327[/C][C]9.47290056402003[/C][C]58.536419436032[/C][C]71.5227484364753[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75932&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75932&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
2634.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
2734.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
2834.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
2934.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3034.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3134.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3234.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3334.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3434.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3534.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3634.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3734.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3834.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
3934.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4034.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4134.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4234.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4334.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4434.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4534.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4634.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4734.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4834.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753
4934.004660000026-3.513428436423279.4729005640200358.53641943603271.5227484364753







Actuals and Interpolation
TimeActualForecast
122.32534.004660000026
294.12534.004660000026
312.27534.004660000026
47.12534.004660000026
518.92534.004660000026
638.02534.004660000026
728.13834.004660000026
82.38634.004660000026
913.22534.004660000026
1026.2534.004660000026
1131.97534.004660000026
1231.27534.004660000026
1334.487534.004660000026
1452.137534.004660000026
1515.67534.004660000026
1648.934.004660000026
1716.534.004660000026
183734.004660000026
1954.12534.004660000026
2034.487534.004660000026
2144.487534.004660000026
2240.234.004660000026
2352.1334.004660000026
2449.57534.004660000026
2544.362534.004660000026

\begin{tabular}{lllllllll}
\hline
Actuals and Interpolation \tabularnewline
Time & Actual & Forecast \tabularnewline
1 & 22.325 & 34.004660000026 \tabularnewline
2 & 94.125 & 34.004660000026 \tabularnewline
3 & 12.275 & 34.004660000026 \tabularnewline
4 & 7.125 & 34.004660000026 \tabularnewline
5 & 18.925 & 34.004660000026 \tabularnewline
6 & 38.025 & 34.004660000026 \tabularnewline
7 & 28.138 & 34.004660000026 \tabularnewline
8 & 2.386 & 34.004660000026 \tabularnewline
9 & 13.225 & 34.004660000026 \tabularnewline
10 & 26.25 & 34.004660000026 \tabularnewline
11 & 31.975 & 34.004660000026 \tabularnewline
12 & 31.275 & 34.004660000026 \tabularnewline
13 & 34.4875 & 34.004660000026 \tabularnewline
14 & 52.1375 & 34.004660000026 \tabularnewline
15 & 15.675 & 34.004660000026 \tabularnewline
16 & 48.9 & 34.004660000026 \tabularnewline
17 & 16.5 & 34.004660000026 \tabularnewline
18 & 37 & 34.004660000026 \tabularnewline
19 & 54.125 & 34.004660000026 \tabularnewline
20 & 34.4875 & 34.004660000026 \tabularnewline
21 & 44.4875 & 34.004660000026 \tabularnewline
22 & 40.2 & 34.004660000026 \tabularnewline
23 & 52.13 & 34.004660000026 \tabularnewline
24 & 49.575 & 34.004660000026 \tabularnewline
25 & 44.3625 & 34.004660000026 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75932&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]22.325[/C][C]34.004660000026[/C][/ROW]
[ROW][C]2[/C][C]94.125[/C][C]34.004660000026[/C][/ROW]
[ROW][C]3[/C][C]12.275[/C][C]34.004660000026[/C][/ROW]
[ROW][C]4[/C][C]7.125[/C][C]34.004660000026[/C][/ROW]
[ROW][C]5[/C][C]18.925[/C][C]34.004660000026[/C][/ROW]
[ROW][C]6[/C][C]38.025[/C][C]34.004660000026[/C][/ROW]
[ROW][C]7[/C][C]28.138[/C][C]34.004660000026[/C][/ROW]
[ROW][C]8[/C][C]2.386[/C][C]34.004660000026[/C][/ROW]
[ROW][C]9[/C][C]13.225[/C][C]34.004660000026[/C][/ROW]
[ROW][C]10[/C][C]26.25[/C][C]34.004660000026[/C][/ROW]
[ROW][C]11[/C][C]31.975[/C][C]34.004660000026[/C][/ROW]
[ROW][C]12[/C][C]31.275[/C][C]34.004660000026[/C][/ROW]
[ROW][C]13[/C][C]34.4875[/C][C]34.004660000026[/C][/ROW]
[ROW][C]14[/C][C]52.1375[/C][C]34.004660000026[/C][/ROW]
[ROW][C]15[/C][C]15.675[/C][C]34.004660000026[/C][/ROW]
[ROW][C]16[/C][C]48.9[/C][C]34.004660000026[/C][/ROW]
[ROW][C]17[/C][C]16.5[/C][C]34.004660000026[/C][/ROW]
[ROW][C]18[/C][C]37[/C][C]34.004660000026[/C][/ROW]
[ROW][C]19[/C][C]54.125[/C][C]34.004660000026[/C][/ROW]
[ROW][C]20[/C][C]34.4875[/C][C]34.004660000026[/C][/ROW]
[ROW][C]21[/C][C]44.4875[/C][C]34.004660000026[/C][/ROW]
[ROW][C]22[/C][C]40.2[/C][C]34.004660000026[/C][/ROW]
[ROW][C]23[/C][C]52.13[/C][C]34.004660000026[/C][/ROW]
[ROW][C]24[/C][C]49.575[/C][C]34.004660000026[/C][/ROW]
[ROW][C]25[/C][C]44.3625[/C][C]34.004660000026[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75932&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75932&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
122.32534.004660000026
294.12534.004660000026
312.27534.004660000026
47.12534.004660000026
518.92534.004660000026
638.02534.004660000026
728.13834.004660000026
82.38634.004660000026
913.22534.004660000026
1026.2534.004660000026
1131.97534.004660000026
1231.27534.004660000026
1334.487534.004660000026
1452.137534.004660000026
1515.67534.004660000026
1648.934.004660000026
1716.534.004660000026
183734.004660000026
1954.12534.004660000026
2034.487534.004660000026
2144.487534.004660000026
2240.234.004660000026
2352.1334.004660000026
2449.57534.004660000026
2544.362534.004660000026







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

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