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 computationThu, 22 Dec 2016 22:28:10 +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/2016/Dec/22/t1482442265p23jkdgqhq7knjw.htm/, Retrieved Sun, 28 Apr 2024 21:16:18 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=302695, Retrieved Sun, 28 Apr 2024 21:16:18 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact54
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Forecasting] [] [2016-12-22 21:28:10] [037fdaa34a77b5f63489b3bcd360a80c] [Current]
Feedback Forum

Post a new message
Dataseries X:
3455
3585
3675
3680
3735
3860
3765
3905
4110
4170
4110
4025
4145
4285
4370
4355
4385
4525
4375
4525
4610
4595
4500
4370
4390
4530
4590
4580
4595
4685
4490
4635
4710
4655
4665
4550
4590
4675
4645
4665
4635
4720
4565
4720
4830
4830
4765
4705
4675
4900
4945
4905
4955
5120
4860
5040
5140
5240
5145
5070
5085
5215
5255
5275
5315
5450
5205
5370
5500
5490
5440
5360
5380
5460
5450
5520
5475
5600
5250
5465
5515
5425
5325
5275
5160
5360
5435
5285
5415
5575
5265
5480
5565
5500
5280
5135
5050
5100
5070
5115
5140
5330
5080
5285
5405
5385
5255
5100
5040
5235
5310
5265
5380
5465
5225
5445




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302695&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 time2 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[104])
925480-------
935565-------
945500-------
955280-------
965135-------
975050-------
985100-------
995070-------
1005115-------
1015140-------
1025330-------
1035080-------
1045285-------
10554055400.59965298.64155500.66810.46570.98826e-040.9882
10653855364.25995228.78235496.39930.37920.27280.0220.8801
10752555238.01655062.80215407.55660.42220.04460.31370.2935
10851005147.9544920.99065365.3250.33270.16720.54650.1083
10950405099.86834833.84975352.68250.32130.49960.65050.0756
11052355201.56654904.29395482.74460.40790.870.76050.2804
11153105208.82764875.70075521.89390.26320.43490.80760.3167
11252655216.38454851.70385557.1850.38990.29520.72010.3466
11353805240.57044846.33965607.15160.2280.4480.70460.4061
11454655401.35224990.95485782.69670.37180.54370.64310.7251
11552255092.12394625.55845519.38950.27110.04360.52220.1881
11654455307.69044835.10925741.50460.26750.64560.54080.5408

