Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_arimaforecasting.wasp
Title produced by softwareARIMA Forecasting
Date of computationMon, 10 Dec 2018 20:14:27 +0100
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2018/Dec/10/t1544469481uezb0i3abp9v2jn.htm/, Retrieved Wed, 15 May 2024 20:06:50 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=315834, Retrieved Wed, 15 May 2024 20:06:50 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact103
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [] [2018-12-10 19:14:27] [9e2b27cf675a1d7b8e7da04c0e26bb6a] [Current]
Feedback Forum

Post a new message
Dataseries X:
1954
2302
3054
2414
2226
2725
2589
3470
2400
3180
4009
3924
2072
2434
2956
2828
2687
2629
3150
4119
3030
3055
3821
4001
2529
2472
3134
2789
2758
2993
3282
3437
2804
3076
3782
3889
2271
2452
3084
2522
2769
3438
2839
3746
2632
2851
3871
3618
2389
2344
2678
2492
2858
2246
2800
3869
3007
3023
3907
4209




Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time2 seconds
R ServerBig Analytics Cloud Computing Center

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input view raw input (R code)  \tabularnewline
Raw Outputview raw output of R engine  \tabularnewline
Computing time2 seconds \tabularnewline
R ServerBig Analytics Cloud Computing Center \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=315834&T=0

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=315834&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 Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time2 seconds
R ServerBig Analytics Cloud Computing Center







Univariate ARIMA Extrapolation Forecast
timeY[t]F[t]95% LB95% UBp-value(H0: Y[t] = F[t])P(F[t]>Y[t-1])P(F[t]>Y[t-s])P(F[t]>Y[48])
363889-------
372271-------
382452-------
393084-------
402522-------
412769-------
423438-------
432839-------
443746-------
452632-------
462851-------
473871-------
483618-------
4923892080.71751710.13282487.61670.068800.17970
5023442415.94521994.66722877.55360.380.54550.43920
5126783002.08052527.67823517.25740.10880.99390.37760.0096
5224922676.84422229.75523164.75690.22890.49810.7331e-04
5328582723.00732271.87583214.96790.29540.82130.42732e-04
5422462992.21262518.31773506.93710.00220.69530.04480.0086
5528002994.08122520.03163508.96040.230.99780.72250.0088
5638693959.90533411.66934548.9710.38110.99990.76170.8724
5730072842.20952380.86373344.3850.260100.7940.0012
5830232955.28272484.44733466.94780.39770.42150.65520.0056
5939073846.29043306.27154427.13910.41880.99730.46680.7794
6042093817.87033279.92574396.64460.09270.38140.75080.7508

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast \tabularnewline
time & Y[t] & F[t] & 95% LB & 95% UB & p-value(H0: Y[t] = F[t]) & P(F[t]>Y[t-1]) & P(F[t]>Y[t-s]) & P(F[t]>Y[48]) \tabularnewline
36 & 3889 & - & - & - & - & - & - & - \tabularnewline
37 & 2271 & - & - & - & - & - & - & - \tabularnewline
38 & 2452 & - & - & - & - & - & - & - \tabularnewline
39 & 3084 & - & - & - & - & - & - & - \tabularnewline
40 & 2522 & - & - & - & - & - & - & - \tabularnewline
41 & 2769 & - & - & - & - & - & - & - \tabularnewline
42 & 3438 & - & - & - & - & - & - & - \tabularnewline
43 & 2839 & - & - & - & - & - & - & - \tabularnewline
44 & 3746 & - & - & - & - & - & - & - \tabularnewline
45 & 2632 & - & - & - & - & - & - & - \tabularnewline
46 & 2851 & - & - & - & - & - & - & - \tabularnewline
47 & 3871 & - & - & - & - & - & - & - \tabularnewline
48 & 3618 & - & - & - & - & - & - & - \tabularnewline
49 & 2389 & 2080.7175 & 1710.1328 & 2487.6167 & 0.0688 & 0 & 0.1797 & 0 \tabularnewline
50 & 2344 & 2415.9452 & 1994.6672 & 2877.5536 & 0.38 & 0.5455 & 0.4392 & 0 \tabularnewline
51 & 2678 & 3002.0805 & 2527.6782 & 3517.2574 & 0.1088 & 0.9939 & 0.3776 & 0.0096 \tabularnewline
52 & 2492 & 2676.8442 & 2229.7552 & 3164.7569 & 0.2289 & 0.4981 & 0.733 & 1e-04 \tabularnewline
53 & 2858 & 2723.0073 & 2271.8758 & 3214.9679 & 0.2954 & 0.8213 & 0.4273 & 2e-04 \tabularnewline
54 & 2246 & 2992.2126 & 2518.3177 & 3506.9371 & 0.0022 & 0.6953 & 0.0448 & 0.0086 \tabularnewline
55 & 2800 & 2994.0812 & 2520.0316 & 3508.9604 & 0.23 & 0.9978 & 0.7225 & 0.0088 \tabularnewline
56 & 3869 & 3959.9053 & 3411.6693 & 4548.971 & 0.3811 & 0.9999 & 0.7617 & 0.8724 \tabularnewline
57 & 3007 & 2842.2095 & 2380.8637 & 3344.385 & 0.2601 & 0 & 0.794 & 0.0012 \tabularnewline
58 & 3023 & 2955.2827 & 2484.4473 & 3466.9478 & 0.3977 & 0.4215 & 0.6552 & 0.0056 \tabularnewline
59 & 3907 & 3846.2904 & 3306.2715 & 4427.1391 & 0.4188 & 0.9973 & 0.4668 & 0.7794 \tabularnewline
60 & 4209 & 3817.8703 & 3279.9257 & 4396.6446 & 0.0927 & 0.3814 & 0.7508 & 0.7508 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=315834&T=1

