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 computationSun, 15 Dec 2013 08:22:02 -0500
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2013/Dec/15/t1387113806sxu6hj007prbnrd.htm/, Retrieved Fri, 29 Mar 2024 00:29:33 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=232352, Retrieved Fri, 29 Mar 2024 00:29:33 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact167
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Univariate Data Series] [] [2008-12-08 19:22:39] [d2d412c7f4d35ffbf5ee5ee89db327d4]
- RMP   [ARIMA Backward Selection] [] [2011-12-06 19:59:13] [b98453cac15ba1066b407e146608df68]
- RMP     [ARIMA Forecasting] [] [2011-12-06 20:08:12] [b98453cac15ba1066b407e146608df68]
- R         [ARIMA Forecasting] [] [2013-11-22 17:39:30] [0307e7a6407eb638caabc417e3a6b260]
-   PD          [ARIMA Forecasting] [Wine sales - ARIM...] [2013-12-15 13:22:02] [e87fe8ad852a0fa5d933f43041f410cc] [Current]
Feedback Forum

Post a new message
Dataseries X:
1954
2302
3054
2414
2226
2725
2589
3470
2400
3180
4009
3924
2072
2434
2956
2828
2687
2629
3150
4119
3030
3055
3821
4001
2529
2472
3134
2789
2758
2993
3282
3437
2804
3076
3782
3889
2271
2452
3084
2522
2769
3438
2839
3746
2632
2851
3871
3618
2389
2344
2678
2492
2858
2246
2800
3869
3007
3023
3907
4209




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Server'Gwilym Jenkins' @ jenkins.wessa.net

\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 & 3 seconds \tabularnewline
R Server & 'Gwilym Jenkins' @ jenkins.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=232352&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]3 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gwilym Jenkins' @ jenkins.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=232352&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=232352&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 time3 seconds
R Server'Gwilym Jenkins' @ jenkins.wessa.net







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])
363889-------
372271-------
382452-------
393084-------
402522-------
412769-------
423438-------
432839-------
443746-------
452632-------
462851-------
473871-------
483618-------
4923892072.83591611.72822533.94370.089500.19980
5023442409.54221923.00612896.07840.39590.5330.43210
5126783004.61572515.2813493.95040.09540.99590.37530.007
5224922695.96812206.31733185.6190.20710.52870.75691e-04
5328582722.41742232.73073212.10410.29370.82180.4262e-04
5422462977.64642487.95573467.33720.00170.6840.03270.0052
5528003026.09562536.40443515.78680.18270.99910.7730.0089
5638693938.27853448.58734427.96980.390810.77920.9001
5730072856.45042366.75923346.14170.273400.81550.0012
5830232971.29792481.60673460.98920.4180.44320.68490.0048
5939073840.21323350.52194329.90440.39460.99950.4510.8131
6042093838.05343348.36224327.74470.06880.39130.81080.8108

