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 computationWed, 21 Dec 2016 11:55:59 +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/2016/Dec/21/t14823177798k860tob4g2v26e.htm/, Retrieved Mon, 06 May 2024 15:19:36 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=302155, Retrieved Mon, 06 May 2024 15:19:36 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact57
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [] [2016-12-21 10:55:59] [ada7696de20b35d9f514c719a1db97fd] [Current]
Feedback Forum

Post a new message
Dataseries X:
1.894
1.757
3.582
5.321
5.561
5.907
4.944
4.966
3.258
1.964
1.743
1.262
2.086
1.793
3.548
5.672
6.084
4.914
4.990
5.139
3.218
2.179
2.238
1.442
2.205
2.025
3.531
4.977
7.998
4.880
5.231
5.202
3.303
2.683
2.202
1.376
2.422
1.997
3.163
5.964
5.657
6.415
6.208
4.500
2.939
2.702
2.090
1.504
2.549
1.931
3.013
6.204
5.788
5.611
5.594
4.647
3.490
2.487
1.992
1.507
2.306
2.002
3.075
5.331
5.589
5.813
4.876
4.665
3.601
2.192
2.111
1.580
2.288
1.993
3.228
5.000
5.480
5.770
4.962
4.685
3.607
2.222
2.467
1.594
2.228
1.910
3.157
4.809
6.249
4.607
4.975
4.784
3.028
2.461
2.218
1.351
2.070
1.887
3.024
4.596
6.398
4.459
5.382
4.359
2.687
2.249
2.154
1.169
2.429
1.762
2.846
5.627
5.749
4.502
5.720
4.403
2.867
2.635
2.059
1.511
2.359
1.741
2.917
6.249
5.760
6.250
5.134
4.831
3.695
2.462
2.146
1.579




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302155&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[120])
1081.169-------
1092.429-------
1101.762-------
1112.846-------
1125.627-------
1135.749-------
1144.502-------
1155.72-------
1164.403-------
1172.867-------
1182.635-------
1192.059-------
1201.511-------
1212.3592.38562.03022.82630.45290.99990.42350.9999
1221.7411.83141.57732.14130.28384e-040.66960.9786
1232.9173.03732.55433.64590.349310.7311
1246.2495.68944.62127.10210.21880.99990.53451
1255.765.74564.66417.17710.49210.24530.49811
1266.255.03874.12236.23850.02390.11930.80971
1275.1345.46574.45026.80420.31360.12540.35481
1284.8314.63383.80955.70590.35920.18020.66351
1293.6953.15292.64663.79280.048400.80941
1302.4622.54122.1563.02080.373100.35081
1312.1462.07711.7792.44360.35630.01980.53860.9988
1321.5791.55591.34941.80530.427900.63780.6378