[TABLE]
[ROW][C]Univariate ARIMA Extrapolation Forecast[/C][/ROW]
[ROW][C]time[/C][C]Y[t][/C][C]F[t][/C][C]95% LB[/C][C]95% UB[/C][C]p-value(H0: Y[t] = F[t])[/C][C]P(F[t]>Y[t-1])[/C][C]P(F[t]>Y[t-s])[/C][C]P(F[t]>Y[48])[/C][/ROW]
[ROW][C]36[/C][C]3889[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]37[/C][C]2271[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]38[/C][C]2452[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]39[/C][C]3084[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]40[/C][C]2522[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]41[/C][C]2769[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]42[/C][C]3438[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]43[/C][C]2839[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]44[/C][C]3746[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]45[/C][C]2632[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]46[/C][C]2851[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]47[/C][C]3871[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]48[/C][C]3618[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]49[/C][C]2389[/C][C]2080.7175[/C][C]1710.1328[/C][C]2487.6167[/C][C]0.0688[/C][C]0[/C][C]0.1797[/C][C]0[/C][/ROW]
[ROW][C]50[/C][C]2344[/C][C]2415.9452[/C][C]1994.6672[/C][C]2877.5536[/C][C]0.38[/C][C]0.5455[/C][C]0.4392[/C][C]0[/C][/ROW]
[ROW][C]51[/C][C]2678[/C][C]3002.0805[/C][C]2527.6782[/C][C]3517.2574[/C][C]0.1088[/C][C]0.9939[/C][C]0.3776[/C][C]0.0096[/C][/ROW]
[ROW][C]52[/C][C]2492[/C][C]2676.8442[/C][C]2229.7552[/C][C]3164.7569[/C][C]0.2289[/C][C]0.4981[/C][C]0.733[/C][C]1e-04[/C][/ROW]
[ROW][C]53[/C][C]2858[/C][C]2723.0073[/C][C]2271.8758[/C][C]3214.9679[/C][C]0.2954[/C][C]0.8213[/C][C]0.4273[/C][C]2e-04[/C][/ROW]
[ROW][C]54[/C][C]2246[/C][C]2992.2126[/C][C]2518.3177[/C][C]3506.9371[/C][C]0.0022[/C][C]0.6953[/C][C]0.0448[/C][C]0.0086[/C][/ROW]
[ROW][C]55[/C][C]2800[/C][C]2994.0812[/C][C]2520.0316[/C][C]3508.9604[/C][C]0.23[/C][C]0.9978[/C][C]0.7225[/C][C]0.0088[/C][/ROW]
[ROW][C]56[/C][C]3869[/C][C]3959.9053[/C][C]3411.6693[/C][C]4548.971[/C][C]0.3811[/C][C]0.9999[/C][C]0.7617[/C][C]0.8724[/C][/ROW]
[ROW][C]57[/C][C]3007[/C][C]2842.2095[/C][C]2380.8637[/C][C]3344.385[/C][C]0.2601[/C][C]0[/C][C]0.794[/C][C]0.0012[/C][/ROW]
[ROW][C]58[/C][C]3023[/C][C]2955.2827[/C][C]2484.4473[/C][C]3466.9478[/C][C]0.3977[/C][C]0.4215[/C][C]0.6552[/C][C]0.0056[/C][/ROW]
[ROW][C]59[/C][C]3907[/C][C]3846.2904[/C][C]3306.2715[/C][C]4427.1391[/C][C]0.4188[/C][C]0.9973[/C][C]0.4668[/C][C]0.7794[/C][/ROW]
[ROW][C]60[/C][C]4209[/C][C]3817.8703[/C][C]3279.9257[/C][C]4396.6446[/C][C]0.0927[/C][C]0.3814[/C][C]0.7508[/C][C]0.7508[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=315834&T=1

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

As an alternative you can also use a QR Code:  

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

Univariate ARIMA Extrapolation Forecast
timeY[t]F[t]95% LB95% UBp-value(H0: Y[t] = F[t])P(F[t]>Y[t-1])P(F[t]>Y[t-s])P(F[t]>Y[48])
363889-------
372271-------
382452-------
393084-------
402522-------
412769-------
423438-------
432839-------
443746-------
452632-------
462851-------
473871-------
483618-------
4923892080.71751710.13282487.61670.068800.17970
5023442415.94521994.66722877.55360.380.54550.43920
5126783002.08052527.67823517.25740.10880.99390.37760.0096
5224922676.84422229.75523164.75690.22890.49810.7331e-04
5328582723.00732271.87583214.96790.29540.82130.42732e-04
5422462992.21262518.31773506.93710.00220.69530.04480.0086
5528002994.08122520.03163508.96040.230.99780.72250.0088
5638693959.90533411.66934548.9710.38110.99990.76170.8724
5730072842.20952380.86373344.3850.260100.7940.0012
5830232955.28272484.44733466.94780.39770.42150.65520.0056
5939073846.29043306.27154427.13910.41880.99730.46680.7794
6042093817.87033279.92574396.64460.09270.38140.75080.7508







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
490.09980.1290.1290.137995038.0757000.64840.6484
500.0975-0.03070.07990.08415176.108450107.0921223.8461-0.15130.3999
510.0876-0.1210.09360.0941105028.197968414.1273261.5609-0.68160.4938
520.093-0.07420.08870.088534167.3959852.443244.6476-0.38880.4675
530.09220.04720.08040.080418223.024551526.5593226.99460.28390.4308
540.0878-0.33220.12240.1145556833.2221135744.3364368.435-1.56950.6206
550.0877-0.06930.11480.107737667.5028121733.3602348.9031-0.40820.5902
560.0759-0.02350.10340.09728263.7719107549.6617327.9477-0.19120.5404
570.09010.05480.0980.092627155.925398617.0243314.03350.34660.5188
580.08830.02240.09040.08564585.63789213.8856298.68690.14240.4812
590.0770.01550.08360.07933685.652981438.5917285.37450.12770.4491
600.07730.09290.08440.0808152982.477887400.5822295.63590.82260.4802

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
49 & 0.0998 & 0.129 & 0.129 & 0.1379 & 95038.0757 & 0 & 0 & 0.6484 & 0.6484 \tabularnewline
50 & 0.0975 & -0.0307 & 0.0799 & 0.0841 & 5176.1084 & 50107.0921 & 223.8461 & -0.1513 & 0.3999 \tabularnewline
51 & 0.0876 & -0.121 & 0.0936 & 0.0941 & 105028.1979 & 68414.1273 & 261.5609 & -0.6816 & 0.4938 \tabularnewline
52 & 0.093 & -0.0742 & 0.0887 & 0.0885 & 34167.39 & 59852.443 & 244.6476 & -0.3888 & 0.4675 \tabularnewline
53 & 0.0922 & 0.0472 & 0.0804 & 0.0804 & 18223.0245 & 51526.5593 & 226.9946 & 0.2839 & 0.4308 \tabularnewline
54 & 0.0878 & -0.3322 & 0.1224 & 0.1145 & 556833.2221 & 135744.3364 & 368.435 & -1.5695 & 0.6206 \tabularnewline
55 & 0.0877 & -0.0693 & 0.1148 & 0.1077 & 37667.5028 & 121733.3602 & 348.9031 & -0.4082 & 0.5902 \tabularnewline
56 & 0.0759 & -0.0235 & 0.1034 & 0.0972 & 8263.7719 & 107549.6617 & 327.9477 & -0.1912 & 0.5404 \tabularnewline
57 & 0.0901 & 0.0548 & 0.098 & 0.0926 & 27155.9253 & 98617.0243 & 314.0335 & 0.3466 & 0.5188 \tabularnewline
58 & 0.0883 & 0.0224 & 0.0904 & 0.0856 & 4585.637 & 89213.8856 & 298.6869 & 0.1424 & 0.4812 \tabularnewline
59 & 0.077 & 0.0155 & 0.0836 & 0.0793 & 3685.6529 & 81438.5917 & 285.3745 & 0.1277 & 0.4491 \tabularnewline
60 & 0.0773 & 0.0929 & 0.0844 & 0.0808 & 152982.4778 & 87400.5822 & 295.6359 & 0.8226 & 0.4802 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=315834&T=2

[TABLE]
[ROW][C]Univariate ARIMA Extrapolation Forecast Performance[/C][/ROW]
[ROW][C]time[/C][C]% S.E.[/C][C]PE[/C][C]MAPE[/C][C]sMAPE[/C][C]Sq.E[/C][C]MSE[/C][C]RMSE[/C][C]ScaledE[/C][C]MASE[/C][/ROW]
[ROW][C]49[/C][C]0.0998[/C][C]0.129[/C][C]0.129[/C][C]0.1379[/C][C]95038.0757[/C][C]0[/C][C]0[/C][C]0.6484[/C][C]0.6484[/C][/ROW]
[ROW][C]50[/C][C]0.0975[/C][C]-0.0307[/C][C]0.0799[/C][C]0.0841[/C][C]5176.1084[/C][C]50107.0921[/C][C]223.8461[/C][C]-0.1513[/C][C]0.3999[/C][/ROW]
[ROW][C]51[/C][C]0.0876[/C][C]-0.121[/C][C]0.0936[/C][C]0.0941[/C][C]105028.1979[/C][C]68414.1273[/C][C]261.5609[/C][C]-0.6816[/C][C]0.4938[/C][/ROW]
[ROW][C]52[/C][C]0.093[/C][C]-0.0742[/C][C]0.0887[/C][C]0.0885[/C][C]34167.39[/C][C]59852.443[/C][C]244.6476[/C][C]-0.3888[/C][C]0.4675[/C][/ROW]
[ROW][C]53[/C][C]0.0922[/C][C]0.0472[/C][C]0.0804[/C][C]0.0804[/C][C]18223.0245[/C][C]51526.5593[/C][C]226.9946[/C][C]0.2839[/C][C]0.4308[/C][/ROW]
[ROW][C]54[/C][C]0.0878[/C][C]-0.3322[/C][C]0.1224[/C][C]0.1145[/C][C]556833.2221[/C][C]135744.3364[/C][C]368.435[/C][C]-1.5695[/C][C]0.6206[/C][/ROW]
[ROW][C]55[/C][C]0.0877[/C][C]-0.0693[/C][C]0.1148[/C][C]0.1077[/C][C]37667.5028[/C][C]121733.3602[/C][C]348.9031[/C][C]-0.4082[/C][C]0.5902[/C][/ROW]
[ROW][C]56[/C][C]0.0759[/C][C]-0.0235[/C][C]0.1034[/C][C]0.0972[/C][C]8263.7719[/C][C]107549.6617[/C][C]327.9477[/C][C]-0.1912[/C][C]0.5404[/C][/ROW]
[ROW][C]57[/C][C]0.0901[/C][C]0.0548[/C][C]0.098[/C][C]0.0926[/C][C]27155.9253[/C][C]98617.0243[/C][C]314.0335[/C][C]0.3466[/C][C]0.5188[/C][/ROW]
[ROW][C]58[/C][C]0.0883[/C][C]0.0224[/C][C]0.0904[/C][C]0.0856[/C][C]4585.637[/C][C]89213.8856[/C][C]298.6869[/C][C]0.1424[/C][C]0.4812[/C][/ROW]
[ROW][C]59[/C][C]0.077[/C][C]0.0155[/C][C]0.0836[/C][C]0.0793[/C][C]3685.6529[/C][C]81438.5917[/C][C]285.3745[/C][C]0.1277[/C][C]0.4491[/C][/ROW]
[ROW][C]60[/C][C]0.0773[/C][C]0.0929[/C][C]0.0844[/C][C]0.0808[/C][C]152982.4778[/C][C]87400.5822[/C][C]295.6359[/C][C]0.8226[/C][C]0.4802[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=315834&T=2

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

As an alternative you can also use a QR Code:  

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

Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
490.09980.1290.1290.137995038.0757000.64840.6484
500.0975-0.03070.07990.08415176.108450107.0921223.8461-0.15130.3999
510.0876-0.1210.09360.0941105028.197968414.1273261.5609-0.68160.4938
520.093-0.07420.08870.088534167.3959852.443244.6476-0.38880.4675
530.09220.04720.08040.080418223.024551526.5593226.99460.28390.4308
540.0878-0.33220.12240.1145556833.2221135744.3364368.435-1.56950.6206
550.0877-0.06930.11480.107737667.5028121733.3602348.9031-0.40820.5902
560.0759-0.02350.10340.09728263.7719107549.6617327.9477-0.19120.5404
570.09010.05480.0980.092627155.925398617.0243314.03350.34660.5188
580.08830.02240.09040.08564585.63789213.8856298.68690.14240.4812
590.0770.01550.08360.07933685.652981438.5917285.37450.12770.4491
600.07730.09290.08440.0808152982.477887400.5822295.63590.82260.4802



Parameters (Session):
par1 = 12 ; par2 = 0.5 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 1 ; par7 = 0 ; par8 = 2 ; par9 = 0 ; par10 = FALSE ;
Parameters (R input):
par1 = 12 ; par2 = 0.5 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 1 ; par7 = 0 ; par8 = 2 ; par9 = 0 ; par10 = FALSE ;
R code (references can be found in the software module):
par10 <- 'TRUE'
par9 <- '0'
par8 <- '2'
par7 <- '0'
par6 <- '1'
par5 <- '12'
par4 <- '1'
par3 <- '0'
par2 <- '0.5'
par1 <- '24'
par1 <- as.numeric(par1) #cut off periods
par2 <- as.numeric(par2) #lambda
par3 <- as.numeric(par3) #degree of non-seasonal differencing
par4 <- as.numeric(par4) #degree of seasonal differencing
par5 <- as.numeric(par5) #seasonal period
par6 <- as.numeric(par6) #p
par7 <- as.numeric(par7) #q
par8 <- as.numeric(par8) #P
par9 <- as.numeric(par9) #Q
if (par10 == 'TRUE') par10 <- TRUE
if (par10 == 'FALSE') par10 <- FALSE
if (par2 == 0) x <- log(x)
if (par2 != 0) x <- x^par2
lx <- length(x)
first <- lx - 2*par1
nx <- lx - par1
nx1 <- nx + 1
fx <- lx - nx
if (fx < 1) {
fx <- par5*2
nx1 <- lx + fx - 1
first <- lx - 2*fx
}
first <- 1
if (fx < 3) fx <- round(lx/10,0)
(arima.out <- arima(x[1:nx], order=c(par6,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5), include.mean=par10, method='ML'))
(forecast <- predict(arima.out,fx))
(lb <- forecast$pred - 1.96 * forecast$se)
(ub <- forecast$pred + 1.96 * forecast$se)
if (par2 == 0) {
x <- exp(x)
forecast$pred <- exp(forecast$pred)
lb <- exp(lb)
ub <- exp(ub)
}
if (par2 != 0) {
x <- x^(1/par2)
forecast$pred <- forecast$pred^(1/par2)
lb <- lb^(1/par2)
ub <- ub^(1/par2)
}
if (par2 < 0) {
olb <- lb
lb <- ub
ub <- olb
}
(actandfor <- c(x[1:nx], forecast$pred))
(perc.se <- (ub-forecast$pred)/1.96/forecast$pred)
bitmap(file='test1.png')
opar <- par(mar=c(4,4,2,2),las=1)
ylim <- c( min(x[first:nx],lb), max(x[first:nx],ub))
plot(x,ylim=ylim,type='n',xlim=c(first,lx))
usr <- par('usr')
rect(usr[1],usr[3],nx+1,usr[4],border=NA,col='lemonchiffon')
rect(nx1,usr[3],usr[2],usr[4],border=NA,col='lavender')
abline(h= (-3:3)*2 , col ='gray', lty =3)
polygon( c(nx1:lx,lx:nx1), c(lb,rev(ub)), col = 'orange', lty=2,border=NA)
lines(nx1:lx, lb , lty=2)
lines(nx1:lx, ub , lty=2)
lines(x, lwd=2)
lines(nx1:lx, forecast$pred , lwd=2 , col ='white')
box()
par(opar)
dev.off()
prob.dec <- array(NA, dim=fx)
prob.sdec <- array(NA, dim=fx)
prob.ldec <- array(NA, dim=fx)
prob.pval <- array(NA, dim=fx)
perf.pe <- array(0, dim=fx)
perf.spe <- array(0, dim=fx)
perf.scalederr <- array(0, dim=fx)
perf.mase <- array(0, dim=fx)
perf.mase1 <- array(0, dim=fx)
perf.mape <- array(0, dim=fx)
perf.smape <- array(0, dim=fx)
perf.mape1 <- array(0, dim=fx)
perf.smape1 <- array(0,dim=fx)
perf.se <- array(0, dim=fx)
perf.mse <- array(0, dim=fx)
perf.mse1 <- array(0, dim=fx)
perf.rmse <- array(0, dim=fx)
perf.scaleddenom <- 0
for (i in 2:fx) {
perf.scaleddenom = perf.scaleddenom + abs(x[nx+i] - x[nx+i-1])
}
perf.scaleddenom = perf.scaleddenom / (fx-1)
for (i in 1:fx) {
locSD <- (ub[i] - forecast$pred[i]) / 1.96
perf.scalederr[i] = (x[nx+i] - forecast$pred[i]) / perf.scaleddenom
perf.pe[i] = (x[nx+i] - forecast$pred[i]) / x[nx+i]
perf.spe[i] = 2*(x[nx+i] - forecast$pred[i]) / (x[nx+i] + forecast$pred[i])
perf.se[i] = (x[nx+i] - forecast$pred[i])^2
prob.dec[i] = pnorm((x[nx+i-1] - forecast$pred[i]) / locSD)
prob.sdec[i] = pnorm((x[nx+i-par5] - forecast$pred[i]) / locSD)
prob.ldec[i] = pnorm((x[nx] - forecast$pred[i]) / locSD)
prob.pval[i] = pnorm(abs(x[nx+i] - forecast$pred[i]) / locSD)
}
perf.mape[1] = abs(perf.pe[1])
perf.smape[1] = abs(perf.spe[1])
perf.mape1[1] = perf.mape[1]
perf.smape1[1] = perf.smape[1]
perf.mse[1] = perf.se[1]
perf.mase[1] = abs(perf.scalederr[1])
perf.mase1[1] = perf.mase[1]
for (i in 2:fx) {
perf.mape[i] = perf.mape[i-1] + abs(perf.pe[i])
perf.mape1[i] = perf.mape[i] / i
perf.smape[i] = perf.smape[i-1] + abs(perf.spe[i])
perf.smape1[i] = perf.smape[i] / i
perf.mse[i] = perf.mse[i-1] + perf.se[i]
perf.mse1[i] = perf.mse[i] / i
perf.mase[i] = perf.mase[i-1] + abs(perf.scalederr[i])
perf.mase1[i] = perf.mase[i] / i
}
perf.rmse = sqrt(perf.mse1)
bitmap(file='test2.png')
plot(forecast$pred, pch=19, type='b',main='ARIMA Extrapolation Forecast', ylab='Forecast and 95% CI', xlab='time',ylim=c(min(lb),max(ub)))
dum <- forecast$pred
dum[1:par1] <- x[(nx+1):lx]
lines(dum, lty=1)
lines(ub,lty=3)
lines(lb,lty=3)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Univariate ARIMA Extrapolation Forecast',9,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'time',1,header=TRUE)
a<-table.element(a,'Y[t]',1,header=TRUE)
a<-table.element(a,'F[t]',1,header=TRUE)
a<-table.element(a,'95% LB',1,header=TRUE)
a<-table.element(a,'95% UB',1,header=TRUE)
a<-table.element(a,'p-value
(H0: Y[t] = F[t])',1,header=TRUE)
a<-table.element(a,'P(F[t]>Y[t-1])',1,header=TRUE)
a<-table.element(a,'P(F[t]>Y[t-s])',1,header=TRUE)
mylab <- paste('P(F[t]>Y[',nx,sep='')
mylab <- paste(mylab,'])',sep='')
a<-table.element(a,mylab,1,header=TRUE)
a<-table.row.end(a)
for (i in (nx-par5):nx) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,x[i])
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.row.end(a)
}
for (i in 1:fx) {
a<-table.row.start(a)
a<-table.element(a,nx+i,header=TRUE)
a<-table.element(a,round(x[nx+i],4))
a<-table.element(a,round(forecast$pred[i],4))
a<-table.element(a,round(lb[i],4))
a<-table.element(a,round(ub[i],4))
a<-table.element(a,round((1-prob.pval[i]),4))
a<-table.element(a,round((1-prob.dec[i]),4))
a<-table.element(a,round((1-prob.sdec[i]),4))
a<-table.element(a,round((1-prob.ldec[i]),4))
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,'Univariate ARIMA Extrapolation Forecast Performance',10,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'time',1,header=TRUE)
a<-table.element(a,'% S.E.',1,header=TRUE)
a<-table.element(a,'PE',1,header=TRUE)
a<-table.element(a,'MAPE',1,header=TRUE)
a<-table.element(a,'sMAPE',1,header=TRUE)
a<-table.element(a,'Sq.E',1,header=TRUE)
a<-table.element(a,'MSE',1,header=TRUE)
a<-table.element(a,'RMSE',1,header=TRUE)
a<-table.element(a,'ScaledE',1,header=TRUE)
a<-table.element(a,'MASE',1,header=TRUE)
a<-table.row.end(a)
for (i in 1:fx) {
a<-table.row.start(a)
a<-table.element(a,nx+i,header=TRUE)
a<-table.element(a,round(perc.se[i],4))
a<-table.element(a,round(perf.pe[i],4))
a<-table.element(a,round(perf.mape1[i],4))
a<-table.element(a,round(perf.smape1[i],4))
a<-table.element(a,round(perf.se[i],4))
a<-table.element(a,round(perf.mse1[i],4))
a<-table.element(a,round(perf.rmse[i],4))
a<-table.element(a,round(perf.scalederr[i],4))
a<-table.element(a,round(perf.mase1[i],4))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')