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:14:36 -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/t12293685105i75e8ohgtu294p.htm/, Retrieved Sat, 18 May 2024 08:24:47 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=33788, Retrieved Sat, 18 May 2024 08:24:47 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact204
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Univariate Data Series] [data set] [2008-12-01 19:54:57] [b98453cac15ba1066b407e146608df68]
- RMPD  [Standard Deviation-Mean Plot] [SD mean plot step 1] [2008-12-08 19:47:44] [7d3039e6253bb5fb3b26df1537d500b4]
F    D    [Standard Deviation-Mean Plot] [SD mean plot step 1] [2008-12-08 19:54:49] [7d3039e6253bb5fb3b26df1537d500b4]
F RM D      [Spectral Analysis] [cumulative period...] [2008-12-08 20:14:38] [7d3039e6253bb5fb3b26df1537d500b4]
-             [Spectral Analysis] [cumulative period...] [2008-12-08 20:28:31] [7d3039e6253bb5fb3b26df1537d500b4]
F RMPD            [ARIMA Forecasting] [Arima forecasting...] [2008-12-15 19:14:36] [35348cd8592af0baf5f138bd59921307] [Current]
-   P               [ARIMA Forecasting] [Arima Forecast st...] [2008-12-19 17:28:32] [7d3039e6253bb5fb3b26df1537d500b4]
Feedback Forum
2008-12-19 17:39:22 [Stéphanie Claes] [reply
Bij deze vraag heb ik 1 parameter fout ingegeven, namelijk P = 2 moest zijn P = 1.

=> http://www.freestatistics.org/blog/index.php?v=date/2008/Dec/19/t1229707939z2x0ummh38eefs5.htm

Als we naar de correcte link gaan kijken dan zien we dat de voorspelde en werkelijke waarden nog steeds binnen het getekende interval lopen (dat de witte lijn binnen het interval loopt is logisch aangezien het interval rond deze lijn wordt getekend).
Dit duidt op geen exceptionele gebeurtenissen.
In tegenstelling tot de gehanteerde link in de taak zien we hier geen enkele afwijking buiten het interval.
2008-12-19 17:50:27 [Stéphanie Claes] [reply
Step 2: Dit is correct, ookal staat er hier een parameter fout ingesteld, als we gaan kijken naar de gecorrigeerde link dan zien we dat er eigenlijk geen verschil is.

2008-12-20 20:18:11 [Jonas De Kinder] [reply
bij de link die opgenomen werd in het document zien we dat er een buiten het CI valt, dit is niet het geval bij de nieuwe-juiste berekening. Grote verschillen zijn er echter niet op te merken.

Post a new message
Dataseries X:
5014
6153
6441
5584
6427
6062
5589
6216
5809
4989
6706
7174
6122
8075
6292
6337
8576
6077
5931
6288
7167
6054
6468
6401
6927
7914
7728
8699
8522
6481
7502
7778
7424
6941
8574
9169
7701
9035
7158
8195
8124
7073
7017
7390
7776
6197
6889
7087
6485
7654
6501
6313
7826
6589
6729
5684
8105
6391
5901
6758




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24

\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 & 'Sir Ronald Aylmer Fisher' @ 193.190.124.24 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=33788&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]'Sir Ronald Aylmer Fisher' @ 193.190.124.24[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=33788&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=33788&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'Sir Ronald Aylmer Fisher' @ 193.190.124.24







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[48])
369169-------
377701-------
389035-------
397158-------
408195-------
418124-------
427073-------
437017-------
447390-------
457776-------
466197-------
476889-------
487087-------
4964856914.91385700.26458129.56310.24390.39060.10230.3906
5076547532.33746245.37378819.3010.42650.94470.01110.7512
5165017478.53346138.94418818.12270.07630.39870.68050.7166
5263138081.37826546.069616.69640.0120.97820.44230.8979
5378267495.02265873.3919116.65420.34460.92340.22360.6891
5465896664.35734971.04548357.66920.46520.08940.31810.3123
5567297175.35355378.048972.6670.31320.73870.56860.5384
5656847382.69295507.51859257.86730.03790.75280.4970.6214
5781057013.49155068.48498958.49810.13570.90980.22110.4705
5863916518.72834497.83398539.62280.45070.0620.62250.2908
5959017654.06535565.53459742.59610.050.88210.76360.7027
6067588082.96125931.367110234.55530.11370.97660.81790.8179

\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[48]) \tabularnewline
36 & 9169 & - & - & - & - & - & - & - \tabularnewline
37 & 7701 & - & - & - & - & - & - & - \tabularnewline
38 & 9035 & - & - & - & - & - & - & - \tabularnewline
39 & 7158 & - & - & - & - & - & - & - \tabularnewline
40 & 8195 & - & - & - & - & - & - & - \tabularnewline
41 & 8124 & - & - & - & - & - & - & - \tabularnewline
42 & 7073 & - & - & - & - & - & - & - \tabularnewline
43 & 7017 & - & - & - & - & - & - & - \tabularnewline
44 & 7390 & - & - & - & - & - & - & - \tabularnewline
45 & 7776 & - & - & - & - & - & - & - \tabularnewline
46 & 6197 & - & - & - & - & - & - & - \tabularnewline
47 & 6889 & - & - & - & - & - & - & - \tabularnewline
48 & 7087 & - & - & - & - & - & - & - \tabularnewline
49 & 6485 & 6914.9138 & 5700.2645 & 8129.5631 & 0.2439 & 0.3906 & 0.1023 & 0.3906 \tabularnewline
50 & 7654 & 7532.3374 & 6245.3737 & 8819.301 & 0.4265 & 0.9447 & 0.0111 & 0.7512 \tabularnewline
51 & 6501 & 7478.5334 & 6138.9441 & 8818.1227 & 0.0763 & 0.3987 & 0.6805 & 0.7166 \tabularnewline
52 & 6313 & 8081.3782 & 6546.06 & 9616.6964 & 0.012 & 0.9782 & 0.4423 & 0.8979 \tabularnewline
53 & 7826 & 7495.0226 & 5873.391 & 9116.6542 & 0.3446 & 0.9234 & 0.2236 & 0.6891 \tabularnewline
54 & 6589 & 6664.3573 & 4971.0454 & 8357.6692 & 0.4652 & 0.0894 & 0.3181 & 0.3123 \tabularnewline
55 & 6729 & 7175.3535 & 5378.04 & 8972.667 & 0.3132 & 0.7387 & 0.5686 & 0.5384 \tabularnewline
56 & 5684 & 7382.6929 & 5507.5185 & 9257.8673 & 0.0379 & 0.7528 & 0.497 & 0.6214 \tabularnewline
57 & 8105 & 7013.4915 & 5068.4849 & 8958.4981 & 0.1357 & 0.9098 & 0.2211 & 0.4705 \tabularnewline
58 & 6391 & 6518.7283 & 4497.8339 & 8539.6228 & 0.4507 & 0.062 & 0.6225 & 0.2908 \tabularnewline
59 & 5901 & 7654.0653 & 5565.5345 & 9742.5961 & 0.05 & 0.8821 & 0.7636 & 0.7027 \tabularnewline
60 & 6758 & 8082.9612 & 5931.3671 & 10234.5553 & 0.1137 & 0.9766 & 0.8179 & 0.8179 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=33788&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[48])[/C][/ROW]
[ROW][C]36[/C][C]9169[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]37[/C][C]7701[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]38[/C][C]9035[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]39[/C][C]7158[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]40[/C][C]8195[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]41[/C][C]8124[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]42[/C][C]7073[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]43[/C][C]7017[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]44[/C][C]7390[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]45[/C][C]7776[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]46[/C][C]6197[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]47[/C][C]6889[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]48[/C][C]7087[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]49[/C][C]6485[/C][C]6914.9138[/C][C]5700.2645[/C][C]8129.5631[/C][C]0.2439[/C][C]0.3906[/C][C]0.1023[/C][C]0.3906[/C][/ROW]
[ROW][C]50[/C][C]7654[/C][C]7532.3374[/C][C]6245.3737[/C][C]8819.301[/C][C]0.4265[/C][C]0.9447[/C][C]0.0111[/C][C]0.7512[/C][/ROW]
[ROW][C]51[/C][C]6501[/C][C]7478.5334[/C][C]6138.9441[/C][C]8818.1227[/C][C]0.0763[/C][C]0.3987[/C][C]0.6805[/C][C]0.7166[/C][/ROW]
[ROW][C]52[/C][C]6313[/C][C]8081.3782[/C][C]6546.06[/C][C]9616.6964[/C][C]0.012[/C][C]0.9782[/C][C]0.4423[/C][C]0.8979[/C][/ROW]
[ROW][C]53[/C][C]7826[/C][C]7495.0226[/C][C]5873.391[/C][C]9116.6542[/C][C]0.3446[/C][C]0.9234[/C][C]0.2236[/C][C]0.6891[/C][/ROW]
[ROW][C]54[/C][C]6589[/C][C]6664.3573[/C][C]4971.0454[/C][C]8357.6692[/C][C]0.4652[/C][C]0.0894[/C][C]0.3181[/C][C]0.3123[/C][/ROW]
[ROW][C]55[/C][C]6729[/C][C]7175.3535[/C][C]5378.04[/C][C]8972.667[/C][C]0.3132[/C][C]0.7387[/C][C]0.5686[/C][C]0.5384[/C][/ROW]
[ROW][C]56[/C][C]5684[/C][C]7382.6929[/C][C]5507.5185[/C][C]9257.8673[/C][C]0.0379[/C][C]0.7528[/C][C]0.497[/C][C]0.6214[/C][/ROW]
[ROW][C]57[/C][C]8105[/C][C]7013.4915[/C][C]5068.4849[/C][C]8958.4981[/C][C]0.1357[/C][C]0.9098[/C][C]0.2211[/C][C]0.4705[/C][/ROW]
[ROW][C]58[/C][C]6391[/C][C]6518.7283[/C][C]4497.8339[/C][C]8539.6228[/C][C]0.4507[/C][C]0.062[/C][C]0.6225[/C][C]0.2908[/C][/ROW]
[ROW][C]59[/C][C]5901[/C][C]7654.0653[/C][C]5565.5345[/C][C]9742.5961[/C][C]0.05[/C][C]0.8821[/C][C]0.7636[/C][C]0.7027[/C][/ROW]
[ROW][C]60[/C][C]6758[/C][C]8082.9612[/C][C]5931.3671[/C][C]10234.5553[/C][C]0.1137[/C][C]0.9766[/C][C]0.8179[/C][C]0.8179[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=33788&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=33788&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[48])
369169-------
377701-------
389035-------
397158-------
408195-------
418124-------
427073-------
437017-------
447390-------
457776-------
466197-------
476889-------
487087-------
4964856914.91385700.26458129.56310.24390.39060.10230.3906
5076547532.33746245.37378819.3010.42650.94470.01110.7512
5165017478.53346138.94418818.12270.07630.39870.68050.7166
5263138081.37826546.069616.69640.0120.97820.44230.8979
5378267495.02265873.3919116.65420.34460.92340.22360.6891
5465896664.35734971.04548357.66920.46520.08940.31810.3123
5567297175.35355378.048972.6670.31320.73870.56860.5384
5656847382.69295507.51859257.86730.03790.75280.4970.6214
5781057013.49155068.48498958.49810.13570.90980.22110.4705
5863916518.72834497.83398539.62280.45070.0620.62250.2908
5959017654.06535565.53459742.59610.050.88210.76360.7027
6067588082.96125931.367110234.55530.11370.97660.81790.8179







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPESq.EMSERMSE
490.0896-0.06220.0052184825.87515402.1562124.1054
500.08720.01620.001314801.79571233.48335.121
510.0914-0.13070.0109955571.525779630.9605282.1896
520.0969-0.21880.01823127161.6108260596.8009510.4868
530.11040.04420.0037109546.06719128.838995.545
540.1296-0.01139e-045678.7249473.227121.7538
550.1278-0.06220.0052199231.428616602.619128.8512
560.1296-0.23010.01922885557.5386240463.1282490.3704
570.14150.15560.0131191390.79299282.566315.0914
580.1582-0.01960.001616314.53111359.544336.872
590.1392-0.2290.01913073237.9171256103.1598506.0664
600.1358-0.16390.01371755522.1988146293.5166382.4834

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & Sq.E & MSE & RMSE \tabularnewline
49 & 0.0896 & -0.0622 & 0.0052 & 184825.875 & 15402.1562 & 124.1054 \tabularnewline
50 & 0.0872 & 0.0162 & 0.0013 & 14801.7957 & 1233.483 & 35.121 \tabularnewline
51 & 0.0914 & -0.1307 & 0.0109 & 955571.5257 & 79630.9605 & 282.1896 \tabularnewline
52 & 0.0969 & -0.2188 & 0.0182 & 3127161.6108 & 260596.8009 & 510.4868 \tabularnewline
53 & 0.1104 & 0.0442 & 0.0037 & 109546.0671 & 9128.8389 & 95.545 \tabularnewline
54 & 0.1296 & -0.0113 & 9e-04 & 5678.7249 & 473.2271 & 21.7538 \tabularnewline
55 & 0.1278 & -0.0622 & 0.0052 & 199231.4286 & 16602.619 & 128.8512 \tabularnewline
56 & 0.1296 & -0.2301 & 0.0192 & 2885557.5386 & 240463.1282 & 490.3704 \tabularnewline
57 & 0.1415 & 0.1556 & 0.013 & 1191390.792 & 99282.566 & 315.0914 \tabularnewline
58 & 0.1582 & -0.0196 & 0.0016 & 16314.5311 & 1359.5443 & 36.872 \tabularnewline
59 & 0.1392 & -0.229 & 0.0191 & 3073237.9171 & 256103.1598 & 506.0664 \tabularnewline
60 & 0.1358 & -0.1639 & 0.0137 & 1755522.1988 & 146293.5166 & 382.4834 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=33788&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]49[/C][C]0.0896[/C][C]-0.0622[/C][C]0.0052[/C][C]184825.875[/C][C]15402.1562[/C][C]124.1054[/C][/ROW]
[ROW][C]50[/C][C]0.0872[/C][C]0.0162[/C][C]0.0013[/C][C]14801.7957[/C][C]1233.483[/C][C]35.121[/C][/ROW]
[ROW][C]51[/C][C]0.0914[/C][C]-0.1307[/C][C]0.0109[/C][C]955571.5257[/C][C]79630.9605[/C][C]282.1896[/C][/ROW]
[ROW][C]52[/C][C]0.0969[/C][C]-0.2188[/C][C]0.0182[/C][C]3127161.6108[/C][C]260596.8009[/C][C]510.4868[/C][/ROW]
[ROW][C]53[/C][C]0.1104[/C][C]0.0442[/C][C]0.0037[/C][C]109546.0671[/C][C]9128.8389[/C][C]95.545[/C][/ROW]
[ROW][C]54[/C][C]0.1296[/C][C]-0.0113[/C][C]9e-04[/C][C]5678.7249[/C][C]473.2271[/C][C]21.7538[/C][/ROW]
[ROW][C]55[/C][C]0.1278[/C][C]-0.0622[/C][C]0.0052[/C][C]199231.4286[/C][C]16602.619[/C][C]128.8512[/C][/ROW]
[ROW][C]56[/C][C]0.1296[/C][C]-0.2301[/C][C]0.0192[/C][C]2885557.5386[/C][C]240463.1282[/C][C]490.3704[/C][/ROW]
[ROW][C]57[/C][C]0.1415[/C][C]0.1556[/C][C]0.013[/C][C]1191390.792[/C][C]99282.566[/C][C]315.0914[/C][/ROW]
[ROW][C]58[/C][C]0.1582[/C][C]-0.0196[/C][C]0.0016[/C][C]16314.5311[/C][C]1359.5443[/C][C]36.872[/C][/ROW]
[ROW][C]59[/C][C]0.1392[/C][C]-0.229[/C][C]0.0191[/C][C]3073237.9171[/C][C]256103.1598[/C][C]506.0664[/C][/ROW]
[ROW][C]60[/C][C]0.1358[/C][C]-0.1639[/C][C]0.0137[/C][C]1755522.1988[/C][C]146293.5166[/C][C]382.4834[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=33788&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=33788&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
490.0896-0.06220.0052184825.87515402.1562124.1054
500.08720.01620.001314801.79571233.48335.121
510.0914-0.13070.0109955571.525779630.9605282.1896
520.0969-0.21880.01823127161.6108260596.8009510.4868
530.11040.04420.0037109546.06719128.838995.545
540.1296-0.01139e-045678.7249473.227121.7538
550.1278-0.06220.0052199231.428616602.619128.8512
560.1296-0.23010.01922885557.5386240463.1282490.3704
570.14150.15560.0131191390.79299282.566315.0914
580.1582-0.01960.001616314.53111359.544336.872
590.1392-0.2290.01913073237.9171256103.1598506.0664
600.1358-0.16390.01371755522.1988146293.5166382.4834



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