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

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

Post a new message
Dataseries X:
3500
3400
3600
3650
3950
3850
3450
3650
3900
3900
4100
3900
3700
3600
3750
3800
4050
3950
3600
3650
3800
4050
4100
4000
3700
3650
3750
4050
4300
4150
3750
3900
4100
4300
4500
4400
4050
4050
4300
4450
4650
4600
4150
4350
4550
4700
5050
4900
4250
4400
4600
4650
4800
4750
4300
4350
4750
4900
5100
4950
4450
4600
4700
4850
4800
4900
4400
4550
4950
5050
5250
4950
4500
4600
4800
4950
5150
5250
4550
4800
5200
5350
5750
5200
4950
5150
5200
5300
5800
5500
5000
5100
5500
5800
6000
5600
5400
5350
5300
5550
5750
5800




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302505&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[90])
785250-------
794550-------
804800-------
815200-------
825350-------
835750-------
845200-------
854950-------
865150-------
875200-------
885300-------
895800-------
905500-------
9150004986.71554761.69145211.73960.453900.99990
9251005149.55884894.54445404.57320.35160.87480.99640.0035
9355005590.24265284.30335896.18190.28160.99920.99380.7184
9458005721.25195382.20536060.29840.32450.89960.98410.8996
9560006130.11655756.56226503.67080.24740.95840.97690.9995
9656005575.97865172.74935979.20790.45350.01960.96620.6441
9754005327.91014896.21915759.60120.37170.10830.95690.2173
9853505527.00855068.98385985.03320.22440.70660.94670.546
9953005577.42945094.34386060.5150.13020.82190.93720.6233
10055505677.23295170.39566184.07020.31140.92770.92770.7534
10157506177.32465647.76796706.88130.05690.98990.91870.9939
10258005877.28185325.95556428.60820.39180.67450.91010.9101

