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 computationMon, 15 Dec 2008 12:51:39 -0700
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2008/Dec/15/t1229371126v4gz90axvbtfc55.htm/, Retrieved Wed, 15 May 2024 21:56:33 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=33800, Retrieved Wed, 15 May 2024 21:56:33 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact144
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
F       [ARIMA Forecasting] [q1 forecast] [2008-12-15 19:51:39] [f4b2017b314c03698059f43b95818e67] [Current]
Feedback Forum
2008-12-22 22:23:44 [Jeroen Michel] [reply
step 1:
Hier was het de bedoeling de vragen te beantwoorden. Uit de tijdreeks moeten we kunnen stellen of de voorspelling al dan niet tussen de waarden ligt dankzij de betrouwbaarheidsintervallen 95% LB (benedengrens) en 95% UB (bovengrens). Dit is slechts indien de omstandigheden blijven zoals ze waren. We kunnen hier tevens ook bepalen of we met toevalligheid te maken hebben aangezien de P-waarde dit aanduidt. Deze P-waarde gaat van de nullhypothese uit, met andere woorden dat de voorspelde waarden en de werkelijke waarden niet significant verschillend zijn. Indien de P-waarde kleiner is dan 5% kunnen we wel spreken over een significant verschil aangezien deze dan verwaarloosbaar klein is.

step 2:
Het betrouwbaarheidsinterval wordt bepaald door de stippellijn welke bij overschrijding bepaalt dat de voorspelde waarde significant verschillend is van de werkelijke waarde. Wanneer de weergegeven bolletjeslijn boven deze stippellijn komt, dan kunnen we spreken van een overschatting, eronder is een onderschatting.

step 3:
De werkelijke standaardfout wordt bepaald door de kolom PE terwijl de voorspelde standaardfout wordt bepaald door de kolom %SE. Deze voorspelde standaardfout is een voorspelling over hoever we met onze voorspelde waarde naast de eigenlijke waarde liggen.

step 4:
Hier kunnen we een waarschijnlijkheid P verkennen in de laatste kolommen.

P F(t) > Y(t-1)
De waarschijnlijkheid dat de voorspelde waarde groter is dan de werkelijke waarde van de vorige observatie = (t-1)
P F(t) > Y(t-s)
De waarschijnlijkheid dat de voorspelde waarde groter is dan de werkelijke waarde van de observatie s jaar geleden = (t-s)
P F(t) > Y(48)
De waarschijnlijkheid dat de voorspelde waarde groter is dan de laatst gekende waarde.

step 5:
Vallen bepaalde voorspelde waarden buiten het betrouwbaarheidsinterval? Voorspelde waarden vergelijken met de werkelijke waarden!

Post a new message
Dataseries X:
106099
103235
98857
101107
102700
101477
99639
96622
94697
95093
112885
121162
113624
111632
106707
108827
108413
106249
104861
102382
100320
100228
117089
121523
114948
112831
107605
108928
101993
102850
99925
101536
99450
98305
110159
109483
106810
96279
91982
90276
90999
86622
83117
80367
77550
77443
92844
92175
84822
81632
78872
81485
80651
78192
76844
76335
71415
73899
86822
86371
83469
82662




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 seconds
R Server'George Udny Yule' @ 72.249.76.132

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 4 seconds \tabularnewline
R Server & 'George Udny Yule' @ 72.249.76.132 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=33800&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]4 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'George Udny Yule' @ 72.249.76.132[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=33800&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=33800&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 Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 seconds
R Server'George Udny Yule' @ 72.249.76.132







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[50])
3896279-------
3991982-------
4090276-------
4190999-------
4286622-------
4383117-------
4480367-------
4577550-------
4677443-------
4792844-------
4892175-------
4984822-------
5081632-------
517887276948.632371882.801982014.46260.22840.03500.035
528148578384.818271542.449185227.18740.18730.44453e-040.1761
538065177795.854168707.54586884.16330.2690.21310.00220.204
547819275701.938465348.137886055.73910.31870.17440.01940.1308
557684472935.964861147.47184724.45860.25790.19110.04530.0741
567633570723.920257835.326883612.51360.19670.1760.07130.0486
577141568256.401854255.389782257.4140.32920.1290.09660.0306
587389968327.928653349.558383306.29890.2330.34310.11650.0408
598682284353.226768435.199100271.25450.38060.9010.14790.6312
608637187543.887870740.4988104347.27670.44560.53360.29450.7548
618346980649.337463017.76198280.91380.3770.26240.32140.4565
628266277825.520959431.270296219.77150.30320.27380.34250.3425

