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 21:41:24 +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/t1482353712r26rnn182dt2itn.htm/, Retrieved Mon, 06 May 2024 21:48:21 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=302503, Retrieved Mon, 06 May 2024 21:48:21 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact59
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [Paper N2163] [2016-12-21 20:41:24] [3146b6c9a81fba6ba78c11f749c05198] [Current]
Feedback Forum

Post a new message
Dataseries X:
3875
3755
4670
4335
4945
4600
4395
4345
4390
4490
4395
4690
4590
4630
5375
4655
4975
4810
4445
4660
4215
4825
4250
3945
4390
4315
4835
4835
4970
4690
4700
4855
4610
4900
4250
4105
4740
4565
5155
5320
5430
4690
4540
4575
4660
4850
4200
4360
4655
4585
5315
5115
5100
5735
5260
5050
5165
5190
4720
5275
4605
4825
5595
5160
5320
5540
4970
5445
5305
5145
4895
4555
4980
4930
5810
5210
5450
5510
5010
5495
5125
5190
4565
4255
4875
4650
5295
5045
5430
5325
4920
5445
4895
5175
4545
4220
4595
4360
4750
4985
5140
4995
5150
5240
4875
5170
4715
4370
5160
4930
5600
5385
5425
5375
5365




Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time1 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 time1 seconds \tabularnewline
R ServerBig Analytics Cloud Computing Center \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302503&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]1 seconds[/C][/ROW] [ROW]R Server[/C]Big Analytics Cloud Computing Center[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=302503&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302503&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 time1 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[103])
914920-------
925445-------
934895-------
945175-------
954545-------
964220-------
974595-------
984360-------
994750-------
1004985-------
1015140-------
1024995-------
1035150-------
10452405566.6594971.886161.43790.14090.91510.65580.9151
10548754977.37924332.59115622.16730.37780.21230.59890.2999
10651705172.92974528.14165817.71780.49640.81740.49750.5278
10747154574.5983929.80995219.38610.33480.03520.53580.0401
10843704276.18033631.39224920.96840.38770.09110.56780.004
10951604684.28964039.50155329.07770.07410.83030.6070.0784
11049304476.55133831.76325121.33940.0840.01890.63840.0203
11156004968.95674324.16865613.74480.02750.54710.74720.291
11253855019.54554374.75745664.33360.13330.03880.54180.3458
11354255229.70994584.92185874.49790.27640.31840.60750.5957
11453755120.53544475.74735765.32350.21960.17740.64860.4643
11553655084.3914439.60295729.17910.19680.18850.4210.421