\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[104]) \tabularnewline
92 & 5480 & - & - & - & - & - & - & - \tabularnewline
93 & 5565 & - & - & - & - & - & - & - \tabularnewline
94 & 5500 & - & - & - & - & - & - & - \tabularnewline
95 & 5280 & - & - & - & - & - & - & - \tabularnewline
96 & 5135 & - & - & - & - & - & - & - \tabularnewline
97 & 5050 & - & - & - & - & - & - & - \tabularnewline
98 & 5100 & - & - & - & - & - & - & - \tabularnewline
99 & 5070 & - & - & - & - & - & - & - \tabularnewline
100 & 5115 & - & - & - & - & - & - & - \tabularnewline
101 & 5140 & - & - & - & - & - & - & - \tabularnewline
102 & 5330 & - & - & - & - & - & - & - \tabularnewline
103 & 5080 & - & - & - & - & - & - & - \tabularnewline
104 & 5285 & - & - & - & - & - & - & - \tabularnewline
105 & 5405 & 5400.5996 & 5298.6415 & 5500.6681 & 0.4657 & 0.9882 & 6e-04 & 0.9882 \tabularnewline
106 & 5385 & 5364.2599 & 5228.7823 & 5496.3993 & 0.3792 & 0.2728 & 0.022 & 0.8801 \tabularnewline
107 & 5255 & 5238.0165 & 5062.8021 & 5407.5566 & 0.4222 & 0.0446 & 0.3137 & 0.2935 \tabularnewline
108 & 5100 & 5147.954 & 4920.9906 & 5365.325 & 0.3327 & 0.1672 & 0.5465 & 0.1083 \tabularnewline
109 & 5040 & 5099.8683 & 4833.8497 & 5352.6825 & 0.3213 & 0.4996 & 0.6505 & 0.0756 \tabularnewline
110 & 5235 & 5201.5665 & 4904.2939 & 5482.7446 & 0.4079 & 0.87 & 0.7605 & 0.2804 \tabularnewline
111 & 5310 & 5208.8276 & 4875.7007 & 5521.8939 & 0.2632 & 0.4349 & 0.8076 & 0.3167 \tabularnewline
112 & 5265 & 5216.3845 & 4851.7038 & 5557.185 & 0.3899 & 0.2952 & 0.7201 & 0.3466 \tabularnewline
113 & 5380 & 5240.5704 & 4846.3396 & 5607.1516 & 0.228 & 0.448 & 0.7046 & 0.4061 \tabularnewline
114 & 5465 & 5401.3522 & 4990.9548 & 5782.6967 & 0.3718 & 0.5437 & 0.6431 & 0.7251 \tabularnewline
115 & 5225 & 5092.1239 & 4625.5584 & 5519.3895 & 0.2711 & 0.0436 & 0.5222 & 0.1881 \tabularnewline
116 & 5445 & 5307.6904 & 4835.1092 & 5741.5046 & 0.2675 & 0.6456 & 0.5408 & 0.5408 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302695&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[104])[/C][/ROW]
[ROW][C]92[/C][C]5480[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]93[/C][C]5565[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]94[/C][C]5500[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]95[/C][C]5280[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]96[/C][C]5135[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]97[/C][C]5050[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]98[/C][C]5100[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]99[/C][C]5070[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]100[/C][C]5115[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]101[/C][C]5140[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]102[/C][C]5330[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]103[/C][C]5080[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]104[/C][C]5285[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]105[/C][C]5405[/C][C]5400.5996[/C][C]5298.6415[/C][C]5500.6681[/C][C]0.4657[/C][C]0.9882[/C][C]6e-04[/C][C]0.9882[/C][/ROW]
[ROW][C]106[/C][C]5385[/C][C]5364.2599[/C][C]5228.7823[/C][C]5496.3993[/C][C]0.3792[/C][C]0.2728[/C][C]0.022[/C][C]0.8801[/C][/ROW]
[ROW][C]107[/C][C]5255[/C][C]5238.0165[/C][C]5062.8021[/C][C]5407.5566[/C][C]0.4222[/C][C]0.0446[/C][C]0.3137[/C][C]0.2935[/C][/ROW]
[ROW][C]108[/C][C]5100[/C][C]5147.954[/C][C]4920.9906[/C][C]5365.325[/C][C]0.3327[/C][C]0.1672[/C][C]0.5465[/C][C]0.1083[/C][/ROW]
[ROW][C]109[/C][C]5040[/C][C]5099.8683[/C][C]4833.8497[/C][C]5352.6825[/C][C]0.3213[/C][C]0.4996[/C][C]0.6505[/C][C]0.0756[/C][/ROW]
[ROW][C]110[/C][C]5235[/C][C]5201.5665[/C][C]4904.2939[/C][C]5482.7446[/C][C]0.4079[/C][C]0.87[/C][C]0.7605[/C][C]0.2804[/C][/ROW]
[ROW][C]111[/C][C]5310[/C][C]5208.8276[/C][C]4875.7007[/C][C]5521.8939[/C][C]0.2632[/C][C]0.4349[/C][C]0.8076[/C][C]0.3167[/C][/ROW]
[ROW][C]112[/C][C]5265[/C][C]5216.3845[/C][C]4851.7038[/C][C]5557.185[/C][C]0.3899[/C][C]0.2952[/C][C]0.7201[/C][C]0.3466[/C][/ROW]
[ROW][C]113[/C][C]5380[/C][C]5240.5704[/C][C]4846.3396[/C][C]5607.1516[/C][C]0.228[/C][C]0.448[/C][C]0.7046[/C][C]0.4061[/C][/ROW]
[ROW][C]114[/C][C]5465[/C][C]5401.3522[/C][C]4990.9548[/C][C]5782.6967[/C][C]0.3718[/C][C]0.5437[/C][C]0.6431[/C][C]0.7251[/C][/ROW]
[ROW][C]115[/C][C]5225[/C][C]5092.1239[/C][C]4625.5584[/C][C]5519.3895[/C][C]0.2711[/C][C]0.0436[/C][C]0.5222[/C][C]0.1881[/C][/ROW]
[ROW][C]116[/C][C]5445[/C][C]5307.6904[/C][C]4835.1092[/C][C]5741.5046[/C][C]0.2675[/C][C]0.6456[/C][C]0.5408[/C][C]0.5408[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302695&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302695&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[104])
925480-------
935565-------
945500-------
955280-------
965135-------
975050-------
985100-------
995070-------
1005115-------
1015140-------
1025330-------
1035080-------
1045285-------
10554055400.59965298.64155500.66810.46570.98826e-040.9882
10653855364.25995228.78235496.39930.37920.27280.0220.8801
10752555238.01655062.80215407.55660.42220.04460.31370.2935
10851005147.9544920.99065365.3250.33270.16720.54650.1083
10950405099.86834833.84975352.68250.32130.49960.65050.0756
11052355201.56654904.29395482.74460.40790.870.76050.2804
11153105208.82764875.70075521.89390.26320.43490.80760.3167
11252655216.38454851.70385557.1850.38990.29520.72010.3466
11353805240.57044846.33965607.15160.2280.4480.70460.4061
11454655401.35224990.95485782.69670.37180.54370.64310.7251
11552255092.12394625.55845519.38950.27110.04360.52220.1881
11654455307.69044835.10925741.50460.26750.64560.54080.5408







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPEsMAPESq.EMSERMSEScaledEMASE
1050.00958e-048e-048e-0419.3639000.03610.0361
1060.01260.00390.00230.0023430.1504224.757214.99190.17030.1032
1070.01650.00320.00260.0026288.4393245.984515.68390.13940.1153
1080.0215-0.00940.00430.00432299.5881759.385427.5569-0.39370.1849
1090.0253-0.01190.00580.00583584.20751324.349836.3916-0.49150.2462
1100.02760.00640.00590.00591117.80141289.925135.91550.27450.2509
1110.03070.01910.00780.007810235.8612567.91650.67460.83050.3337
1120.03330.00920.0080.0082363.46782542.359950.42180.39910.3419
1130.03570.02590.010.0119440.61074419.943466.48271.14460.4311
1140.0360.01160.01010.01024051.04734383.053866.20460.52250.4402
1150.04280.02540.01150.011617656.06095589.690874.76421.09080.4993
1160.04170.02520.01270.012818853.91926695.043181.82321.12720.5517

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & sMAPE & Sq.E & MSE & RMSE & ScaledE & MASE \tabularnewline
105 & 0.0095 & 8e-04 & 8e-04 & 8e-04 & 19.3639 & 0 & 0 & 0.0361 & 0.0361 \tabularnewline
106 & 0.0126 & 0.0039 & 0.0023 & 0.0023 & 430.1504 & 224.7572 & 14.9919 & 0.1703 & 0.1032 \tabularnewline
107 & 0.0165 & 0.0032 & 0.0026 & 0.0026 & 288.4393 & 245.9845 & 15.6839 & 0.1394 & 0.1153 \tabularnewline
108 & 0.0215 & -0.0094 & 0.0043 & 0.0043 & 2299.5881 & 759.3854 & 27.5569 & -0.3937 & 0.1849 \tabularnewline
109 & 0.0253 & -0.0119 & 0.0058 & 0.0058 & 3584.2075 & 1324.3498 & 36.3916 & -0.4915 & 0.2462 \tabularnewline
110 & 0.0276 & 0.0064 & 0.0059 & 0.0059 & 1117.8014 & 1289.9251 & 35.9155 & 0.2745 & 0.2509 \tabularnewline
111 & 0.0307 & 0.0191 & 0.0078 & 0.0078 & 10235.861 & 2567.916 & 50.6746 & 0.8305 & 0.3337 \tabularnewline
112 & 0.0333 & 0.0092 & 0.008 & 0.008 & 2363.4678 & 2542.3599 & 50.4218 & 0.3991 & 0.3419 \tabularnewline
113 & 0.0357 & 0.0259 & 0.01 & 0.01 & 19440.6107 & 4419.9434 & 66.4827 & 1.1446 & 0.4311 \tabularnewline
114 & 0.036 & 0.0116 & 0.0101 & 0.0102 & 4051.0473 & 4383.0538 & 66.2046 & 0.5225 & 0.4402 \tabularnewline
115 & 0.0428 & 0.0254 & 0.0115 & 0.0116 & 17656.0609 & 5589.6908 & 74.7642 & 1.0908 & 0.4993 \tabularnewline
116 & 0.0417 & 0.0252 & 0.0127 & 0.0128 & 18853.9192 & 6695.0431 & 81.8232 & 1.1272 & 0.5517 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302695&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]105[/C][C]0.0095[/C][C]8e-04[/C][C]8e-04[/C][C]8e-04[/C][C]19.3639[/C][C]0[/C][C]0[/C][C]0.0361[/C][C]0.0361[/C][/ROW]
[ROW][C]106[/C][C]0.0126[/C][C]0.0039[/C][C]0.0023[/C][C]0.0023[/C][C]430.1504[/C][C]224.7572[/C][C]14.9919[/C][C]0.1703[/C][C]0.1032[/C][/ROW]
[ROW][C]107[/C][C]0.0165[/C][C]0.0032[/C][C]0.0026[/C][C]0.0026[/C][C]288.4393[/C][C]245.9845[/C][C]15.6839[/C][C]0.1394[/C][C]0.1153[/C][/ROW]
[ROW][C]108[/C][C]0.0215[/C][C]-0.0094[/C][C]0.0043[/C][C]0.0043[/C][C]2299.5881[/C][C]759.3854[/C][C]27.5569[/C][C]-0.3937[/C][C]0.1849[/C][/ROW]
[ROW][C]109[/C][C]0.0253[/C][C]-0.0119[/C][C]0.0058[/C][C]0.0058[/C][C]3584.2075[/C][C]1324.3498[/C][C]36.3916[/C][C]-0.4915[/C][C]0.2462[/C][/ROW]
[ROW][C]110[/C][C]0.0276[/C][C]0.0064[/C][C]0.0059[/C][C]0.0059[/C][C]1117.8014[/C][C]1289.9251[/C][C]35.9155[/C][C]0.2745[/C][C]0.2509[/C][/ROW]
[ROW][C]111[/C][C]0.0307[/C][C]0.0191[/C][C]0.0078[/C][C]0.0078[/C][C]10235.861[/C][C]2567.916[/C][C]50.6746[/C][C]0.8305[/C][C]0.3337[/C][/ROW]
[ROW][C]112[/C][C]0.0333[/C][C]0.0092[/C][C]0.008[/C][C]0.008[/C][C]2363.4678[/C][C]2542.3599[/C][C]50.4218[/C][C]0.3991[/C][C]0.3419[/C][/ROW]
[ROW][C]113[/C][C]0.0357[/C][C]0.0259[/C][C]0.01[/C][C]0.01[/C][C]19440.6107[/C][C]4419.9434[/C][C]66.4827[/C][C]1.1446[/C][C]0.4311[/C][/ROW]
[ROW][C]114[/C][C]0.036[/C][C]0.0116[/C][C]0.0101[/C][C]0.0102[/C][C]4051.0473[/C][C]4383.0538[/C][C]66.2046[/C][C]0.5225[/C][C]0.4402[/C][/ROW]
[ROW][C]115[/C][C]0.0428[/C][C]0.0254[/C][C]0.0115[/C][C]0.0116[/C][C]17656.0609[/C][C]5589.6908[/C][C]74.7642[/C][C]1.0908[/C][C]0.4993[/C][/ROW]
[ROW][C]116[/C][C]0.0417[/C][C]0.0252[/C][C]0.0127[/C][C]0.0128[/C][C]18853.9192[/C][C]6695.0431[/C][C]81.8232[/C][C]1.1272[/C][C]0.5517[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302695&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302695&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
1050.00958e-048e-048e-0419.3639000.03610.0361
1060.01260.00390.00230.0023430.1504224.757214.99190.17030.1032
1070.01650.00320.00260.0026288.4393245.984515.68390.13940.1153
1080.0215-0.00940.00430.00432299.5881759.385427.5569-0.39370.1849
1090.0253-0.01190.00580.00583584.20751324.349836.3916-0.49150.2462
1100.02760.00640.00590.00591117.80141289.925135.91550.27450.2509
1110.03070.01910.00780.007810235.8612567.91650.67460.83050.3337
1120.03330.00920.0080.0082363.46782542.359950.42180.39910.3419
1130.03570.02590.010.0119440.61074419.943466.48271.14460.4311
1140.0360.01160.01010.01024051.04734383.053866.20460.52250.4402
1150.04280.02540.01150.011617656.06095589.690874.76421.09080.4993
1160.04170.02520.01270.012818853.91926695.043181.82321.12720.5517



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