\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[90]) \tabularnewline
78 & 5250 & - & - & - & - & - & - & - \tabularnewline
79 & 4550 & - & - & - & - & - & - & - \tabularnewline
80 & 4800 & - & - & - & - & - & - & - \tabularnewline
81 & 5200 & - & - & - & - & - & - & - \tabularnewline
82 & 5350 & - & - & - & - & - & - & - \tabularnewline
83 & 5750 & - & - & - & - & - & - & - \tabularnewline
84 & 5200 & - & - & - & - & - & - & - \tabularnewline
85 & 4950 & - & - & - & - & - & - & - \tabularnewline
86 & 5150 & - & - & - & - & - & - & - \tabularnewline
87 & 5200 & - & - & - & - & - & - & - \tabularnewline
88 & 5300 & - & - & - & - & - & - & - \tabularnewline
89 & 5800 & - & - & - & - & - & - & - \tabularnewline
90 & 5500 & - & - & - & - & - & - & - \tabularnewline
91 & 5000 & 4986.7155 & 4761.6914 & 5211.7396 & 0.4539 & 0 & 0.9999 & 0 \tabularnewline
92 & 5100 & 5149.5588 & 4894.5444 & 5404.5732 & 0.3516 & 0.8748 & 0.9964 & 0.0035 \tabularnewline
93 & 5500 & 5590.2426 & 5284.3033 & 5896.1819 & 0.2816 & 0.9992 & 0.9938 & 0.7184 \tabularnewline
94 & 5800 & 5721.2519 & 5382.2053 & 6060.2984 & 0.3245 & 0.8996 & 0.9841 & 0.8996 \tabularnewline
95 & 6000 & 6130.1165 & 5756.5622 & 6503.6708 & 0.2474 & 0.9584 & 0.9769 & 0.9995 \tabularnewline
96 & 5600 & 5575.9786 & 5172.7493 & 5979.2079 & 0.4535 & 0.0196 & 0.9662 & 0.6441 \tabularnewline
97 & 5400 & 5327.9101 & 4896.2191 & 5759.6012 & 0.3717 & 0.1083 & 0.9569 & 0.2173 \tabularnewline
98 & 5350 & 5527.0085 & 5068.9838 & 5985.0332 & 0.2244 & 0.7066 & 0.9467 & 0.546 \tabularnewline
99 & 5300 & 5577.4294 & 5094.3438 & 6060.515 & 0.1302 & 0.8219 & 0.9372 & 0.6233 \tabularnewline
100 & 5550 & 5677.2329 & 5170.3956 & 6184.0702 & 0.3114 & 0.9277 & 0.9277 & 0.7534 \tabularnewline
101 & 5750 & 6177.3246 & 5647.7679 & 6706.8813 & 0.0569 & 0.9899 & 0.9187 & 0.9939 \tabularnewline
102 & 5800 & 5877.2818 & 5325.9555 & 6428.6082 & 0.3918 & 0.6745 & 0.9101 & 0.9101 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302505&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[90])[/C][/ROW]
[ROW][C]78[/C][C]5250[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]79[/C][C]4550[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]80[/C][C]4800[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]81[/C][C]5200[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]82[/C][C]5350[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]83[/C][C]5750[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]84[/C][C]5200[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]85[/C][C]4950[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]86[/C][C]5150[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]87[/C][C]5200[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]88[/C][C]5300[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]89[/C][C]5800[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]90[/C][C]5500[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]91[/C][C]5000[/C][C]4986.7155[/C][C]4761.6914[/C][C]5211.7396[/C][C]0.4539[/C][C]0[/C][C]0.9999[/C][C]0[/C][/ROW]
[ROW][C]92[/C][C]5100[/C][C]5149.5588[/C][C]4894.5444[/C][C]5404.5732[/C][C]0.3516[/C][C]0.8748[/C][C]0.9964[/C][C]0.0035[/C][/ROW]
[ROW][C]93[/C][C]5500[/C][C]5590.2426[/C][C]5284.3033[/C][C]5896.1819[/C][C]0.2816[/C][C]0.9992[/C][C]0.9938[/C][C]0.7184[/C][/ROW]
[ROW][C]94[/C][C]5800[/C][C]5721.2519[/C][C]5382.2053[/C][C]6060.2984[/C][C]0.3245[/C][C]0.8996[/C][C]0.9841[/C][C]0.8996[/C][/ROW]
[ROW][C]95[/C][C]6000[/C][C]6130.1165[/C][C]5756.5622[/C][C]6503.6708[/C][C]0.2474[/C][C]0.9584[/C][C]0.9769[/C][C]0.9995[/C][/ROW]
[ROW][C]96[/C][C]5600[/C][C]5575.9786[/C][C]5172.7493[/C][C]5979.2079[/C][C]0.4535[/C][C]0.0196[/C][C]0.9662[/C][C]0.6441[/C][/ROW]
[ROW][C]97[/C][C]5400[/C][C]5327.9101[/C][C]4896.2191[/C][C]5759.6012[/C][C]0.3717[/C][C]0.1083[/C][C]0.9569[/C][C]0.2173[/C][/ROW]
[ROW][C]98[/C][C]5350[/C][C]5527.0085[/C][C]5068.9838[/C][C]5985.0332[/C][C]0.2244[/C][C]0.7066[/C][C]0.9467[/C][C]0.546[/C][/ROW]
[ROW][C]99[/C][C]5300[/C][C]5577.4294[/C][C]5094.3438[/C][C]6060.515[/C][C]0.1302[/C][C]0.8219[/C][C]0.9372[/C][C]0.6233[/C][/ROW]
[ROW][C]100[/C][C]5550[/C][C]5677.2329[/C][C]5170.3956[/C][C]6184.0702[/C][C]0.3114[/C][C]0.9277[/C][C]0.9277[/C][C]0.7534[/C][/ROW]
[ROW][C]101[/C][C]5750[/C][C]6177.3246[/C][C]5647.7679[/C][C]6706.8813[/C][C]0.0569[/C][C]0.9899[/C][C]0.9187[/C][C]0.9939[/C][/ROW]
[ROW][C]102[/C][C]5800[/C][C]5877.2818[/C][C]5325.9555[/C][C]6428.6082[/C][C]0.3918[/C][C]0.6745[/C][C]0.9101[/C][C]0.9101[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302505&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302505&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[90])
785250-------
794550-------
804800-------
815200-------
825350-------
835750-------
845200-------
854950-------
865150-------
875200-------
885300-------
895800-------
905500-------
9150004986.71554761.69145211.73960.453900.99990
9251005149.55884894.54445404.57320.35160.87480.99640.0035
9355005590.24265284.30335896.18190.28160.99920.99380.7184
9458005721.25195382.20536060.29840.32450.89960.98410.8996
9560006130.11655756.56226503.67080.24740.95840.97690.9995
9656005575.97865172.74935979.20790.45350.01960.96620.6441
9754005327.91014896.21915759.60120.37170.10830.95690.2173
9853505527.00855068.98385985.03320.22440.70660.94670.546
9953005577.42945094.34386060.5150.13020.82190.93720.6233
10055505677.23295170.39566184.07020.31140.92770.92770.7534
10157506177.32465647.76796706.88130.05690.98990.91870.9939
10258005877.28185325.95556428.60820.39180.67450.91010.9101







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
910.0230.00270.00270.0027176.4775000.06640.0664
920.0253-0.00970.00620.00622456.07531316.276436.2805-0.24780.1571
930.0279-0.01640.00960.00958143.72363592.092159.9341-0.45120.2551
940.03020.01360.01060.01066201.27094244.386865.1490.39370.2898
950.0311-0.02170.01280.012716930.30666781.570882.3503-0.65060.362
960.03690.00430.01140.0113577.02835747.480475.81210.12010.3216
970.04130.01330.01170.01165196.95025668.833275.29170.36040.3272
980.0423-0.03310.01430.014331332.01078876.730494.2164-0.8850.3969
990.0442-0.05230.01860.018376967.055616442.3221128.2276-1.38710.5069
1000.0455-0.02290.0190.018816188.214716416.9113128.1285-0.63620.5199
1010.0437-0.07430.0240.0236182606.329431525.0402177.5529-2.13660.6668
1020.0479-0.01330.02310.02275972.478529395.6601171.4516-0.38640.6435

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
91 & 0.023 & 0.0027 & 0.0027 & 0.0027 & 176.4775 & 0 & 0 & 0.0664 & 0.0664 \tabularnewline
92 & 0.0253 & -0.0097 & 0.0062 & 0.0062 & 2456.0753 & 1316.2764 & 36.2805 & -0.2478 & 0.1571 \tabularnewline
93 & 0.0279 & -0.0164 & 0.0096 & 0.0095 & 8143.7236 & 3592.0921 & 59.9341 & -0.4512 & 0.2551 \tabularnewline
94 & 0.0302 & 0.0136 & 0.0106 & 0.0106 & 6201.2709 & 4244.3868 & 65.149 & 0.3937 & 0.2898 \tabularnewline
95 & 0.0311 & -0.0217 & 0.0128 & 0.0127 & 16930.3066 & 6781.5708 & 82.3503 & -0.6506 & 0.362 \tabularnewline
96 & 0.0369 & 0.0043 & 0.0114 & 0.0113 & 577.0283 & 5747.4804 & 75.8121 & 0.1201 & 0.3216 \tabularnewline
97 & 0.0413 & 0.0133 & 0.0117 & 0.0116 & 5196.9502 & 5668.8332 & 75.2917 & 0.3604 & 0.3272 \tabularnewline
98 & 0.0423 & -0.0331 & 0.0143 & 0.0143 & 31332.0107 & 8876.7304 & 94.2164 & -0.885 & 0.3969 \tabularnewline
99 & 0.0442 & -0.0523 & 0.0186 & 0.0183 & 76967.0556 & 16442.3221 & 128.2276 & -1.3871 & 0.5069 \tabularnewline
100 & 0.0455 & -0.0229 & 0.019 & 0.0188 & 16188.2147 & 16416.9113 & 128.1285 & -0.6362 & 0.5199 \tabularnewline
101 & 0.0437 & -0.0743 & 0.024 & 0.0236 & 182606.3294 & 31525.0402 & 177.5529 & -2.1366 & 0.6668 \tabularnewline
102 & 0.0479 & -0.0133 & 0.0231 & 0.0227 & 5972.4785 & 29395.6601 & 171.4516 & -0.3864 & 0.6435 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302505&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]91[/C][C]0.023[/C][C]0.0027[/C][C]0.0027[/C][C]0.0027[/C][C]176.4775[/C][C]0[/C][C]0[/C][C]0.0664[/C][C]0.0664[/C][/ROW]
[ROW][C]92[/C][C]0.0253[/C][C]-0.0097[/C][C]0.0062[/C][C]0.0062[/C][C]2456.0753[/C][C]1316.2764[/C][C]36.2805[/C][C]-0.2478[/C][C]0.1571[/C][/ROW]
[ROW][C]93[/C][C]0.0279[/C][C]-0.0164[/C][C]0.0096[/C][C]0.0095[/C][C]8143.7236[/C][C]3592.0921[/C][C]59.9341[/C][C]-0.4512[/C][C]0.2551[/C][/ROW]
[ROW][C]94[/C][C]0.0302[/C][C]0.0136[/C][C]0.0106[/C][C]0.0106[/C][C]6201.2709[/C][C]4244.3868[/C][C]65.149[/C][C]0.3937[/C][C]0.2898[/C][/ROW]
[ROW][C]95[/C][C]0.0311[/C][C]-0.0217[/C][C]0.0128[/C][C]0.0127[/C][C]16930.3066[/C][C]6781.5708[/C][C]82.3503[/C][C]-0.6506[/C][C]0.362[/C][/ROW]
[ROW][C]96[/C][C]0.0369[/C][C]0.0043[/C][C]0.0114[/C][C]0.0113[/C][C]577.0283[/C][C]5747.4804[/C][C]75.8121[/C][C]0.1201[/C][C]0.3216[/C][/ROW]
[ROW][C]97[/C][C]0.0413[/C][C]0.0133[/C][C]0.0117[/C][C]0.0116[/C][C]5196.9502[/C][C]5668.8332[/C][C]75.2917[/C][C]0.3604[/C][C]0.3272[/C][/ROW]
[ROW][C]98[/C][C]0.0423[/C][C]-0.0331[/C][C]0.0143[/C][C]0.0143[/C][C]31332.0107[/C][C]8876.7304[/C][C]94.2164[/C][C]-0.885[/C][C]0.3969[/C][/ROW]
[ROW][C]99[/C][C]0.0442[/C][C]-0.0523[/C][C]0.0186[/C][C]0.0183[/C][C]76967.0556[/C][C]16442.3221[/C][C]128.2276[/C][C]-1.3871[/C][C]0.5069[/C][/ROW]
[ROW][C]100[/C][C]0.0455[/C][C]-0.0229[/C][C]0.019[/C][C]0.0188[/C][C]16188.2147[/C][C]16416.9113[/C][C]128.1285[/C][C]-0.6362[/C][C]0.5199[/C][/ROW]
[ROW][C]101[/C][C]0.0437[/C][C]-0.0743[/C][C]0.024[/C][C]0.0236[/C][C]182606.3294[/C][C]31525.0402[/C][C]177.5529[/C][C]-2.1366[/C][C]0.6668[/C][/ROW]
[ROW][C]102[/C][C]0.0479[/C][C]-0.0133[/C][C]0.0231[/C][C]0.0227[/C][C]5972.4785[/C][C]29395.6601[/C][C]171.4516[/C][C]-0.3864[/C][C]0.6435[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302505&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302505&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
910.0230.00270.00270.0027176.4775000.06640.0664
920.0253-0.00970.00620.00622456.07531316.276436.2805-0.24780.1571
930.0279-0.01640.00960.00958143.72363592.092159.9341-0.45120.2551
940.03020.01360.01060.01066201.27094244.386865.1490.39370.2898
950.0311-0.02170.01280.012716930.30666781.570882.3503-0.65060.362
960.03690.00430.01140.0113577.02835747.480475.81210.12010.3216
970.04130.01330.01170.01165196.95025668.833275.29170.36040.3272
980.0423-0.03310.01430.014331332.01078876.730494.2164-0.8850.3969
990.0442-0.05230.01860.018376967.055616442.3221128.2276-1.38710.5069
1000.0455-0.02290.0190.018816188.214716416.9113128.1285-0.63620.5199
1010.0437-0.07430.0240.0236182606.329431525.0402177.5529-2.13660.6668
1020.0479-0.01330.02310.02275972.478529395.6601171.4516-0.38640.6435



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