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, 22 Dec 2017 22:41:01 +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/2017/Dec/22/t1513978897m5y1ecnfitk4hk8.htm/, Retrieved Thu, 31 Oct 2024 23:51:04 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=310842, Retrieved Thu, 31 Oct 2024 23:51:04 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsDataset3
Estimated Impact97
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [ARIMA Forecasting] [2017-12-22 21:41:01] [02e100d22760f9e09756a00c2eb0ef89] [Current]
Feedback Forum

Post a new message
Dataseries X:
112.7
122
134.7
109.8
130.8
118.7
104.4
87.8
134.2
143.9
140.4
111
126.3
124.4
136.1
118.4
127.4
127.9
115
90.2
131
143.3
131.5
98.5
124.9
122.4
128.8
125.9
120.2
120
116
89.2
135.9
148.7
128.1
100.9
125.5
119.8
120.7
125
109
114.2
105.6
80.1
131.1
136.6
119.7
102.4
114.5
112.9
131.8
118.7
107.1
127
104.6
85.9
134
127.6
121.5
104.5
107.3
111.9
120.7
116.9
106.1
122.3
97.8
82.7
128.2
119
127.4
106
108.7
113.5
131.4
111.3
119
130.7
104.5
88.9
135.4
140.6
138.8
107.4
120.8
124.1
139.2
119.9
121
133.7
115.2
96.7
131
147.6
132.9
97.4
123.6
124.9
118.6
127.6
110.2
115.4
106.6
75.5
116.7
118
98.7
81.5
87
86.8
96.8
92.7
82.1
94.1
89.7
67.5
102
103.2
95.6
83
87.2
94
107.7
103.3
94.8
112.7
96.8
75.9
116.7
111.4
108.6
90.9
92.6
95.7
116.7
95.4
105.1
99.7
89.8
74
108
102.1
100.2
83.2
87.9
93.3
98.5
84.5
89.3
94.2
83.5
67.5
89.4
102.4
92
65.9
85.3
87
91.8
88.5
89.1
89.8
88.9
64
93.2
100.1
89.3
68.1
94.3
93.3
98.1
96.8
87.8
95.6
95.7
64.4
108.1
109.6
90.9
75.6
93.5
98.1
104.5
102.7
89.6
108.8
95.4
70.1
104.6
105.5
96.8
79.4
92.3
96.8
103
99.5
91
103.4
82
70.1
98.1
95.7
98
77.3
89.8
91.6
106.5
87.5
99.5
104.4
84.5
68.3




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=310842&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 time3 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[200])
18870.1-------
189104.6-------
190105.5-------
19196.8-------
19279.4-------
19392.3-------
19496.8-------
195103-------
19699.5-------
19791-------
198103.4-------
19982-------
20070.1-------
20198.1100.718891.2492111.50670.317110.24041
20295.798.729389.2862109.51290.2910.54550.10921
2039896.479586.7619107.66070.39490.55430.47761
20477.375.718367.3485.50380.375700.23040.8698
20589.887.495777.195699.65640.35520.94980.21940.9975
20691.692.703680.9374106.7940.4390.65690.28440.9992
207106.597.38584.0427113.61720.13550.75760.24890.9995
20887.592.95680.0534108.6980.24850.04590.20760.9978
20999.588.311975.6547103.86570.07930.54070.36740.9891
210104.496.152781.5246114.38480.18760.35950.2180.9975
21184.583.193770.694998.72420.43450.00370.55990.9508
21268.367.121857.271579.29290.42480.00260.31580.3158

