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 computationFri, 09 Dec 2016 10:08:42 +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/09/t14812747540t2p1rsm4z1xo3f.htm/, Retrieved Sat, 18 May 2024 06:19:57 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=298456, Retrieved Sat, 18 May 2024 06:19:57 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact138
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [Paper N2163] [2016-12-09 09:08:42] [1e2703d0f11438bcd65480dae45a3781] [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=298456&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=298456&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=298456&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-------
10452405119.344636.03665653.02740.32880.45520.11580.4552
10548754904.44854404.85055460.7110.45870.11850.51330.1935
10651705223.83354645.29125874.42980.43560.85330.55850.588
10747154560.85083967.60595242.7990.32890.040.51820.0452
10843704490.70413874.80065204.5060.37020.2690.77140.0351
10951604822.92484117.39925649.34390.2120.85860.70560.219
11049304667.88583936.25925535.49870.27690.13310.75660.138
11156005367.2984489.42336416.83470.33190.79290.87550.6576
11253855175.44644288.36916246.02140.35060.21850.63630.5186
11354255388.38764424.00916562.98850.47560.50230.66070.6546
11453755324.02514337.30836535.21530.46710.43510.70280.6109
11553655057.34664086.29986259.14780.30790.30220.43990.4399

\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 & 5119.34 & 4636.0366 & 5653.0274 & 0.3288 & 0.4552 & 0.1158 & 0.4552 \tabularnewline
105 & 4875 & 4904.4485 & 4404.8505 & 5460.711 & 0.4587 & 0.1185 & 0.5133 & 0.1935 \tabularnewline
106 & 5170 & 5223.8335 & 4645.2912 & 5874.4298 & 0.4356 & 0.8533 & 0.5585 & 0.588 \tabularnewline
107 & 4715 & 4560.8508 & 3967.6059 & 5242.799 & 0.3289 & 0.04 & 0.5182 & 0.0452 \tabularnewline
108 & 4370 & 4490.7041 & 3874.8006 & 5204.506 & 0.3702 & 0.269 & 0.7714 & 0.0351 \tabularnewline
109 & 5160 & 4822.9248 & 4117.3992 & 5649.3439 & 0.212 & 0.8586 & 0.7056 & 0.219 \tabularnewline
110 & 4930 & 4667.8858 & 3936.2592 & 5535.4987 & 0.2769 & 0.1331 & 0.7566 & 0.138 \tabularnewline
111 & 5600 & 5367.298 & 4489.4233 & 6416.8347 & 0.3319 & 0.7929 & 0.8755 & 0.6576 \tabularnewline
112 & 5385 & 5175.4464 & 4288.3691 & 6246.0214 & 0.3506 & 0.2185 & 0.6363 & 0.5186 \tabularnewline
113 & 5425 & 5388.3876 & 4424.0091 & 6562.9885 & 0.4756 & 0.5023 & 0.6607 & 0.6546 \tabularnewline
114 & 5375 & 5324.0251 & 4337.3083 & 6535.2153 & 0.4671 & 0.4351 & 0.7028 & 0.6109 \tabularnewline
115 & 5365 & 5057.3466 & 4086.2998 & 6259.1478 & 0.3079 & 0.3022 & 0.4399 & 0.4399 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=298456&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]5119.34[/C][C]4636.0366[/C][C]5653.0274[/C][C]0.3288[/C][C]0.4552[/C][C]0.1158[/C][C]0.4552[/C][/ROW]
[ROW][C]105[/C][C]4875[/C][C]4904.4485[/C][C]4404.8505[/C][C]5460.711[/C][C]0.4587[/C][C]0.1185[/C][C]0.5133[/C][C]0.1935[/C][/ROW]
[ROW][C]106[/C][C]5170[/C][C]5223.8335[/C][C]4645.2912[/C][C]5874.4298[/C][C]0.4356[/C][C]0.8533[/C][C]0.5585[/C][C]0.588[/C][/ROW]
[ROW][C]107[/C][C]4715[/C][C]4560.8508[/C][C]3967.6059[/C][C]5242.799[/C][C]0.3289[/C][C]0.04[/C][C]0.5182[/C][C]0.0452[/C][/ROW]
[ROW][C]108[/C][C]4370[/C][C]4490.7041[/C][C]3874.8006[/C][C]5204.506[/C][C]0.3702[/C][C]0.269[/C][C]0.7714[/C][C]0.0351[/C][/ROW]
[ROW][C]109[/C][C]5160[/C][C]4822.9248[/C][C]4117.3992[/C][C]5649.3439[/C][C]0.212[/C][C]0.8586[/C][C]0.7056[/C][C]0.219[/C][/ROW]
[ROW][C]110[/C][C]4930[/C][C]4667.8858[/C][C]3936.2592[/C][C]5535.4987[/C][C]0.2769[/C][C]0.1331[/C][C]0.7566[/C][C]0.138[/C][/ROW]
[ROW][C]111[/C][C]5600[/C][C]5367.298[/C][C]4489.4233[/C][C]6416.8347[/C][C]0.3319[/C][C]0.7929[/C][C]0.8755[/C][C]0.6576[/C][/ROW]
[ROW][C]112[/C][C]5385[/C][C]5175.4464[/C][C]4288.3691[/C][C]6246.0214[/C][C]0.3506[/C][C]0.2185[/C][C]0.6363[/C][C]0.5186[/C][/ROW]
[ROW][C]113[/C][C]5425[/C][C]5388.3876[/C][C]4424.0091[/C][C]6562.9885[/C][C]0.4756[/C][C]0.5023[/C][C]0.6607[/C][C]0.6546[/C][/ROW]
[ROW][C]114[/C][C]5375[/C][C]5324.0251[/C][C]4337.3083[/C][C]6535.2153[/C][C]0.4671[/C][C]0.4351[/C][C]0.7028[/C][C]0.6109[/C][/ROW]
[ROW][C]115[/C][C]5365[/C][C]5057.3466[/C][C]4086.2998[/C][C]6259.1478[/C][C]0.3079[/C][C]0.3022[/C][C]0.4399[/C][C]0.4399[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=298456&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=298456&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-------
10452405119.344636.03665653.02740.32880.45520.11580.4552
10548754904.44854404.85055460.7110.45870.11850.51330.1935
10651705223.83354645.29125874.42980.43560.85330.55850.588
10747154560.85083967.60595242.7990.32890.040.51820.0452
10843704490.70413874.80065204.5060.37020.2690.77140.0351
10951604822.92484117.39925649.34390.2120.85860.70560.219
11049304667.88583936.25925535.49870.27690.13310.75660.138
11156005367.2984489.42336416.83470.33190.79290.87550.6576
11253855175.44644288.36916246.02140.35060.21850.63630.5186
11354255388.38764424.00916562.98850.47560.50230.66070.6546
11453755324.02514337.30836535.21530.46710.43510.70280.6109
11553655057.34664086.29986259.14780.30790.30220.43990.4399







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
1040.05320.0230.0230.023314558.839000.3830.383
1050.0579-0.0060.01450.0147867.21567713.027387.8238-0.09350.2383
1060.0635-0.01040.01320.01322898.04826108.034378.1539-0.17090.2158
1070.07630.03270.0180.018223761.966710521.5174102.57440.48940.2842
1080.0811-0.02760.020.0214569.478511331.1096106.4477-0.38320.304
1090.08740.06530.02750.0279113619.679628379.2046168.46131.07010.4317
1100.09480.05320.03120.031868703.859634139.8696184.76980.83210.4889
1110.09980.04160.03250.033154150.236636641.1655191.41880.73870.5201
1120.10550.03890.03320.033843912.716737449.1156193.51770.66520.5362
1130.11120.00670.03060.03111340.465433838.2506183.95180.11620.4942
1140.11610.00950.02860.02922598.437430998.2676176.06320.16180.464
1150.12120.05730.0310.031694650.621836302.6304190.53250.97670.5067

\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.0532 & 0.023 & 0.023 & 0.0233 & 14558.839 & 0 & 0 & 0.383 & 0.383 \tabularnewline
105 & 0.0579 & -0.006 & 0.0145 & 0.0147 & 867.2156 & 7713.0273 & 87.8238 & -0.0935 & 0.2383 \tabularnewline
106 & 0.0635 & -0.0104 & 0.0132 & 0.0132 & 2898.0482 & 6108.0343 & 78.1539 & -0.1709 & 0.2158 \tabularnewline
107 & 0.0763 & 0.0327 & 0.018 & 0.0182 & 23761.9667 & 10521.5174 & 102.5744 & 0.4894 & 0.2842 \tabularnewline
108 & 0.0811 & -0.0276 & 0.02 & 0.02 & 14569.4785 & 11331.1096 & 106.4477 & -0.3832 & 0.304 \tabularnewline
109 & 0.0874 & 0.0653 & 0.0275 & 0.0279 & 113619.6796 & 28379.2046 & 168.4613 & 1.0701 & 0.4317 \tabularnewline
110 & 0.0948 & 0.0532 & 0.0312 & 0.0318 & 68703.8596 & 34139.8696 & 184.7698 & 0.8321 & 0.4889 \tabularnewline
111 & 0.0998 & 0.0416 & 0.0325 & 0.0331 & 54150.2366 & 36641.1655 & 191.4188 & 0.7387 & 0.5201 \tabularnewline
112 & 0.1055 & 0.0389 & 0.0332 & 0.0338 & 43912.7167 & 37449.1156 & 193.5177 & 0.6652 & 0.5362 \tabularnewline
113 & 0.1112 & 0.0067 & 0.0306 & 0.0311 & 1340.4654 & 33838.2506 & 183.9518 & 0.1162 & 0.4942 \tabularnewline
114 & 0.1161 & 0.0095 & 0.0286 & 0.0292 & 2598.4374 & 30998.2676 & 176.0632 & 0.1618 & 0.464 \tabularnewline
115 & 0.1212 & 0.0573 & 0.031 & 0.0316 & 94650.6218 & 36302.6304 & 190.5325 & 0.9767 & 0.5067 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=298456&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.0532[/C][C]0.023[/C][C]0.023[/C][C]0.0233[/C][C]14558.839[/C][C]0[/C][C]0[/C][C]0.383[/C][C]0.383[/C][/ROW]
[ROW][C]105[/C][C]0.0579[/C][C]-0.006[/C][C]0.0145[/C][C]0.0147[/C][C]867.2156[/C][C]7713.0273[/C][C]87.8238[/C][C]-0.0935[/C][C]0.2383[/C][/ROW]
[ROW][C]106[/C][C]0.0635[/C][C]-0.0104[/C][C]0.0132[/C][C]0.0132[/C][C]2898.0482[/C][C]6108.0343[/C][C]78.1539[/C][C]-0.1709[/C][C]0.2158[/C][/ROW]
[ROW][C]107[/C][C]0.0763[/C][C]0.0327[/C][C]0.018[/C][C]0.0182[/C][C]23761.9667[/C][C]10521.5174[/C][C]102.5744[/C][C]0.4894[/C][C]0.2842[/C][/ROW]
[ROW][C]108[/C][C]0.0811[/C][C]-0.0276[/C][C]0.02[/C][C]0.02[/C][C]14569.4785[/C][C]11331.1096[/C][C]106.4477[/C][C]-0.3832[/C][C]0.304[/C][/ROW]
[ROW][C]109[/C][C]0.0874[/C][C]0.0653[/C][C]0.0275[/C][C]0.0279[/C][C]113619.6796[/C][C]28379.2046[/C][C]168.4613[/C][C]1.0701[/C][C]0.4317[/C][/ROW]
[ROW][C]110[/C][C]0.0948[/C][C]0.0532[/C][C]0.0312[/C][C]0.0318[/C][C]68703.8596[/C][C]34139.8696[/C][C]184.7698[/C][C]0.8321[/C][C]0.4889[/C][/ROW]
[ROW][C]111[/C][C]0.0998[/C][C]0.0416[/C][C]0.0325[/C][C]0.0331[/C][C]54150.2366[/C][C]36641.1655[/C][C]191.4188[/C][C]0.7387[/C][C]0.5201[/C][/ROW]
[ROW][C]112[/C][C]0.1055[/C][C]0.0389[/C][C]0.0332[/C][C]0.0338[/C][C]43912.7167[/C][C]37449.1156[/C][C]193.5177[/C][C]0.6652[/C][C]0.5362[/C][/ROW]
[ROW][C]113[/C][C]0.1112[/C][C]0.0067[/C][C]0.0306[/C][C]0.0311[/C][C]1340.4654[/C][C]33838.2506[/C][C]183.9518[/C][C]0.1162[/C][C]0.4942[/C][/ROW]
[ROW][C]114[/C][C]0.1161[/C][C]0.0095[/C][C]0.0286[/C][C]0.0292[/C][C]2598.4374[/C][C]30998.2676[/C][C]176.0632[/C][C]0.1618[/C][C]0.464[/C][/ROW]
[ROW][C]115[/C][C]0.1212[/C][C]0.0573[/C][C]0.031[/C][C]0.0316[/C][C]94650.6218[/C][C]36302.6304[/C][C]190.5325[/C][C]0.9767[/C][C]0.5067[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=298456&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=298456&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.05320.0230.0230.023314558.839000.3830.383
1050.0579-0.0060.01450.0147867.21567713.027387.8238-0.09350.2383
1060.0635-0.01040.01320.01322898.04826108.034378.1539-0.17090.2158
1070.07630.03270.0180.018223761.966710521.5174102.57440.48940.2842
1080.0811-0.02760.020.0214569.478511331.1096106.4477-0.38320.304
1090.08740.06530.02750.0279113619.679628379.2046168.46131.07010.4317
1100.09480.05320.03120.031868703.859634139.8696184.76980.83210.4889
1110.09980.04160.03250.033154150.236636641.1655191.41880.73870.5201
1120.10550.03890.03320.033843912.716737449.1156193.51770.66520.5362
1130.11120.00670.03060.03111340.465433838.2506183.95180.11620.4942
1140.11610.00950.02860.02922598.437430998.2676176.06320.16180.464
1150.12120.05730.0310.031694650.621836302.6304190.53250.97670.5067



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