\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 & 3889 & - & - & - & - & - & - & - \tabularnewline
37 & 2271 & - & - & - & - & - & - & - \tabularnewline
38 & 2452 & - & - & - & - & - & - & - \tabularnewline
39 & 3084 & - & - & - & - & - & - & - \tabularnewline
40 & 2522 & - & - & - & - & - & - & - \tabularnewline
41 & 2769 & - & - & - & - & - & - & - \tabularnewline
42 & 3438 & - & - & - & - & - & - & - \tabularnewline
43 & 2839 & - & - & - & - & - & - & - \tabularnewline
44 & 3746 & - & - & - & - & - & - & - \tabularnewline
45 & 2632 & - & - & - & - & - & - & - \tabularnewline
46 & 2851 & - & - & - & - & - & - & - \tabularnewline
47 & 3871 & - & - & - & - & - & - & - \tabularnewline
48 & 3618 & - & - & - & - & - & - & - \tabularnewline
49 & 2389 & 2072.8359 & 1611.7282 & 2533.9437 & 0.0895 & 0 & 0.1998 & 0 \tabularnewline
50 & 2344 & 2409.5422 & 1923.0061 & 2896.0784 & 0.3959 & 0.533 & 0.4321 & 0 \tabularnewline
51 & 2678 & 3004.6157 & 2515.281 & 3493.9504 & 0.0954 & 0.9959 & 0.3753 & 0.007 \tabularnewline
52 & 2492 & 2695.9681 & 2206.3173 & 3185.619 & 0.2071 & 0.5287 & 0.7569 & 1e-04 \tabularnewline
53 & 2858 & 2722.4174 & 2232.7307 & 3212.1041 & 0.2937 & 0.8218 & 0.426 & 2e-04 \tabularnewline
54 & 2246 & 2977.6464 & 2487.9557 & 3467.3372 & 0.0017 & 0.684 & 0.0327 & 0.0052 \tabularnewline
55 & 2800 & 3026.0956 & 2536.4044 & 3515.7868 & 0.1827 & 0.9991 & 0.773 & 0.0089 \tabularnewline
56 & 3869 & 3938.2785 & 3448.5873 & 4427.9698 & 0.3908 & 1 & 0.7792 & 0.9001 \tabularnewline
57 & 3007 & 2856.4504 & 2366.7592 & 3346.1417 & 0.2734 & 0 & 0.8155 & 0.0012 \tabularnewline
58 & 3023 & 2971.2979 & 2481.6067 & 3460.9892 & 0.418 & 0.4432 & 0.6849 & 0.0048 \tabularnewline
59 & 3907 & 3840.2132 & 3350.5219 & 4329.9044 & 0.3946 & 0.9995 & 0.451 & 0.8131 \tabularnewline
60 & 4209 & 3838.0534 & 3348.3622 & 4327.7447 & 0.0688 & 0.3913 & 0.8108 & 0.8108 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=232352&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]3889[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]37[/C][C]2271[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]38[/C][C]2452[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]39[/C][C]3084[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]40[/C][C]2522[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]41[/C][C]2769[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]42[/C][C]3438[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]43[/C][C]2839[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]44[/C][C]3746[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]45[/C][C]2632[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]46[/C][C]2851[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]47[/C][C]3871[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]48[/C][C]3618[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]49[/C][C]2389[/C][C]2072.8359[/C][C]1611.7282[/C][C]2533.9437[/C][C]0.0895[/C][C]0[/C][C]0.1998[/C][C]0[/C][/ROW]
[ROW][C]50[/C][C]2344[/C][C]2409.5422[/C][C]1923.0061[/C][C]2896.0784[/C][C]0.3959[/C][C]0.533[/C][C]0.4321[/C][C]0[/C][/ROW]
[ROW][C]51[/C][C]2678[/C][C]3004.6157[/C][C]2515.281[/C][C]3493.9504[/C][C]0.0954[/C][C]0.9959[/C][C]0.3753[/C][C]0.007[/C][/ROW]
[ROW][C]52[/C][C]2492[/C][C]2695.9681[/C][C]2206.3173[/C][C]3185.619[/C][C]0.2071[/C][C]0.5287[/C][C]0.7569[/C][C]1e-04[/C][/ROW]
[ROW][C]53[/C][C]2858[/C][C]2722.4174[/C][C]2232.7307[/C][C]3212.1041[/C][C]0.2937[/C][C]0.8218[/C][C]0.426[/C][C]2e-04[/C][/ROW]
[ROW][C]54[/C][C]2246[/C][C]2977.6464[/C][C]2487.9557[/C][C]3467.3372[/C][C]0.0017[/C][C]0.684[/C][C]0.0327[/C][C]0.0052[/C][/ROW]
[ROW][C]55[/C][C]2800[/C][C]3026.0956[/C][C]2536.4044[/C][C]3515.7868[/C][C]0.1827[/C][C]0.9991[/C][C]0.773[/C][C]0.0089[/C][/ROW]
[ROW][C]56[/C][C]3869[/C][C]3938.2785[/C][C]3448.5873[/C][C]4427.9698[/C][C]0.3908[/C][C]1[/C][C]0.7792[/C][C]0.9001[/C][/ROW]
[ROW][C]57[/C][C]3007[/C][C]2856.4504[/C][C]2366.7592[/C][C]3346.1417[/C][C]0.2734[/C][C]0[/C][C]0.8155[/C][C]0.0012[/C][/ROW]
[ROW][C]58[/C][C]3023[/C][C]2971.2979[/C][C]2481.6067[/C][C]3460.9892[/C][C]0.418[/C][C]0.4432[/C][C]0.6849[/C][C]0.0048[/C][/ROW]
[ROW][C]59[/C][C]3907[/C][C]3840.2132[/C][C]3350.5219[/C][C]4329.9044[/C][C]0.3946[/C][C]0.9995[/C][C]0.451[/C][C]0.8131[/C][/ROW]
[ROW][C]60[/C][C]4209[/C][C]3838.0534[/C][C]3348.3622[/C][C]4327.7447[/C][C]0.0688[/C][C]0.3913[/C][C]0.8108[/C][C]0.8108[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=232352&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=232352&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])
363889-------
372271-------
382452-------
393084-------
402522-------
412769-------
423438-------
432839-------
443746-------
452632-------
462851-------
473871-------
483618-------
4923892072.83591611.72822533.94370.089500.19980
5023442409.54221923.00612896.07840.39590.5330.43210
5126783004.61572515.2813493.95040.09540.99590.37530.007
5224922695.96812206.31733185.6190.20710.52870.75691e-04
5328582722.41742232.73073212.10410.29370.82180.4262e-04
5422462977.64642487.95573467.33720.00170.6840.03270.0052
5528003026.09562536.40443515.78680.18270.99910.7730.0089
5638693938.27853448.58734427.96980.390810.77920.9001
5730072856.45042366.75923346.14170.273400.81550.0012
5830232971.29792481.60673460.98920.4180.44320.68490.0048
5939073840.21323350.52194329.90440.39460.99950.4510.8131
6042093838.05343348.36224327.74470.06880.39130.81080.8108







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
490.11350.13230.13230.141799959.7071000.6650.665
500.103-0.0280.08020.08464295.781952127.7445228.315-0.13790.4014
510.0831-0.1220.09410.0947106677.827370311.1054265.1624-0.6870.4966
520.0927-0.08180.0910.090741602.999363134.0789251.265-0.4290.4797
530.09180.04740.08230.082318382.643254183.7917232.77410.28520.4408
540.0839-0.32580.12290.1153535306.511134370.9116366.5664-1.53880.6238
550.0826-0.08070.11690.109951119.2234122477.8133349.9683-0.47550.6026
560.0634-0.01790.10450.09844799.512107768.0256328.2804-0.14570.5455
570.08750.05010.09840.093122665.173398312.1532313.54770.31660.5201
580.08410.01710.09030.08562673.103788748.2482297.90640.10870.4789
590.06510.01710.08370.07934460.480381085.7239284.75560.14050.4482
600.06510.08810.0840.0804137601.378385795.3617292.90850.78020.4758

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
49 & 0.1135 & 0.1323 & 0.1323 & 0.1417 & 99959.7071 & 0 & 0 & 0.665 & 0.665 \tabularnewline
50 & 0.103 & -0.028 & 0.0802 & 0.0846 & 4295.7819 & 52127.7445 & 228.315 & -0.1379 & 0.4014 \tabularnewline
51 & 0.0831 & -0.122 & 0.0941 & 0.0947 & 106677.8273 & 70311.1054 & 265.1624 & -0.687 & 0.4966 \tabularnewline
52 & 0.0927 & -0.0818 & 0.091 & 0.0907 & 41602.9993 & 63134.0789 & 251.265 & -0.429 & 0.4797 \tabularnewline
53 & 0.0918 & 0.0474 & 0.0823 & 0.0823 & 18382.6432 & 54183.7917 & 232.7741 & 0.2852 & 0.4408 \tabularnewline
54 & 0.0839 & -0.3258 & 0.1229 & 0.1153 & 535306.511 & 134370.9116 & 366.5664 & -1.5388 & 0.6238 \tabularnewline
55 & 0.0826 & -0.0807 & 0.1169 & 0.1099 & 51119.2234 & 122477.8133 & 349.9683 & -0.4755 & 0.6026 \tabularnewline
56 & 0.0634 & -0.0179 & 0.1045 & 0.0984 & 4799.512 & 107768.0256 & 328.2804 & -0.1457 & 0.5455 \tabularnewline
57 & 0.0875 & 0.0501 & 0.0984 & 0.0931 & 22665.1733 & 98312.1532 & 313.5477 & 0.3166 & 0.5201 \tabularnewline
58 & 0.0841 & 0.0171 & 0.0903 & 0.0856 & 2673.1037 & 88748.2482 & 297.9064 & 0.1087 & 0.4789 \tabularnewline
59 & 0.0651 & 0.0171 & 0.0837 & 0.0793 & 4460.4803 & 81085.7239 & 284.7556 & 0.1405 & 0.4482 \tabularnewline
60 & 0.0651 & 0.0881 & 0.084 & 0.0804 & 137601.3783 & 85795.3617 & 292.9085 & 0.7802 & 0.4758 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=232352&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]49[/C][C]0.1135[/C][C]0.1323[/C][C]0.1323[/C][C]0.1417[/C][C]99959.7071[/C][C]0[/C][C]0[/C][C]0.665[/C][C]0.665[/C][/ROW]
[ROW][C]50[/C][C]0.103[/C][C]-0.028[/C][C]0.0802[/C][C]0.0846[/C][C]4295.7819[/C][C]52127.7445[/C][C]228.315[/C][C]-0.1379[/C][C]0.4014[/C][/ROW]
[ROW][C]51[/C][C]0.0831[/C][C]-0.122[/C][C]0.0941[/C][C]0.0947[/C][C]106677.8273[/C][C]70311.1054[/C][C]265.1624[/C][C]-0.687[/C][C]0.4966[/C][/ROW]
[ROW][C]52[/C][C]0.0927[/C][C]-0.0818[/C][C]0.091[/C][C]0.0907[/C][C]41602.9993[/C][C]63134.0789[/C][C]251.265[/C][C]-0.429[/C][C]0.4797[/C][/ROW]
[ROW][C]53[/C][C]0.0918[/C][C]0.0474[/C][C]0.0823[/C][C]0.0823[/C][C]18382.6432[/C][C]54183.7917[/C][C]232.7741[/C][C]0.2852[/C][C]0.4408[/C][/ROW]
[ROW][C]54[/C][C]0.0839[/C][C]-0.3258[/C][C]0.1229[/C][C]0.1153[/C][C]535306.511[/C][C]134370.9116[/C][C]366.5664[/C][C]-1.5388[/C][C]0.6238[/C][/ROW]
[ROW][C]55[/C][C]0.0826[/C][C]-0.0807[/C][C]0.1169[/C][C]0.1099[/C][C]51119.2234[/C][C]122477.8133[/C][C]349.9683[/C][C]-0.4755[/C][C]0.6026[/C][/ROW]
[ROW][C]56[/C][C]0.0634[/C][C]-0.0179[/C][C]0.1045[/C][C]0.0984[/C][C]4799.512[/C][C]107768.0256[/C][C]328.2804[/C][C]-0.1457[/C][C]0.5455[/C][/ROW]
[ROW][C]57[/C][C]0.0875[/C][C]0.0501[/C][C]0.0984[/C][C]0.0931[/C][C]22665.1733[/C][C]98312.1532[/C][C]313.5477[/C][C]0.3166[/C][C]0.5201[/C][/ROW]
[ROW][C]58[/C][C]0.0841[/C][C]0.0171[/C][C]0.0903[/C][C]0.0856[/C][C]2673.1037[/C][C]88748.2482[/C][C]297.9064[/C][C]0.1087[/C][C]0.4789[/C][/ROW]
[ROW][C]59[/C][C]0.0651[/C][C]0.0171[/C][C]0.0837[/C][C]0.0793[/C][C]4460.4803[/C][C]81085.7239[/C][C]284.7556[/C][C]0.1405[/C][C]0.4482[/C][/ROW]
[ROW][C]60[/C][C]0.0651[/C][C]0.0881[/C][C]0.084[/C][C]0.0804[/C][C]137601.3783[/C][C]85795.3617[/C][C]292.9085[/C][C]0.7802[/C][C]0.4758[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=232352&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=232352&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
490.11350.13230.13230.141799959.7071000.6650.665
500.103-0.0280.08020.08464295.781952127.7445228.315-0.13790.4014
510.0831-0.1220.09410.0947106677.827370311.1054265.1624-0.6870.4966
520.0927-0.08180.0910.090741602.999363134.0789251.265-0.4290.4797
530.09180.04740.08230.082318382.643254183.7917232.77410.28520.4408
540.0839-0.32580.12290.1153535306.511134370.9116366.5664-1.53880.6238
550.0826-0.08070.11690.109951119.2234122477.8133349.9683-0.47550.6026
560.0634-0.01790.10450.09844799.512107768.0256328.2804-0.14570.5455
570.08750.05010.09840.093122665.173398312.1532313.54770.31660.5201
580.08410.01710.09030.08562673.103788748.2482297.90640.10870.4789
590.06510.01710.08370.07934460.480381085.7239284.75560.14050.4482
600.06510.08810.0840.0804137601.378385795.3617292.90850.78020.4758



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