\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[200]) \tabularnewline
188 & 70.1 & - & - & - & - & - & - & - \tabularnewline
189 & 104.6 & - & - & - & - & - & - & - \tabularnewline
190 & 105.5 & - & - & - & - & - & - & - \tabularnewline
191 & 96.8 & - & - & - & - & - & - & - \tabularnewline
192 & 79.4 & - & - & - & - & - & - & - \tabularnewline
193 & 92.3 & - & - & - & - & - & - & - \tabularnewline
194 & 96.8 & - & - & - & - & - & - & - \tabularnewline
195 & 103 & - & - & - & - & - & - & - \tabularnewline
196 & 99.5 & - & - & - & - & - & - & - \tabularnewline
197 & 91 & - & - & - & - & - & - & - \tabularnewline
198 & 103.4 & - & - & - & - & - & - & - \tabularnewline
199 & 82 & - & - & - & - & - & - & - \tabularnewline
200 & 70.1 & - & - & - & - & - & - & - \tabularnewline
201 & 98.1 & 100.7188 & 91.2492 & 111.5067 & 0.3171 & 1 & 0.2404 & 1 \tabularnewline
202 & 95.7 & 98.7293 & 89.2862 & 109.5129 & 0.291 & 0.5455 & 0.1092 & 1 \tabularnewline
203 & 98 & 96.4795 & 86.7619 & 107.6607 & 0.3949 & 0.5543 & 0.4776 & 1 \tabularnewline
204 & 77.3 & 75.7183 & 67.34 & 85.5038 & 0.3757 & 0 & 0.2304 & 0.8698 \tabularnewline
205 & 89.8 & 87.4957 & 77.1956 & 99.6564 & 0.3552 & 0.9498 & 0.2194 & 0.9975 \tabularnewline
206 & 91.6 & 92.7036 & 80.9374 & 106.794 & 0.439 & 0.6569 & 0.2844 & 0.9992 \tabularnewline
207 & 106.5 & 97.385 & 84.0427 & 113.6172 & 0.1355 & 0.7576 & 0.2489 & 0.9995 \tabularnewline
208 & 87.5 & 92.956 & 80.0534 & 108.698 & 0.2485 & 0.0459 & 0.2076 & 0.9978 \tabularnewline
209 & 99.5 & 88.3119 & 75.6547 & 103.8657 & 0.0793 & 0.5407 & 0.3674 & 0.9891 \tabularnewline
210 & 104.4 & 96.1527 & 81.5246 & 114.3848 & 0.1876 & 0.3595 & 0.218 & 0.9975 \tabularnewline
211 & 84.5 & 83.1937 & 70.6949 & 98.7242 & 0.4345 & 0.0037 & 0.5599 & 0.9508 \tabularnewline
212 & 68.3 & 67.1218 & 57.2715 & 79.2929 & 0.4248 & 0.0026 & 0.3158 & 0.3158 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=310842&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[200])[/C][/ROW]
[ROW][C]188[/C][C]70.1[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]189[/C][C]104.6[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]190[/C][C]105.5[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]191[/C][C]96.8[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]192[/C][C]79.4[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]193[/C][C]92.3[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]194[/C][C]96.8[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]195[/C][C]103[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]196[/C][C]99.5[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]197[/C][C]91[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]198[/C][C]103.4[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]199[/C][C]82[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]200[/C][C]70.1[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]201[/C][C]98.1[/C][C]100.7188[/C][C]91.2492[/C][C]111.5067[/C][C]0.3171[/C][C]1[/C][C]0.2404[/C][C]1[/C][/ROW]
[ROW][C]202[/C][C]95.7[/C][C]98.7293[/C][C]89.2862[/C][C]109.5129[/C][C]0.291[/C][C]0.5455[/C][C]0.1092[/C][C]1[/C][/ROW]
[ROW][C]203[/C][C]98[/C][C]96.4795[/C][C]86.7619[/C][C]107.6607[/C][C]0.3949[/C][C]0.5543[/C][C]0.4776[/C][C]1[/C][/ROW]
[ROW][C]204[/C][C]77.3[/C][C]75.7183[/C][C]67.34[/C][C]85.5038[/C][C]0.3757[/C][C]0[/C][C]0.2304[/C][C]0.8698[/C][/ROW]
[ROW][C]205[/C][C]89.8[/C][C]87.4957[/C][C]77.1956[/C][C]99.6564[/C][C]0.3552[/C][C]0.9498[/C][C]0.2194[/C][C]0.9975[/C][/ROW]
[ROW][C]206[/C][C]91.6[/C][C]92.7036[/C][C]80.9374[/C][C]106.794[/C][C]0.439[/C][C]0.6569[/C][C]0.2844[/C][C]0.9992[/C][/ROW]
[ROW][C]207[/C][C]106.5[/C][C]97.385[/C][C]84.0427[/C][C]113.6172[/C][C]0.1355[/C][C]0.7576[/C][C]0.2489[/C][C]0.9995[/C][/ROW]
[ROW][C]208[/C][C]87.5[/C][C]92.956[/C][C]80.0534[/C][C]108.698[/C][C]0.2485[/C][C]0.0459[/C][C]0.2076[/C][C]0.9978[/C][/ROW]
[ROW][C]209[/C][C]99.5[/C][C]88.3119[/C][C]75.6547[/C][C]103.8657[/C][C]0.0793[/C][C]0.5407[/C][C]0.3674[/C][C]0.9891[/C][/ROW]
[ROW][C]210[/C][C]104.4[/C][C]96.1527[/C][C]81.5246[/C][C]114.3848[/C][C]0.1876[/C][C]0.3595[/C][C]0.218[/C][C]0.9975[/C][/ROW]
[ROW][C]211[/C][C]84.5[/C][C]83.1937[/C][C]70.6949[/C][C]98.7242[/C][C]0.4345[/C][C]0.0037[/C][C]0.5599[/C][C]0.9508[/C][/ROW]
[ROW][C]212[/C][C]68.3[/C][C]67.1218[/C][C]57.2715[/C][C]79.2929[/C][C]0.4248[/C][C]0.0026[/C][C]0.3158[/C][C]0.3158[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=310842&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=310842&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[200])
18870.1-------
189104.6-------
190105.5-------
19196.8-------
19279.4-------
19392.3-------
19496.8-------
195103-------
19699.5-------
19791-------
198103.4-------
19982-------
20070.1-------
20198.1100.718891.2492111.50670.317110.24041
20295.798.729389.2862109.51290.2910.54550.10921
2039896.479586.7619107.66070.39490.55430.47761
20477.375.718367.3485.50380.375700.23040.8698
20589.887.495777.195699.65640.35520.94980.21940.9975
20691.692.703680.9374106.7940.4390.65690.28440.9992
207106.597.38584.0427113.61720.13550.75760.24890.9995
20887.592.95680.0534108.6980.24850.04590.20760.9978
20999.588.311975.6547103.86570.07930.54070.36740.9891
210104.496.152781.5246114.38480.18760.35950.2180.9975
21184.583.193770.694998.72420.43450.00370.55990.9508
21268.367.121857.271579.29290.42480.00260.31580.3158







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
2010.0546-0.02670.02670.02636.85800-0.22750.2275
2020.0557-0.03170.02920.02889.17648.01722.8315-0.26320.2454
2030.05910.01550.02460.02442.3126.11552.47290.13210.2076
2040.06590.02050.02360.02352.50185.21212.2830.13740.1901
2050.07090.02570.0240.0245.30965.23162.28730.20020.1921
2060.0775-0.0120.0220.0221.2184.56262.136-0.09590.1761
2070.0850.08560.03110.031683.083715.77993.97240.7920.2641
2080.0864-0.06240.0350.035229.767817.52844.1867-0.47410.2903
2090.08990.11240.04360.0445125.173929.4895.43040.97210.3661
2100.09670.0790.04710.048368.01833.34195.77420.71660.4011
2110.09520.01550.04430.04531.706430.4665.51960.11350.375
2120.09250.01730.0420.0431.388328.04285.29550.10240.3523

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
201 & 0.0546 & -0.0267 & 0.0267 & 0.0263 & 6.858 & 0 & 0 & -0.2275 & 0.2275 \tabularnewline
202 & 0.0557 & -0.0317 & 0.0292 & 0.0288 & 9.1764 & 8.0172 & 2.8315 & -0.2632 & 0.2454 \tabularnewline
203 & 0.0591 & 0.0155 & 0.0246 & 0.0244 & 2.312 & 6.1155 & 2.4729 & 0.1321 & 0.2076 \tabularnewline
204 & 0.0659 & 0.0205 & 0.0236 & 0.0235 & 2.5018 & 5.2121 & 2.283 & 0.1374 & 0.1901 \tabularnewline
205 & 0.0709 & 0.0257 & 0.024 & 0.024 & 5.3096 & 5.2316 & 2.2873 & 0.2002 & 0.1921 \tabularnewline
206 & 0.0775 & -0.012 & 0.022 & 0.022 & 1.218 & 4.5626 & 2.136 & -0.0959 & 0.1761 \tabularnewline
207 & 0.085 & 0.0856 & 0.0311 & 0.0316 & 83.0837 & 15.7799 & 3.9724 & 0.792 & 0.2641 \tabularnewline
208 & 0.0864 & -0.0624 & 0.035 & 0.0352 & 29.7678 & 17.5284 & 4.1867 & -0.4741 & 0.2903 \tabularnewline
209 & 0.0899 & 0.1124 & 0.0436 & 0.0445 & 125.1739 & 29.489 & 5.4304 & 0.9721 & 0.3661 \tabularnewline
210 & 0.0967 & 0.079 & 0.0471 & 0.0483 & 68.018 & 33.3419 & 5.7742 & 0.7166 & 0.4011 \tabularnewline
211 & 0.0952 & 0.0155 & 0.0443 & 0.0453 & 1.7064 & 30.466 & 5.5196 & 0.1135 & 0.375 \tabularnewline
212 & 0.0925 & 0.0173 & 0.042 & 0.043 & 1.3883 & 28.0428 & 5.2955 & 0.1024 & 0.3523 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=310842&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]201[/C][C]0.0546[/C][C]-0.0267[/C][C]0.0267[/C][C]0.0263[/C][C]6.858[/C][C]0[/C][C]0[/C][C]-0.2275[/C][C]0.2275[/C][/ROW]
[ROW][C]202[/C][C]0.0557[/C][C]-0.0317[/C][C]0.0292[/C][C]0.0288[/C][C]9.1764[/C][C]8.0172[/C][C]2.8315[/C][C]-0.2632[/C][C]0.2454[/C][/ROW]
[ROW][C]203[/C][C]0.0591[/C][C]0.0155[/C][C]0.0246[/C][C]0.0244[/C][C]2.312[/C][C]6.1155[/C][C]2.4729[/C][C]0.1321[/C][C]0.2076[/C][/ROW]
[ROW][C]204[/C][C]0.0659[/C][C]0.0205[/C][C]0.0236[/C][C]0.0235[/C][C]2.5018[/C][C]5.2121[/C][C]2.283[/C][C]0.1374[/C][C]0.1901[/C][/ROW]
[ROW][C]205[/C][C]0.0709[/C][C]0.0257[/C][C]0.024[/C][C]0.024[/C][C]5.3096[/C][C]5.2316[/C][C]2.2873[/C][C]0.2002[/C][C]0.1921[/C][/ROW]
[ROW][C]206[/C][C]0.0775[/C][C]-0.012[/C][C]0.022[/C][C]0.022[/C][C]1.218[/C][C]4.5626[/C][C]2.136[/C][C]-0.0959[/C][C]0.1761[/C][/ROW]
[ROW][C]207[/C][C]0.085[/C][C]0.0856[/C][C]0.0311[/C][C]0.0316[/C][C]83.0837[/C][C]15.7799[/C][C]3.9724[/C][C]0.792[/C][C]0.2641[/C][/ROW]
[ROW][C]208[/C][C]0.0864[/C][C]-0.0624[/C][C]0.035[/C][C]0.0352[/C][C]29.7678[/C][C]17.5284[/C][C]4.1867[/C][C]-0.4741[/C][C]0.2903[/C][/ROW]
[ROW][C]209[/C][C]0.0899[/C][C]0.1124[/C][C]0.0436[/C][C]0.0445[/C][C]125.1739[/C][C]29.489[/C][C]5.4304[/C][C]0.9721[/C][C]0.3661[/C][/ROW]
[ROW][C]210[/C][C]0.0967[/C][C]0.079[/C][C]0.0471[/C][C]0.0483[/C][C]68.018[/C][C]33.3419[/C][C]5.7742[/C][C]0.7166[/C][C]0.4011[/C][/ROW]
[ROW][C]211[/C][C]0.0952[/C][C]0.0155[/C][C]0.0443[/C][C]0.0453[/C][C]1.7064[/C][C]30.466[/C][C]5.5196[/C][C]0.1135[/C][C]0.375[/C][/ROW]
[ROW][C]212[/C][C]0.0925[/C][C]0.0173[/C][C]0.042[/C][C]0.043[/C][C]1.3883[/C][C]28.0428[/C][C]5.2955[/C][C]0.1024[/C][C]0.3523[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=310842&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=310842&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
2010.0546-0.02670.02670.02636.85800-0.22750.2275
2020.0557-0.03170.02920.02889.17648.01722.8315-0.26320.2454
2030.05910.01550.02460.02442.3126.11552.47290.13210.2076
2040.06590.02050.02360.02352.50185.21212.2830.13740.1901
2050.07090.02570.0240.0245.30965.23162.28730.20020.1921
2060.0775-0.0120.0220.0221.2184.56262.136-0.09590.1761
2070.0850.08560.03110.031683.083715.77993.97240.7920.2641
2080.0864-0.06240.0350.035229.767817.52844.1867-0.47410.2903
2090.08990.11240.04360.0445125.173929.4895.43040.97210.3661
2100.09670.0790.04710.048368.01833.34195.77420.71660.4011
2110.09520.01550.04430.04531.706430.4665.51960.11350.375
2120.09250.01730.0420.0431.388328.04285.29550.10240.3523



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