\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[103]) \tabularnewline
91 & 4920 & - & - & - & - & - & - & - \tabularnewline
92 & 5445 & - & - & - & - & - & - & - \tabularnewline
93 & 4895 & - & - & - & - & - & - & - \tabularnewline
94 & 5175 & - & - & - & - & - & - & - \tabularnewline
95 & 4545 & - & - & - & - & - & - & - \tabularnewline
96 & 4220 & - & - & - & - & - & - & - \tabularnewline
97 & 4595 & - & - & - & - & - & - & - \tabularnewline
98 & 4360 & - & - & - & - & - & - & - \tabularnewline
99 & 4750 & - & - & - & - & - & - & - \tabularnewline
100 & 4985 & - & - & - & - & - & - & - \tabularnewline
101 & 5140 & - & - & - & - & - & - & - \tabularnewline
102 & 4995 & - & - & - & - & - & - & - \tabularnewline
103 & 5150 & - & - & - & - & - & - & - \tabularnewline
104 & 5240 & 5566.659 & 4971.88 & 6161.4379 & 0.1409 & 0.9151 & 0.6558 & 0.9151 \tabularnewline
105 & 4875 & 4977.3792 & 4332.5911 & 5622.1673 & 0.3778 & 0.2123 & 0.5989 & 0.2999 \tabularnewline
106 & 5170 & 5172.9297 & 4528.1416 & 5817.7178 & 0.4964 & 0.8174 & 0.4975 & 0.5278 \tabularnewline
107 & 4715 & 4574.598 & 3929.8099 & 5219.3861 & 0.3348 & 0.0352 & 0.5358 & 0.0401 \tabularnewline
108 & 4370 & 4276.1803 & 3631.3922 & 4920.9684 & 0.3877 & 0.0911 & 0.5678 & 0.004 \tabularnewline
109 & 5160 & 4684.2896 & 4039.5015 & 5329.0777 & 0.0741 & 0.8303 & 0.607 & 0.0784 \tabularnewline
110 & 4930 & 4476.5513 & 3831.7632 & 5121.3394 & 0.084 & 0.0189 & 0.6384 & 0.0203 \tabularnewline
111 & 5600 & 4968.9567 & 4324.1686 & 5613.7448 & 0.0275 & 0.5471 & 0.7472 & 0.291 \tabularnewline
112 & 5385 & 5019.5455 & 4374.7574 & 5664.3336 & 0.1333 & 0.0388 & 0.5418 & 0.3458 \tabularnewline
113 & 5425 & 5229.7099 & 4584.9218 & 5874.4979 & 0.2764 & 0.3184 & 0.6075 & 0.5957 \tabularnewline
114 & 5375 & 5120.5354 & 4475.7473 & 5765.3235 & 0.2196 & 0.1774 & 0.6486 & 0.4643 \tabularnewline
115 & 5365 & 5084.391 & 4439.6029 & 5729.1791 & 0.1968 & 0.1885 & 0.421 & 0.421 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302503&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[103])[/C][/ROW]
[ROW][C]91[/C][C]4920[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]92[/C][C]5445[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]93[/C][C]4895[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]94[/C][C]5175[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]95[/C][C]4545[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]96[/C][C]4220[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]97[/C][C]4595[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]98[/C][C]4360[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]99[/C][C]4750[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]100[/C][C]4985[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]101[/C][C]5140[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]102[/C][C]4995[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]103[/C][C]5150[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]104[/C][C]5240[/C][C]5566.659[/C][C]4971.88[/C][C]6161.4379[/C][C]0.1409[/C][C]0.9151[/C][C]0.6558[/C][C]0.9151[/C][/ROW]
[ROW][C]105[/C][C]4875[/C][C]4977.3792[/C][C]4332.5911[/C][C]5622.1673[/C][C]0.3778[/C][C]0.2123[/C][C]0.5989[/C][C]0.2999[/C][/ROW]
[ROW][C]106[/C][C]5170[/C][C]5172.9297[/C][C]4528.1416[/C][C]5817.7178[/C][C]0.4964[/C][C]0.8174[/C][C]0.4975[/C][C]0.5278[/C][/ROW]
[ROW][C]107[/C][C]4715[/C][C]4574.598[/C][C]3929.8099[/C][C]5219.3861[/C][C]0.3348[/C][C]0.0352[/C][C]0.5358[/C][C]0.0401[/C][/ROW]
[ROW][C]108[/C][C]4370[/C][C]4276.1803[/C][C]3631.3922[/C][C]4920.9684[/C][C]0.3877[/C][C]0.0911[/C][C]0.5678[/C][C]0.004[/C][/ROW]
[ROW][C]109[/C][C]5160[/C][C]4684.2896[/C][C]4039.5015[/C][C]5329.0777[/C][C]0.0741[/C][C]0.8303[/C][C]0.607[/C][C]0.0784[/C][/ROW]
[ROW][C]110[/C][C]4930[/C][C]4476.5513[/C][C]3831.7632[/C][C]5121.3394[/C][C]0.084[/C][C]0.0189[/C][C]0.6384[/C][C]0.0203[/C][/ROW]
[ROW][C]111[/C][C]5600[/C][C]4968.9567[/C][C]4324.1686[/C][C]5613.7448[/C][C]0.0275[/C][C]0.5471[/C][C]0.7472[/C][C]0.291[/C][/ROW]
[ROW][C]112[/C][C]5385[/C][C]5019.5455[/C][C]4374.7574[/C][C]5664.3336[/C][C]0.1333[/C][C]0.0388[/C][C]0.5418[/C][C]0.3458[/C][/ROW]
[ROW][C]113[/C][C]5425[/C][C]5229.7099[/C][C]4584.9218[/C][C]5874.4979[/C][C]0.2764[/C][C]0.3184[/C][C]0.6075[/C][C]0.5957[/C][/ROW]
[ROW][C]114[/C][C]5375[/C][C]5120.5354[/C][C]4475.7473[/C][C]5765.3235[/C][C]0.2196[/C][C]0.1774[/C][C]0.6486[/C][C]0.4643[/C][/ROW]
[ROW][C]115[/C][C]5365[/C][C]5084.391[/C][C]4439.6029[/C][C]5729.1791[/C][C]0.1968[/C][C]0.1885[/C][C]0.421[/C][C]0.421[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302503&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302503&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[103])
914920-------
925445-------
934895-------
945175-------
954545-------
964220-------
974595-------
984360-------
994750-------
1004985-------
1015140-------
1024995-------
1035150-------
10452405566.6594971.886161.43790.14090.91510.65580.9151
10548754977.37924332.59115622.16730.37780.21230.59890.2999
10651705172.92974528.14165817.71780.49640.81740.49750.5278
10747154574.5983929.80995219.38610.33480.03520.53580.0401
10843704276.18033631.39224920.96840.38770.09110.56780.004
10951604684.28964039.50155329.07770.07410.83030.6070.0784
11049304476.55133831.76325121.33940.0840.01890.63840.0203
11156004968.95674324.16865613.74480.02750.54710.74720.291
11253855019.54554374.75745664.33360.13330.03880.54180.3458
11354255229.70994584.92185874.49790.27640.31840.60750.5957
11453755120.53544475.74735765.32350.21960.17740.64860.4643
11553655084.3914439.60295729.17910.19680.18850.4210.421







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
1040.0545-0.06230.06230.0605106706.078600-1.0371.037
1050.0661-0.0210.04170.040610481.508958593.7938242.0615-0.3250.681
1060.0636-6e-040.0280.02738.58339065.3902197.6497-0.00930.4571
1070.07190.02980.02840.02819712.722434227.2232185.0060.44570.4543
1080.07690.02150.0270.02678802.138829142.2063170.71090.29780.423
1090.07020.09220.03790.0384226300.388862001.9034249.00181.51020.6042
1100.07350.0920.04560.0467205615.722582518.1633287.25971.43950.7235
1110.06620.11270.0540.0558398215.5916121980.3418349.25682.00330.8835
1120.06550.06790.05550.0574133556.969123266.6337351.09351.16020.9142
1130.06290.0360.05360.055338138.2419114753.7945338.75330.620.8848
1140.06420.04730.0530.054764752.2526110208.1998331.97620.80780.8778
1150.06470.05230.0530.054678741.3996107585.9665328.0030.89080.8789

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
104 & 0.0545 & -0.0623 & 0.0623 & 0.0605 & 106706.0786 & 0 & 0 & -1.037 & 1.037 \tabularnewline
105 & 0.0661 & -0.021 & 0.0417 & 0.0406 & 10481.5089 & 58593.7938 & 242.0615 & -0.325 & 0.681 \tabularnewline
106 & 0.0636 & -6e-04 & 0.028 & 0.0273 & 8.583 & 39065.3902 & 197.6497 & -0.0093 & 0.4571 \tabularnewline
107 & 0.0719 & 0.0298 & 0.0284 & 0.028 & 19712.7224 & 34227.2232 & 185.006 & 0.4457 & 0.4543 \tabularnewline
108 & 0.0769 & 0.0215 & 0.027 & 0.0267 & 8802.1388 & 29142.2063 & 170.7109 & 0.2978 & 0.423 \tabularnewline
109 & 0.0702 & 0.0922 & 0.0379 & 0.0384 & 226300.3888 & 62001.9034 & 249.0018 & 1.5102 & 0.6042 \tabularnewline
110 & 0.0735 & 0.092 & 0.0456 & 0.0467 & 205615.7225 & 82518.1633 & 287.2597 & 1.4395 & 0.7235 \tabularnewline
111 & 0.0662 & 0.1127 & 0.054 & 0.0558 & 398215.5916 & 121980.3418 & 349.2568 & 2.0033 & 0.8835 \tabularnewline
112 & 0.0655 & 0.0679 & 0.0555 & 0.0574 & 133556.969 & 123266.6337 & 351.0935 & 1.1602 & 0.9142 \tabularnewline
113 & 0.0629 & 0.036 & 0.0536 & 0.0553 & 38138.2419 & 114753.7945 & 338.7533 & 0.62 & 0.8848 \tabularnewline
114 & 0.0642 & 0.0473 & 0.053 & 0.0547 & 64752.2526 & 110208.1998 & 331.9762 & 0.8078 & 0.8778 \tabularnewline
115 & 0.0647 & 0.0523 & 0.053 & 0.0546 & 78741.3996 & 107585.9665 & 328.003 & 0.8908 & 0.8789 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302503&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]104[/C][C]0.0545[/C][C]-0.0623[/C][C]0.0623[/C][C]0.0605[/C][C]106706.0786[/C][C]0[/C][C]0[/C][C]-1.037[/C][C]1.037[/C][/ROW]
[ROW][C]105[/C][C]0.0661[/C][C]-0.021[/C][C]0.0417[/C][C]0.0406[/C][C]10481.5089[/C][C]58593.7938[/C][C]242.0615[/C][C]-0.325[/C][C]0.681[/C][/ROW]
[ROW][C]106[/C][C]0.0636[/C][C]-6e-04[/C][C]0.028[/C][C]0.0273[/C][C]8.583[/C][C]39065.3902[/C][C]197.6497[/C][C]-0.0093[/C][C]0.4571[/C][/ROW]
[ROW][C]107[/C][C]0.0719[/C][C]0.0298[/C][C]0.0284[/C][C]0.028[/C][C]19712.7224[/C][C]34227.2232[/C][C]185.006[/C][C]0.4457[/C][C]0.4543[/C][/ROW]
[ROW][C]108[/C][C]0.0769[/C][C]0.0215[/C][C]0.027[/C][C]0.0267[/C][C]8802.1388[/C][C]29142.2063[/C][C]170.7109[/C][C]0.2978[/C][C]0.423[/C][/ROW]
[ROW][C]109[/C][C]0.0702[/C][C]0.0922[/C][C]0.0379[/C][C]0.0384[/C][C]226300.3888[/C][C]62001.9034[/C][C]249.0018[/C][C]1.5102[/C][C]0.6042[/C][/ROW]
[ROW][C]110[/C][C]0.0735[/C][C]0.092[/C][C]0.0456[/C][C]0.0467[/C][C]205615.7225[/C][C]82518.1633[/C][C]287.2597[/C][C]1.4395[/C][C]0.7235[/C][/ROW]
[ROW][C]111[/C][C]0.0662[/C][C]0.1127[/C][C]0.054[/C][C]0.0558[/C][C]398215.5916[/C][C]121980.3418[/C][C]349.2568[/C][C]2.0033[/C][C]0.8835[/C][/ROW]
[ROW][C]112[/C][C]0.0655[/C][C]0.0679[/C][C]0.0555[/C][C]0.0574[/C][C]133556.969[/C][C]123266.6337[/C][C]351.0935[/C][C]1.1602[/C][C]0.9142[/C][/ROW]
[ROW][C]113[/C][C]0.0629[/C][C]0.036[/C][C]0.0536[/C][C]0.0553[/C][C]38138.2419[/C][C]114753.7945[/C][C]338.7533[/C][C]0.62[/C][C]0.8848[/C][/ROW]
[ROW][C]114[/C][C]0.0642[/C][C]0.0473[/C][C]0.053[/C][C]0.0547[/C][C]64752.2526[/C][C]110208.1998[/C][C]331.9762[/C][C]0.8078[/C][C]0.8778[/C][/ROW]
[ROW][C]115[/C][C]0.0647[/C][C]0.0523[/C][C]0.053[/C][C]0.0546[/C][C]78741.3996[/C][C]107585.9665[/C][C]328.003[/C][C]0.8908[/C][C]0.8789[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302503&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302503&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
1040.0545-0.06230.06230.0605106706.078600-1.0371.037
1050.0661-0.0210.04170.040610481.508958593.7938242.0615-0.3250.681
1060.0636-6e-040.0280.02738.58339065.3902197.6497-0.00930.4571
1070.07190.02980.02840.02819712.722434227.2232185.0060.44570.4543
1080.07690.02150.0270.02678802.138829142.2063170.71090.29780.423
1090.07020.09220.03790.0384226300.388862001.9034249.00181.51020.6042
1100.07350.0920.04560.0467205615.722582518.1633287.25971.43950.7235
1110.06620.11270.0540.0558398215.5916121980.3418349.25682.00330.8835
1120.06550.06790.05550.0574133556.969123266.6337351.09351.16020.9142
1130.06290.0360.05360.055338138.2419114753.7945338.75330.620.8848
1140.06420.04730.0530.054764752.2526110208.1998331.97620.80780.8778
1150.06470.05230.0530.054678741.3996107585.9665328.0030.89080.8789



Parameters (Session):
par1 = 12 ; par2 = 1 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 0 ; par7 = 1 ; par8 = 0 ; par9 = 1 ; par10 = FALSE ;
Parameters (R input):
par1 = 12 ; par2 = 1 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 0 ; par7 = 1 ; par8 = 0 ; 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')