\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[50]) \tabularnewline
38 & 96279 & - & - & - & - & - & - & - \tabularnewline
39 & 91982 & - & - & - & - & - & - & - \tabularnewline
40 & 90276 & - & - & - & - & - & - & - \tabularnewline
41 & 90999 & - & - & - & - & - & - & - \tabularnewline
42 & 86622 & - & - & - & - & - & - & - \tabularnewline
43 & 83117 & - & - & - & - & - & - & - \tabularnewline
44 & 80367 & - & - & - & - & - & - & - \tabularnewline
45 & 77550 & - & - & - & - & - & - & - \tabularnewline
46 & 77443 & - & - & - & - & - & - & - \tabularnewline
47 & 92844 & - & - & - & - & - & - & - \tabularnewline
48 & 92175 & - & - & - & - & - & - & - \tabularnewline
49 & 84822 & - & - & - & - & - & - & - \tabularnewline
50 & 81632 & - & - & - & - & - & - & - \tabularnewline
51 & 78872 & 76948.6323 & 71882.8019 & 82014.4626 & 0.2284 & 0.035 & 0 & 0.035 \tabularnewline
52 & 81485 & 78384.8182 & 71542.4491 & 85227.1874 & 0.1873 & 0.4445 & 3e-04 & 0.1761 \tabularnewline
53 & 80651 & 77795.8541 & 68707.545 & 86884.1633 & 0.269 & 0.2131 & 0.0022 & 0.204 \tabularnewline
54 & 78192 & 75701.9384 & 65348.1378 & 86055.7391 & 0.3187 & 0.1744 & 0.0194 & 0.1308 \tabularnewline
55 & 76844 & 72935.9648 & 61147.471 & 84724.4586 & 0.2579 & 0.1911 & 0.0453 & 0.0741 \tabularnewline
56 & 76335 & 70723.9202 & 57835.3268 & 83612.5136 & 0.1967 & 0.176 & 0.0713 & 0.0486 \tabularnewline
57 & 71415 & 68256.4018 & 54255.3897 & 82257.414 & 0.3292 & 0.129 & 0.0966 & 0.0306 \tabularnewline
58 & 73899 & 68327.9286 & 53349.5583 & 83306.2989 & 0.233 & 0.3431 & 0.1165 & 0.0408 \tabularnewline
59 & 86822 & 84353.2267 & 68435.199 & 100271.2545 & 0.3806 & 0.901 & 0.1479 & 0.6312 \tabularnewline
60 & 86371 & 87543.8878 & 70740.4988 & 104347.2767 & 0.4456 & 0.5336 & 0.2945 & 0.7548 \tabularnewline
61 & 83469 & 80649.3374 & 63017.761 & 98280.9138 & 0.377 & 0.2624 & 0.3214 & 0.4565 \tabularnewline
62 & 82662 & 77825.5209 & 59431.2702 & 96219.7715 & 0.3032 & 0.2738 & 0.3425 & 0.3425 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=33800&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[50])[/C][/ROW]
[ROW][C]38[/C][C]96279[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]39[/C][C]91982[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]40[/C][C]90276[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]41[/C][C]90999[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]42[/C][C]86622[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]43[/C][C]83117[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]44[/C][C]80367[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]45[/C][C]77550[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]46[/C][C]77443[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]47[/C][C]92844[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]48[/C][C]92175[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]49[/C][C]84822[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]50[/C][C]81632[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]51[/C][C]78872[/C][C]76948.6323[/C][C]71882.8019[/C][C]82014.4626[/C][C]0.2284[/C][C]0.035[/C][C]0[/C][C]0.035[/C][/ROW]
[ROW][C]52[/C][C]81485[/C][C]78384.8182[/C][C]71542.4491[/C][C]85227.1874[/C][C]0.1873[/C][C]0.4445[/C][C]3e-04[/C][C]0.1761[/C][/ROW]
[ROW][C]53[/C][C]80651[/C][C]77795.8541[/C][C]68707.545[/C][C]86884.1633[/C][C]0.269[/C][C]0.2131[/C][C]0.0022[/C][C]0.204[/C][/ROW]
[ROW][C]54[/C][C]78192[/C][C]75701.9384[/C][C]65348.1378[/C][C]86055.7391[/C][C]0.3187[/C][C]0.1744[/C][C]0.0194[/C][C]0.1308[/C][/ROW]
[ROW][C]55[/C][C]76844[/C][C]72935.9648[/C][C]61147.471[/C][C]84724.4586[/C][C]0.2579[/C][C]0.1911[/C][C]0.0453[/C][C]0.0741[/C][/ROW]
[ROW][C]56[/C][C]76335[/C][C]70723.9202[/C][C]57835.3268[/C][C]83612.5136[/C][C]0.1967[/C][C]0.176[/C][C]0.0713[/C][C]0.0486[/C][/ROW]
[ROW][C]57[/C][C]71415[/C][C]68256.4018[/C][C]54255.3897[/C][C]82257.414[/C][C]0.3292[/C][C]0.129[/C][C]0.0966[/C][C]0.0306[/C][/ROW]
[ROW][C]58[/C][C]73899[/C][C]68327.9286[/C][C]53349.5583[/C][C]83306.2989[/C][C]0.233[/C][C]0.3431[/C][C]0.1165[/C][C]0.0408[/C][/ROW]
[ROW][C]59[/C][C]86822[/C][C]84353.2267[/C][C]68435.199[/C][C]100271.2545[/C][C]0.3806[/C][C]0.901[/C][C]0.1479[/C][C]0.6312[/C][/ROW]
[ROW][C]60[/C][C]86371[/C][C]87543.8878[/C][C]70740.4988[/C][C]104347.2767[/C][C]0.4456[/C][C]0.5336[/C][C]0.2945[/C][C]0.7548[/C][/ROW]
[ROW][C]61[/C][C]83469[/C][C]80649.3374[/C][C]63017.761[/C][C]98280.9138[/C][C]0.377[/C][C]0.2624[/C][C]0.3214[/C][C]0.4565[/C][/ROW]
[ROW][C]62[/C][C]82662[/C][C]77825.5209[/C][C]59431.2702[/C][C]96219.7715[/C][C]0.3032[/C][C]0.2738[/C][C]0.3425[/C][C]0.3425[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=33800&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=33800&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[50])
3896279-------
3991982-------
4090276-------
4190999-------
4286622-------
4383117-------
4480367-------
4577550-------
4677443-------
4792844-------
4892175-------
4984822-------
5081632-------
517887276948.632371882.801982014.46260.22840.03500.035
528148578384.818271542.449185227.18740.18730.44453e-040.1761
538065177795.854168707.54586884.16330.2690.21310.00220.204
547819275701.938465348.137886055.73910.31870.17440.01940.1308
557684472935.964861147.47184724.45860.25790.19110.04530.0741
567633570723.920257835.326883612.51360.19670.1760.07130.0486
577141568256.401854255.389782257.4140.32920.1290.09660.0306
587389968327.928653349.558383306.29890.2330.34310.11650.0408
598682284353.226768435.199100271.25450.38060.9010.14790.6312
608637187543.887870740.4988104347.27670.44560.53360.29450.7548
618346980649.337463017.76198280.91380.3770.26240.32140.4565
628266277825.520959431.270296219.77150.30320.27380.34250.3425







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPESq.EMSERMSE
510.03360.0250.00213699343.3456308278.6121555.2284
520.04450.03960.00339611126.9657800927.2471894.9454
530.05960.03670.00318151858.0296679321.5025824.2096
540.06980.03290.00276200406.545516700.5454718.8189
550.08250.05360.004515272739.11551272728.25961128.1526
560.0930.07930.006631484216.28732623684.69061619.7792
570.10470.04630.00399976742.2736831395.1895911.8087
580.11180.08150.006831036836.63892586403.05321608.2298
590.09630.02930.00246094841.5743507903.4645712.6735
600.0979-0.01340.00111375665.7642114638.8137338.5835
610.11150.0350.00297950497.1751662541.4313813.9665
620.12060.06210.005223391530.55581949294.2131396.1713

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & Sq.E & MSE & RMSE \tabularnewline
51 & 0.0336 & 0.025 & 0.0021 & 3699343.3456 & 308278.6121 & 555.2284 \tabularnewline
52 & 0.0445 & 0.0396 & 0.0033 & 9611126.9657 & 800927.2471 & 894.9454 \tabularnewline
53 & 0.0596 & 0.0367 & 0.0031 & 8151858.0296 & 679321.5025 & 824.2096 \tabularnewline
54 & 0.0698 & 0.0329 & 0.0027 & 6200406.545 & 516700.5454 & 718.8189 \tabularnewline
55 & 0.0825 & 0.0536 & 0.0045 & 15272739.1155 & 1272728.2596 & 1128.1526 \tabularnewline
56 & 0.093 & 0.0793 & 0.0066 & 31484216.2873 & 2623684.6906 & 1619.7792 \tabularnewline
57 & 0.1047 & 0.0463 & 0.0039 & 9976742.2736 & 831395.1895 & 911.8087 \tabularnewline
58 & 0.1118 & 0.0815 & 0.0068 & 31036836.6389 & 2586403.0532 & 1608.2298 \tabularnewline
59 & 0.0963 & 0.0293 & 0.0024 & 6094841.5743 & 507903.4645 & 712.6735 \tabularnewline
60 & 0.0979 & -0.0134 & 0.0011 & 1375665.7642 & 114638.8137 & 338.5835 \tabularnewline
61 & 0.1115 & 0.035 & 0.0029 & 7950497.1751 & 662541.4313 & 813.9665 \tabularnewline
62 & 0.1206 & 0.0621 & 0.0052 & 23391530.5558 & 1949294.213 & 1396.1713 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=33800&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]Sq.E[/C][C]MSE[/C][C]RMSE[/C][/ROW]
[ROW][C]51[/C][C]0.0336[/C][C]0.025[/C][C]0.0021[/C][C]3699343.3456[/C][C]308278.6121[/C][C]555.2284[/C][/ROW]
[ROW][C]52[/C][C]0.0445[/C][C]0.0396[/C][C]0.0033[/C][C]9611126.9657[/C][C]800927.2471[/C][C]894.9454[/C][/ROW]
[ROW][C]53[/C][C]0.0596[/C][C]0.0367[/C][C]0.0031[/C][C]8151858.0296[/C][C]679321.5025[/C][C]824.2096[/C][/ROW]
[ROW][C]54[/C][C]0.0698[/C][C]0.0329[/C][C]0.0027[/C][C]6200406.545[/C][C]516700.5454[/C][C]718.8189[/C][/ROW]
[ROW][C]55[/C][C]0.0825[/C][C]0.0536[/C][C]0.0045[/C][C]15272739.1155[/C][C]1272728.2596[/C][C]1128.1526[/C][/ROW]
[ROW][C]56[/C][C]0.093[/C][C]0.0793[/C][C]0.0066[/C][C]31484216.2873[/C][C]2623684.6906[/C][C]1619.7792[/C][/ROW]
[ROW][C]57[/C][C]0.1047[/C][C]0.0463[/C][C]0.0039[/C][C]9976742.2736[/C][C]831395.1895[/C][C]911.8087[/C][/ROW]
[ROW][C]58[/C][C]0.1118[/C][C]0.0815[/C][C]0.0068[/C][C]31036836.6389[/C][C]2586403.0532[/C][C]1608.2298[/C][/ROW]
[ROW][C]59[/C][C]0.0963[/C][C]0.0293[/C][C]0.0024[/C][C]6094841.5743[/C][C]507903.4645[/C][C]712.6735[/C][/ROW]
[ROW][C]60[/C][C]0.0979[/C][C]-0.0134[/C][C]0.0011[/C][C]1375665.7642[/C][C]114638.8137[/C][C]338.5835[/C][/ROW]
[ROW][C]61[/C][C]0.1115[/C][C]0.035[/C][C]0.0029[/C][C]7950497.1751[/C][C]662541.4313[/C][C]813.9665[/C][/ROW]
[ROW][C]62[/C][C]0.1206[/C][C]0.0621[/C][C]0.0052[/C][C]23391530.5558[/C][C]1949294.213[/C][C]1396.1713[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=33800&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=33800&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.PEMAPESq.EMSERMSE
510.03360.0250.00213699343.3456308278.6121555.2284
520.04450.03960.00339611126.9657800927.2471894.9454
530.05960.03670.00318151858.0296679321.5025824.2096
540.06980.03290.00276200406.545516700.5454718.8189
550.08250.05360.004515272739.11551272728.25961128.1526
560.0930.07930.006631484216.28732623684.69061619.7792
570.10470.04630.00399976742.2736831395.1895911.8087
580.11180.08150.006831036836.63892586403.05321608.2298
590.09630.02930.00246094841.5743507903.4645712.6735
600.0979-0.01340.00111375665.7642114638.8137338.5835
610.11150.0350.00297950497.1751662541.4313813.9665
620.12060.06210.005223391530.55581949294.2131396.1713



Parameters (Session):
par1 = 12 ; par2 = 1 ; par3 = 1 ; par4 = 1 ; par5 = 12 ; par6 = 3 ; par7 = 2 ; par8 = 2 ; par9 = 1 ; par10 = FALSE ;
Parameters (R input):
par1 = 12 ; par2 = 1 ; par3 = 1 ; par4 = 1 ; par5 = 12 ; par6 = 3 ; par7 = 2 ; 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
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.mape <- array(0, dim=fx)
perf.se <- array(0, dim=fx)
perf.mse <- array(0, dim=fx)
perf.rmse <- array(0, dim=fx)
for (i in 1:fx) {
locSD <- (ub[i] - forecast$pred[i]) / 1.96
perf.pe[i] = (x[nx+i] - forecast$pred[i]) / forecast$pred[i]
perf.mape[i] = perf.mape[i] + abs(perf.pe[i])
perf.se[i] = (x[nx+i] - forecast$pred[i])^2
perf.mse[i] = perf.mse[i] + perf.se[i]
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 = perf.mape / fx
perf.mse = perf.mse / fx
perf.rmse = sqrt(perf.mse)
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:12] <- 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',7,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,'Sq.E',1,header=TRUE)
a<-table.element(a,'MSE',1,header=TRUE)
a<-table.element(a,'RMSE',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.mape[i],4))
a<-table.element(a,round(perf.se[i],4))
a<-table.element(a,round(perf.mse[i],4))
a<-table.element(a,round(perf.rmse[i],4))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')