\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[120]) \tabularnewline
108 & 1.169 & - & - & - & - & - & - & - \tabularnewline
109 & 2.429 & - & - & - & - & - & - & - \tabularnewline
110 & 1.762 & - & - & - & - & - & - & - \tabularnewline
111 & 2.846 & - & - & - & - & - & - & - \tabularnewline
112 & 5.627 & - & - & - & - & - & - & - \tabularnewline
113 & 5.749 & - & - & - & - & - & - & - \tabularnewline
114 & 4.502 & - & - & - & - & - & - & - \tabularnewline
115 & 5.72 & - & - & - & - & - & - & - \tabularnewline
116 & 4.403 & - & - & - & - & - & - & - \tabularnewline
117 & 2.867 & - & - & - & - & - & - & - \tabularnewline
118 & 2.635 & - & - & - & - & - & - & - \tabularnewline
119 & 2.059 & - & - & - & - & - & - & - \tabularnewline
120 & 1.511 & - & - & - & - & - & - & - \tabularnewline
121 & 2.359 & 2.3856 & 2.0302 & 2.8263 & 0.4529 & 0.9999 & 0.4235 & 0.9999 \tabularnewline
122 & 1.741 & 1.8314 & 1.5773 & 2.1413 & 0.2838 & 4e-04 & 0.6696 & 0.9786 \tabularnewline
123 & 2.917 & 3.0373 & 2.5543 & 3.6459 & 0.3493 & 1 & 0.731 & 1 \tabularnewline
124 & 6.249 & 5.6894 & 4.6212 & 7.1021 & 0.2188 & 0.9999 & 0.5345 & 1 \tabularnewline
125 & 5.76 & 5.7456 & 4.6641 & 7.1771 & 0.4921 & 0.2453 & 0.4981 & 1 \tabularnewline
126 & 6.25 & 5.0387 & 4.1223 & 6.2385 & 0.0239 & 0.1193 & 0.8097 & 1 \tabularnewline
127 & 5.134 & 5.4657 & 4.4502 & 6.8042 & 0.3136 & 0.1254 & 0.3548 & 1 \tabularnewline
128 & 4.831 & 4.6338 & 3.8095 & 5.7059 & 0.3592 & 0.1802 & 0.6635 & 1 \tabularnewline
129 & 3.695 & 3.1529 & 2.6466 & 3.7928 & 0.0484 & 0 & 0.8094 & 1 \tabularnewline
130 & 2.462 & 2.5412 & 2.156 & 3.0208 & 0.3731 & 0 & 0.3508 & 1 \tabularnewline
131 & 2.146 & 2.0771 & 1.779 & 2.4436 & 0.3563 & 0.0198 & 0.5386 & 0.9988 \tabularnewline
132 & 1.579 & 1.5559 & 1.3494 & 1.8053 & 0.4279 & 0 & 0.6378 & 0.6378 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302155&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[120])[/C][/ROW]
[ROW][C]108[/C][C]1.169[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]109[/C][C]2.429[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]110[/C][C]1.762[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]111[/C][C]2.846[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]112[/C][C]5.627[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]113[/C][C]5.749[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]114[/C][C]4.502[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]115[/C][C]5.72[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]116[/C][C]4.403[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]117[/C][C]2.867[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]118[/C][C]2.635[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]119[/C][C]2.059[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]120[/C][C]1.511[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]121[/C][C]2.359[/C][C]2.3856[/C][C]2.0302[/C][C]2.8263[/C][C]0.4529[/C][C]0.9999[/C][C]0.4235[/C][C]0.9999[/C][/ROW]
[ROW][C]122[/C][C]1.741[/C][C]1.8314[/C][C]1.5773[/C][C]2.1413[/C][C]0.2838[/C][C]4e-04[/C][C]0.6696[/C][C]0.9786[/C][/ROW]
[ROW][C]123[/C][C]2.917[/C][C]3.0373[/C][C]2.5543[/C][C]3.6459[/C][C]0.3493[/C][C]1[/C][C]0.731[/C][C]1[/C][/ROW]
[ROW][C]124[/C][C]6.249[/C][C]5.6894[/C][C]4.6212[/C][C]7.1021[/C][C]0.2188[/C][C]0.9999[/C][C]0.5345[/C][C]1[/C][/ROW]
[ROW][C]125[/C][C]5.76[/C][C]5.7456[/C][C]4.6641[/C][C]7.1771[/C][C]0.4921[/C][C]0.2453[/C][C]0.4981[/C][C]1[/C][/ROW]
[ROW][C]126[/C][C]6.25[/C][C]5.0387[/C][C]4.1223[/C][C]6.2385[/C][C]0.0239[/C][C]0.1193[/C][C]0.8097[/C][C]1[/C][/ROW]
[ROW][C]127[/C][C]5.134[/C][C]5.4657[/C][C]4.4502[/C][C]6.8042[/C][C]0.3136[/C][C]0.1254[/C][C]0.3548[/C][C]1[/C][/ROW]
[ROW][C]128[/C][C]4.831[/C][C]4.6338[/C][C]3.8095[/C][C]5.7059[/C][C]0.3592[/C][C]0.1802[/C][C]0.6635[/C][C]1[/C][/ROW]
[ROW][C]129[/C][C]3.695[/C][C]3.1529[/C][C]2.6466[/C][C]3.7928[/C][C]0.0484[/C][C]0[/C][C]0.8094[/C][C]1[/C][/ROW]
[ROW][C]130[/C][C]2.462[/C][C]2.5412[/C][C]2.156[/C][C]3.0208[/C][C]0.3731[/C][C]0[/C][C]0.3508[/C][C]1[/C][/ROW]
[ROW][C]131[/C][C]2.146[/C][C]2.0771[/C][C]1.779[/C][C]2.4436[/C][C]0.3563[/C][C]0.0198[/C][C]0.5386[/C][C]0.9988[/C][/ROW]
[ROW][C]132[/C][C]1.579[/C][C]1.5559[/C][C]1.3494[/C][C]1.8053[/C][C]0.4279[/C][C]0[/C][C]0.6378[/C][C]0.6378[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302155&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302155&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[120])
1081.169-------
1092.429-------
1101.762-------
1112.846-------
1125.627-------
1135.749-------
1144.502-------
1155.72-------
1164.403-------
1172.867-------
1182.635-------
1192.059-------
1201.511-------
1212.3592.38562.03022.82630.45290.99990.42350.9999
1221.7411.83141.57732.14130.28384e-040.66960.9786
1232.9173.03732.55433.64590.349310.7311
1246.2495.68944.62127.10210.21880.99990.53451
1255.765.74564.66417.17710.49210.24530.49811
1266.255.03874.12236.23850.02390.11930.80971
1275.1345.46574.45026.80420.31360.12540.35481
1284.8314.63383.80955.70590.35920.18020.66351
1293.6953.15292.64663.79280.048400.80941
1302.4622.54122.1563.02080.373100.35081
1312.1462.07711.7792.44360.35630.01980.53860.9988
1321.5791.55591.34941.80530.427900.63780.6378







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
1210.0942-0.01130.01130.01127e-0400-0.02720.0272
1220.0863-0.05190.03160.03090.00820.00440.0666-0.09220.0597
1230.1022-0.04120.03480.03410.01450.00780.0882-0.12280.0807
1240.12670.08960.04850.0490.31320.08410.290.57120.2034
1250.12710.00250.03930.03972e-040.06730.25950.01470.1656
1260.12150.19380.0650.06881.46730.30070.54831.23650.3441
1270.1249-0.06460.0650.0680.110.27340.5229-0.33860.3433
1280.1180.04080.0620.06470.03890.24410.49410.20130.3256
1290.10350.14670.07140.07510.29380.24960.49960.55330.3509
1300.0963-0.03220.06750.07070.00630.22530.4747-0.08090.3239
1310.090.03210.06420.06730.00470.20520.4530.07030.3008
1320.08180.01460.06010.06295e-040.18820.43380.02360.2777

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
121 & 0.0942 & -0.0113 & 0.0113 & 0.0112 & 7e-04 & 0 & 0 & -0.0272 & 0.0272 \tabularnewline
122 & 0.0863 & -0.0519 & 0.0316 & 0.0309 & 0.0082 & 0.0044 & 0.0666 & -0.0922 & 0.0597 \tabularnewline
123 & 0.1022 & -0.0412 & 0.0348 & 0.0341 & 0.0145 & 0.0078 & 0.0882 & -0.1228 & 0.0807 \tabularnewline
124 & 0.1267 & 0.0896 & 0.0485 & 0.049 & 0.3132 & 0.0841 & 0.29 & 0.5712 & 0.2034 \tabularnewline
125 & 0.1271 & 0.0025 & 0.0393 & 0.0397 & 2e-04 & 0.0673 & 0.2595 & 0.0147 & 0.1656 \tabularnewline
126 & 0.1215 & 0.1938 & 0.065 & 0.0688 & 1.4673 & 0.3007 & 0.5483 & 1.2365 & 0.3441 \tabularnewline
127 & 0.1249 & -0.0646 & 0.065 & 0.068 & 0.11 & 0.2734 & 0.5229 & -0.3386 & 0.3433 \tabularnewline
128 & 0.118 & 0.0408 & 0.062 & 0.0647 & 0.0389 & 0.2441 & 0.4941 & 0.2013 & 0.3256 \tabularnewline
129 & 0.1035 & 0.1467 & 0.0714 & 0.0751 & 0.2938 & 0.2496 & 0.4996 & 0.5533 & 0.3509 \tabularnewline
130 & 0.0963 & -0.0322 & 0.0675 & 0.0707 & 0.0063 & 0.2253 & 0.4747 & -0.0809 & 0.3239 \tabularnewline
131 & 0.09 & 0.0321 & 0.0642 & 0.0673 & 0.0047 & 0.2052 & 0.453 & 0.0703 & 0.3008 \tabularnewline
132 & 0.0818 & 0.0146 & 0.0601 & 0.0629 & 5e-04 & 0.1882 & 0.4338 & 0.0236 & 0.2777 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302155&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]121[/C][C]0.0942[/C][C]-0.0113[/C][C]0.0113[/C][C]0.0112[/C][C]7e-04[/C][C]0[/C][C]0[/C][C]-0.0272[/C][C]0.0272[/C][/ROW]
[ROW][C]122[/C][C]0.0863[/C][C]-0.0519[/C][C]0.0316[/C][C]0.0309[/C][C]0.0082[/C][C]0.0044[/C][C]0.0666[/C][C]-0.0922[/C][C]0.0597[/C][/ROW]
[ROW][C]123[/C][C]0.1022[/C][C]-0.0412[/C][C]0.0348[/C][C]0.0341[/C][C]0.0145[/C][C]0.0078[/C][C]0.0882[/C][C]-0.1228[/C][C]0.0807[/C][/ROW]
[ROW][C]124[/C][C]0.1267[/C][C]0.0896[/C][C]0.0485[/C][C]0.049[/C][C]0.3132[/C][C]0.0841[/C][C]0.29[/C][C]0.5712[/C][C]0.2034[/C][/ROW]
[ROW][C]125[/C][C]0.1271[/C][C]0.0025[/C][C]0.0393[/C][C]0.0397[/C][C]2e-04[/C][C]0.0673[/C][C]0.2595[/C][C]0.0147[/C][C]0.1656[/C][/ROW]
[ROW][C]126[/C][C]0.1215[/C][C]0.1938[/C][C]0.065[/C][C]0.0688[/C][C]1.4673[/C][C]0.3007[/C][C]0.5483[/C][C]1.2365[/C][C]0.3441[/C][/ROW]
[ROW][C]127[/C][C]0.1249[/C][C]-0.0646[/C][C]0.065[/C][C]0.068[/C][C]0.11[/C][C]0.2734[/C][C]0.5229[/C][C]-0.3386[/C][C]0.3433[/C][/ROW]
[ROW][C]128[/C][C]0.118[/C][C]0.0408[/C][C]0.062[/C][C]0.0647[/C][C]0.0389[/C][C]0.2441[/C][C]0.4941[/C][C]0.2013[/C][C]0.3256[/C][/ROW]
[ROW][C]129[/C][C]0.1035[/C][C]0.1467[/C][C]0.0714[/C][C]0.0751[/C][C]0.2938[/C][C]0.2496[/C][C]0.4996[/C][C]0.5533[/C][C]0.3509[/C][/ROW]
[ROW][C]130[/C][C]0.0963[/C][C]-0.0322[/C][C]0.0675[/C][C]0.0707[/C][C]0.0063[/C][C]0.2253[/C][C]0.4747[/C][C]-0.0809[/C][C]0.3239[/C][/ROW]
[ROW][C]131[/C][C]0.09[/C][C]0.0321[/C][C]0.0642[/C][C]0.0673[/C][C]0.0047[/C][C]0.2052[/C][C]0.453[/C][C]0.0703[/C][C]0.3008[/C][/ROW]
[ROW][C]132[/C][C]0.0818[/C][C]0.0146[/C][C]0.0601[/C][C]0.0629[/C][C]5e-04[/C][C]0.1882[/C][C]0.4338[/C][C]0.0236[/C][C]0.2777[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302155&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302155&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
1210.0942-0.01130.01130.01127e-0400-0.02720.0272
1220.0863-0.05190.03160.03090.00820.00440.0666-0.09220.0597
1230.1022-0.04120.03480.03410.01450.00780.0882-0.12280.0807
1240.12670.08960.04850.0490.31320.08410.290.57120.2034
1250.12710.00250.03930.03972e-040.06730.25950.01470.1656
1260.12150.19380.0650.06881.46730.30070.54831.23650.3441
1270.1249-0.06460.0650.0680.110.27340.5229-0.33860.3433
1280.1180.04080.0620.06470.03890.24410.49410.20130.3256
1290.10350.14670.07140.07510.29380.24960.49960.55330.3509
1300.0963-0.03220.06750.07070.00630.22530.4747-0.08090.3239
1310.090.03210.06420.06730.00470.20520.4530.07030.3008
1320.08180.01460.06010.06295e-040.18820.43380.02360.2777



Parameters (Session):
par1 = 12 ; par2 = -0.3 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 0 ; par7 = 1 ; par8 = 2 ; par9 = 1 ; par10 = FALSE ;
Parameters (R input):
par1 = 12 ; par2 = -0.3 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 0 ; par7 = 1 ; par8 = 2 ; par9 = 1 ; par10 = FALSE ;
R code (references can be found in the software module):
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')