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, 20 Dec 2013 11:19:45 -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/20/t1387556397b3zv7ytd1p3705c.htm/, Retrieved Sat, 20 Apr 2024 13:27:25 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=232470, Retrieved Sat, 20 Apr 2024 13:27:25 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact147
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [] [2013-12-20 16:19:45] [9e6a405f514733ea23d87e4507d39d29] [Current]
Feedback Forum

Post a new message
Dataseries X:
56
55
54
52
72
71
56
46
47
47
48
50
44
38
33
33
52
54
39
22
31
31
38
42
41
31
36
34
51
47
31
19
30
33
36
40
32
25
28
29
55
55
40
38
44
41
49
59
61
47
43
39
66
68
63
68
67
59
68
78
82
70
62
68
94
102
100
104
103
93
110
114
120
102
95
103
122
139
135
135
137
130
148
148
145
128
131
133
146
163
151
157
152
149
172
167
160
150
160
165
171
179
171
176
170
169
194
196
188
174
186
191
197
206
197
204
201
190
213
213




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 seconds
R Server'Gertrude Mary Cox' @ cox.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 & 2 seconds \tabularnewline
R Server & 'Gertrude Mary Cox' @ cox.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=232470&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]2 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gertrude Mary Cox' @ cox.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=232470&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=232470&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 time2 seconds
R Server'Gertrude Mary Cox' @ cox.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[108])
96167-------
97160-------
98150-------
99160-------
100165-------
101171-------
102179-------
103171-------
104176-------
105170-------
106169-------
107194-------
108196-------
109188189178.7601199.23990.42410.090110.0901
110174179164.5186193.48140.24930.111610.0107
111186189171.264206.7360.37010.95130.99930.2196
112191194173.5202214.47980.3870.77810.99720.4241
113197200177.1029222.89710.39870.77950.99350.634
114206208182.9175233.08250.43790.8050.98830.8258
115197200172.9078227.09220.41410.33210.9820.6139
116204205176.0372233.96280.4730.70590.97510.7288
117201199168.2803229.71970.44920.37490.96790.5759
118190198165.6186230.38140.31410.4280.96040.5482
119213223189.0381256.96190.28190.97160.95290.9404
120213225189.528260.4720.25360.74640.94550.9455

\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[108]) \tabularnewline
96 & 167 & - & - & - & - & - & - & - \tabularnewline
97 & 160 & - & - & - & - & - & - & - \tabularnewline
98 & 150 & - & - & - & - & - & - & - \tabularnewline
99 & 160 & - & - & - & - & - & - & - \tabularnewline
100 & 165 & - & - & - & - & - & - & - \tabularnewline
101 & 171 & - & - & - & - & - & - & - \tabularnewline
102 & 179 & - & - & - & - & - & - & - \tabularnewline
103 & 171 & - & - & - & - & - & - & - \tabularnewline
104 & 176 & - & - & - & - & - & - & - \tabularnewline
105 & 170 & - & - & - & - & - & - & - \tabularnewline
106 & 169 & - & - & - & - & - & - & - \tabularnewline
107 & 194 & - & - & - & - & - & - & - \tabularnewline
108 & 196 & - & - & - & - & - & - & - \tabularnewline
109 & 188 & 189 & 178.7601 & 199.2399 & 0.4241 & 0.0901 & 1 & 0.0901 \tabularnewline
110 & 174 & 179 & 164.5186 & 193.4814 & 0.2493 & 0.1116 & 1 & 0.0107 \tabularnewline
111 & 186 & 189 & 171.264 & 206.736 & 0.3701 & 0.9513 & 0.9993 & 0.2196 \tabularnewline
112 & 191 & 194 & 173.5202 & 214.4798 & 0.387 & 0.7781 & 0.9972 & 0.4241 \tabularnewline
113 & 197 & 200 & 177.1029 & 222.8971 & 0.3987 & 0.7795 & 0.9935 & 0.634 \tabularnewline
114 & 206 & 208 & 182.9175 & 233.0825 & 0.4379 & 0.805 & 0.9883 & 0.8258 \tabularnewline
115 & 197 & 200 & 172.9078 & 227.0922 & 0.4141 & 0.3321 & 0.982 & 0.6139 \tabularnewline
116 & 204 & 205 & 176.0372 & 233.9628 & 0.473 & 0.7059 & 0.9751 & 0.7288 \tabularnewline
117 & 201 & 199 & 168.2803 & 229.7197 & 0.4492 & 0.3749 & 0.9679 & 0.5759 \tabularnewline
118 & 190 & 198 & 165.6186 & 230.3814 & 0.3141 & 0.428 & 0.9604 & 0.5482 \tabularnewline
119 & 213 & 223 & 189.0381 & 256.9619 & 0.2819 & 0.9716 & 0.9529 & 0.9404 \tabularnewline
120 & 213 & 225 & 189.528 & 260.472 & 0.2536 & 0.7464 & 0.9455 & 0.9455 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=232470&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[108])[/C][/ROW]
[ROW][C]96[/C][C]167[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]97[/C][C]160[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]98[/C][C]150[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]99[/C][C]160[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]100[/C][C]165[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]101[/C][C]171[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]102[/C][C]179[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]103[/C][C]171[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]104[/C][C]176[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]105[/C][C]170[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]106[/C][C]169[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]107[/C][C]194[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]108[/C][C]196[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]109[/C][C]188[/C][C]189[/C][C]178.7601[/C][C]199.2399[/C][C]0.4241[/C][C]0.0901[/C][C]1[/C][C]0.0901[/C][/ROW]
[ROW][C]110[/C][C]174[/C][C]179[/C][C]164.5186[/C][C]193.4814[/C][C]0.2493[/C][C]0.1116[/C][C]1[/C][C]0.0107[/C][/ROW]
[ROW][C]111[/C][C]186[/C][C]189[/C][C]171.264[/C][C]206.736[/C][C]0.3701[/C][C]0.9513[/C][C]0.9993[/C][C]0.2196[/C][/ROW]
[ROW][C]112[/C][C]191[/C][C]194[/C][C]173.5202[/C][C]214.4798[/C][C]0.387[/C][C]0.7781[/C][C]0.9972[/C][C]0.4241[/C][/ROW]
[ROW][C]113[/C][C]197[/C][C]200[/C][C]177.1029[/C][C]222.8971[/C][C]0.3987[/C][C]0.7795[/C][C]0.9935[/C][C]0.634[/C][/ROW]
[ROW][C]114[/C][C]206[/C][C]208[/C][C]182.9175[/C][C]233.0825[/C][C]0.4379[/C][C]0.805[/C][C]0.9883[/C][C]0.8258[/C][/ROW]
[ROW][C]115[/C][C]197[/C][C]200[/C][C]172.9078[/C][C]227.0922[/C][C]0.4141[/C][C]0.3321[/C][C]0.982[/C][C]0.6139[/C][/ROW]
[ROW][C]116[/C][C]204[/C][C]205[/C][C]176.0372[/C][C]233.9628[/C][C]0.473[/C][C]0.7059[/C][C]0.9751[/C][C]0.7288[/C][/ROW]
[ROW][C]117[/C][C]201[/C][C]199[/C][C]168.2803[/C][C]229.7197[/C][C]0.4492[/C][C]0.3749[/C][C]0.9679[/C][C]0.5759[/C][/ROW]
[ROW][C]118[/C][C]190[/C][C]198[/C][C]165.6186[/C][C]230.3814[/C][C]0.3141[/C][C]0.428[/C][C]0.9604[/C][C]0.5482[/C][/ROW]
[ROW][C]119[/C][C]213[/C][C]223[/C][C]189.0381[/C][C]256.9619[/C][C]0.2819[/C][C]0.9716[/C][C]0.9529[/C][C]0.9404[/C][/ROW]
[ROW][C]120[/C][C]213[/C][C]225[/C][C]189.528[/C][C]260.472[/C][C]0.2536[/C][C]0.7464[/C][C]0.9455[/C][C]0.9455[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=232470&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=232470&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[108])
96167-------
97160-------
98150-------
99160-------
100165-------
101171-------
102179-------
103171-------
104176-------
105170-------
106169-------
107194-------
108196-------
109188189178.7601199.23990.42410.090110.0901
110174179164.5186193.48140.24930.111610.0107
111186189171.264206.7360.37010.95130.99930.2196
112191194173.5202214.47980.3870.77810.99720.4241
113197200177.1029222.89710.39870.77950.99350.634
114206208182.9175233.08250.43790.8050.98830.8258
115197200172.9078227.09220.41410.33210.9820.6139
116204205176.0372233.96280.4730.70590.97510.7288
117201199168.2803229.71970.44920.37490.96790.5759
118190198165.6186230.38140.31410.4280.96040.5482
119213223189.0381256.96190.28190.97160.95290.9404
120213225189.528260.4720.25360.74640.94550.9455







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
1090.0276-0.00530.00530.0053100-0.11110.1111
1100.0413-0.02870.0170.016825133.6056-0.55560.3333
1110.0479-0.01610.01670.0165911.66673.4157-0.33330.3333
1120.0539-0.01570.01650.01639113.3166-0.33330.3333
1130.0584-0.01520.01620.0161910.63.2558-0.33330.3333
1140.0615-0.00970.01510.01549.53.0822-0.22220.3148
1150.0691-0.01520.01520.01599.42863.0706-0.33330.3175
1160.0721-0.00490.01390.013718.3752.894-0.11110.2917
1170.07880.010.01340.013347.88892.80870.22220.284
1180.0834-0.04210.01630.01616413.53.6742-0.88890.3444
1190.0777-0.04690.01910.018810021.36364.6221-1.11110.4141
1200.0804-0.05630.02220.021814431.58335.6199-1.33330.4907

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
109 & 0.0276 & -0.0053 & 0.0053 & 0.0053 & 1 & 0 & 0 & -0.1111 & 0.1111 \tabularnewline
110 & 0.0413 & -0.0287 & 0.017 & 0.0168 & 25 & 13 & 3.6056 & -0.5556 & 0.3333 \tabularnewline
111 & 0.0479 & -0.0161 & 0.0167 & 0.0165 & 9 & 11.6667 & 3.4157 & -0.3333 & 0.3333 \tabularnewline
112 & 0.0539 & -0.0157 & 0.0165 & 0.0163 & 9 & 11 & 3.3166 & -0.3333 & 0.3333 \tabularnewline
113 & 0.0584 & -0.0152 & 0.0162 & 0.0161 & 9 & 10.6 & 3.2558 & -0.3333 & 0.3333 \tabularnewline
114 & 0.0615 & -0.0097 & 0.0151 & 0.015 & 4 & 9.5 & 3.0822 & -0.2222 & 0.3148 \tabularnewline
115 & 0.0691 & -0.0152 & 0.0152 & 0.015 & 9 & 9.4286 & 3.0706 & -0.3333 & 0.3175 \tabularnewline
116 & 0.0721 & -0.0049 & 0.0139 & 0.0137 & 1 & 8.375 & 2.894 & -0.1111 & 0.2917 \tabularnewline
117 & 0.0788 & 0.01 & 0.0134 & 0.0133 & 4 & 7.8889 & 2.8087 & 0.2222 & 0.284 \tabularnewline
118 & 0.0834 & -0.0421 & 0.0163 & 0.0161 & 64 & 13.5 & 3.6742 & -0.8889 & 0.3444 \tabularnewline
119 & 0.0777 & -0.0469 & 0.0191 & 0.0188 & 100 & 21.3636 & 4.6221 & -1.1111 & 0.4141 \tabularnewline
120 & 0.0804 & -0.0563 & 0.0222 & 0.0218 & 144 & 31.5833 & 5.6199 & -1.3333 & 0.4907 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=232470&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]109[/C][C]0.0276[/C][C]-0.0053[/C][C]0.0053[/C][C]0.0053[/C][C]1[/C][C]0[/C][C]0[/C][C]-0.1111[/C][C]0.1111[/C][/ROW]
[ROW][C]110[/C][C]0.0413[/C][C]-0.0287[/C][C]0.017[/C][C]0.0168[/C][C]25[/C][C]13[/C][C]3.6056[/C][C]-0.5556[/C][C]0.3333[/C][/ROW]
[ROW][C]111[/C][C]0.0479[/C][C]-0.0161[/C][C]0.0167[/C][C]0.0165[/C][C]9[/C][C]11.6667[/C][C]3.4157[/C][C]-0.3333[/C][C]0.3333[/C][/ROW]
[ROW][C]112[/C][C]0.0539[/C][C]-0.0157[/C][C]0.0165[/C][C]0.0163[/C][C]9[/C][C]11[/C][C]3.3166[/C][C]-0.3333[/C][C]0.3333[/C][/ROW]
[ROW][C]113[/C][C]0.0584[/C][C]-0.0152[/C][C]0.0162[/C][C]0.0161[/C][C]9[/C][C]10.6[/C][C]3.2558[/C][C]-0.3333[/C][C]0.3333[/C][/ROW]
[ROW][C]114[/C][C]0.0615[/C][C]-0.0097[/C][C]0.0151[/C][C]0.015[/C][C]4[/C][C]9.5[/C][C]3.0822[/C][C]-0.2222[/C][C]0.3148[/C][/ROW]
[ROW][C]115[/C][C]0.0691[/C][C]-0.0152[/C][C]0.0152[/C][C]0.015[/C][C]9[/C][C]9.4286[/C][C]3.0706[/C][C]-0.3333[/C][C]0.3175[/C][/ROW]
[ROW][C]116[/C][C]0.0721[/C][C]-0.0049[/C][C]0.0139[/C][C]0.0137[/C][C]1[/C][C]8.375[/C][C]2.894[/C][C]-0.1111[/C][C]0.2917[/C][/ROW]
[ROW][C]117[/C][C]0.0788[/C][C]0.01[/C][C]0.0134[/C][C]0.0133[/C][C]4[/C][C]7.8889[/C][C]2.8087[/C][C]0.2222[/C][C]0.284[/C][/ROW]
[ROW][C]118[/C][C]0.0834[/C][C]-0.0421[/C][C]0.0163[/C][C]0.0161[/C][C]64[/C][C]13.5[/C][C]3.6742[/C][C]-0.8889[/C][C]0.3444[/C][/ROW]
[ROW][C]119[/C][C]0.0777[/C][C]-0.0469[/C][C]0.0191[/C][C]0.0188[/C][C]100[/C][C]21.3636[/C][C]4.6221[/C][C]-1.1111[/C][C]0.4141[/C][/ROW]
[ROW][C]120[/C][C]0.0804[/C][C]-0.0563[/C][C]0.0222[/C][C]0.0218[/C][C]144[/C][C]31.5833[/C][C]5.6199[/C][C]-1.3333[/C][C]0.4907[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=232470&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=232470&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
1090.0276-0.00530.00530.0053100-0.11110.1111
1100.0413-0.02870.0170.016825133.6056-0.55560.3333
1110.0479-0.01610.01670.0165911.66673.4157-0.33330.3333
1120.0539-0.01570.01650.01639113.3166-0.33330.3333
1130.0584-0.01520.01620.0161910.63.2558-0.33330.3333
1140.0615-0.00970.01510.01549.53.0822-0.22220.3148
1150.0691-0.01520.01520.01599.42863.0706-0.33330.3175
1160.0721-0.00490.01390.013718.3752.894-0.11110.2917
1170.07880.010.01340.013347.88892.80870.22220.284
1180.0834-0.04210.01630.01616413.53.6742-0.88890.3444
1190.0777-0.04690.01910.018810021.36364.6221-1.11110.4141
1200.0804-0.05630.02220.021814431.58335.6199-1.33330.4907



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