Free Statistics

of Irreproducible Research!

Author's title

Author*Unverified author*
R Software Modulerwasp_arimaforecasting.wasp
Title produced by softwareARIMA Forecasting
Date of computationTue, 16 Dec 2008 14:16:16 -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/16/t1229462212x1a1rq1xj4favms.htm/, Retrieved Wed, 15 May 2024 10:25:31 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=34212, Retrieved Wed, 15 May 2024 10:25:31 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact193
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
F     [ARIMA Forecasting] [hfdst 21 arima fo...] [2008-12-15 08:32:33] [11edab5c4db3615abbf782b1c6e7cacf]
-   PD  [ARIMA Forecasting] [Gilliam Schoorel] [2008-12-15 20:58:10] [74be16979710d4c4e7c6647856088456]
F   P     [ARIMA Forecasting] [Gilliam Schoorel] [2008-12-16 11:15:34] [74be16979710d4c4e7c6647856088456]
F             [ARIMA Forecasting] [Toon Wouters] [2008-12-16 21:16:16] [14e94996a4178d938cb12bed20a4a373] [Current]
F R             [ARIMA Forecasting] [Sören Van Donink] [2008-12-17 07:03:17] [74be16979710d4c4e7c6647856088456]
F R             [ARIMA Forecasting] [Sören Van Donink] [2008-12-17 07:04:55] [74be16979710d4c4e7c6647856088456]
- R             [ARIMA Forecasting] [Sören Van Donink] [2008-12-17 07:06:42] [74be16979710d4c4e7c6647856088456]
- R             [ARIMA Forecasting] [Sören Van Donink] [2008-12-17 07:08:22] [74be16979710d4c4e7c6647856088456]
Feedback Forum
2008-12-18 10:24:09 [72e979bcc364082694890d2eccc1a66f] [reply
Voor stap 1 moet er enkel gebruik gemaakt worden van de eerste grafiek, deze waarbij de laatste 12 voorspelde maanden grijs worden gekleurd. We kunnen hier opmerken dat de lijn van de voorspelde waarden in het betrouwbaarheidsinterval ligt en dat er dus geen sprake is van explosiviteit. Wanneer er geen explosieve voorspelling is, dan is het AR proces stabiel en zijn de MA processen omkeerbaar.

In stap 2 moet je beide grafieken gebruiken. Wanneer je in de verleden waarden een duidelijk patroon ziet dat herhaald wordt in de voorspelde waarden (bepaalde pieken) dan zou dit een indicatie kunnen zijn van seizoenaliteit.
Wanneer je eerst een stijging, daarna redelijk gelijklopend en daarna een daling kan tekenen door de verleden waarden en de voorspelde waarden zetten deze trend verder, dan zou je kunnen spreken van een conjunctuurcyclus.

Voor stap 3 moet je gebruik maken van de 2e tabel met %SE en PE. Hier moet je kijken of PE kleiner is dan %SE. Dit is hier bijna altijd zo, behalve bij de eerste waarneming. Daar vinden we dat PE groter is. Dit kan op 2 manieren verklaard worden. Wanneer de werkelijke fout groter is dan de standaardfout, zou dit misschien kunnen verklaard worden door het feit dat de werkelijke fout overschat is(door een outlier )of dat er iets exceptioneels gebeurd moet zijn.

Voor stap 4 moet je naar de laatste 3 kolommen kijken van de eerste tabel.Het model dat berekend wordt, gaat uit van een normaalverdeling. Alle residu’s moeten normaal verdeeld zijn. Dit kun je zien door te kijken naar de density plot, de QQ-plot,... van de residu’s die in de vorige workshop berekend zijn. Zo kun je zien of deze assumptie vervuld is. Wanneer dit niet het geval blijkt te zijn, zullen de p-waarde, de waarschijnlijkheden,... anders zijn omdat het model van een normaalverdeling uitgaat.

Stap 5 maakt gebruik van de eerste tabel, vooral de kolommen Y(t), F(t) en de p-value. Als de p-waarde groter is dan 5% (wat hier meestal zo is) wil dit zeggen dat het verschil tussen de voorspelde waarde en de werkelijke waarde niet significant is.

Post a new message
Dataseries X:
467
460
448
443
436
431
484
510
513
503
471
471
476
475
470
461
455
456
517
525
523
519
509
512
519
517
510
509
501
507
569
580
578
565
547
555
562
561
555
544
537
543
594
611
613
611
594
595
591
589
584
573
567
569
621
629
628
612
595
597
593
590
580
574
573
573
620
626
620
588
566
557
561
549
532
526
511
499
555
565
542
527
510
514




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 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 & 1 seconds \tabularnewline
R Server & 'George Udny Yule' @ 72.249.76.132 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=34212&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]1 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=34212&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=34212&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 time1 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[72])
60597-------
61593-------
62590-------
63580-------
64574-------
65573-------
66573-------
67620-------
68626-------
69620-------
70588-------
71566-------
72557-------
73561552.374540.1464564.60160.08340.229200.2292
74549549.1396529.5434568.73590.49440.117800.2159
75532540.9253515.5498566.30080.24530.26640.00130.1072
76526533.2544503.0769563.43190.31880.53250.00410.0615
77511529.6623495.322564.00260.14340.58280.00670.0593
78499531.1318493.0751569.18840.0490.85010.01550.0914
79555581.1707539.7282622.61330.10790.99990.03310.8735
80565589.6336545.0612634.20590.13940.93610.05490.9244
81542586.3034538.8069633.79980.03380.81030.08220.8867
82527564.0106513.7599614.26130.07440.80470.17470.6077
83510544.223491.3614597.08460.10220.73850.20970.3178
84514540.5629485.2134595.91230.17340.86040.28030.2803

\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[72]) \tabularnewline
60 & 597 & - & - & - & - & - & - & - \tabularnewline
61 & 593 & - & - & - & - & - & - & - \tabularnewline
62 & 590 & - & - & - & - & - & - & - \tabularnewline
63 & 580 & - & - & - & - & - & - & - \tabularnewline
64 & 574 & - & - & - & - & - & - & - \tabularnewline
65 & 573 & - & - & - & - & - & - & - \tabularnewline
66 & 573 & - & - & - & - & - & - & - \tabularnewline
67 & 620 & - & - & - & - & - & - & - \tabularnewline
68 & 626 & - & - & - & - & - & - & - \tabularnewline
69 & 620 & - & - & - & - & - & - & - \tabularnewline
70 & 588 & - & - & - & - & - & - & - \tabularnewline
71 & 566 & - & - & - & - & - & - & - \tabularnewline
72 & 557 & - & - & - & - & - & - & - \tabularnewline
73 & 561 & 552.374 & 540.1464 & 564.6016 & 0.0834 & 0.2292 & 0 & 0.2292 \tabularnewline
74 & 549 & 549.1396 & 529.5434 & 568.7359 & 0.4944 & 0.1178 & 0 & 0.2159 \tabularnewline
75 & 532 & 540.9253 & 515.5498 & 566.3008 & 0.2453 & 0.2664 & 0.0013 & 0.1072 \tabularnewline
76 & 526 & 533.2544 & 503.0769 & 563.4319 & 0.3188 & 0.5325 & 0.0041 & 0.0615 \tabularnewline
77 & 511 & 529.6623 & 495.322 & 564.0026 & 0.1434 & 0.5828 & 0.0067 & 0.0593 \tabularnewline
78 & 499 & 531.1318 & 493.0751 & 569.1884 & 0.049 & 0.8501 & 0.0155 & 0.0914 \tabularnewline
79 & 555 & 581.1707 & 539.7282 & 622.6133 & 0.1079 & 0.9999 & 0.0331 & 0.8735 \tabularnewline
80 & 565 & 589.6336 & 545.0612 & 634.2059 & 0.1394 & 0.9361 & 0.0549 & 0.9244 \tabularnewline
81 & 542 & 586.3034 & 538.8069 & 633.7998 & 0.0338 & 0.8103 & 0.0822 & 0.8867 \tabularnewline
82 & 527 & 564.0106 & 513.7599 & 614.2613 & 0.0744 & 0.8047 & 0.1747 & 0.6077 \tabularnewline
83 & 510 & 544.223 & 491.3614 & 597.0846 & 0.1022 & 0.7385 & 0.2097 & 0.3178 \tabularnewline
84 & 514 & 540.5629 & 485.2134 & 595.9123 & 0.1734 & 0.8604 & 0.2803 & 0.2803 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=34212&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[72])[/C][/ROW]
[ROW][C]60[/C][C]597[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]61[/C][C]593[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]62[/C][C]590[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]63[/C][C]580[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]64[/C][C]574[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]65[/C][C]573[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]66[/C][C]573[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]67[/C][C]620[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]68[/C][C]626[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]69[/C][C]620[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]70[/C][C]588[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]71[/C][C]566[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]72[/C][C]557[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][C]-[/C][/ROW]
[ROW][C]73[/C][C]561[/C][C]552.374[/C][C]540.1464[/C][C]564.6016[/C][C]0.0834[/C][C]0.2292[/C][C]0[/C][C]0.2292[/C][/ROW]
[ROW][C]74[/C][C]549[/C][C]549.1396[/C][C]529.5434[/C][C]568.7359[/C][C]0.4944[/C][C]0.1178[/C][C]0[/C][C]0.2159[/C][/ROW]
[ROW][C]75[/C][C]532[/C][C]540.9253[/C][C]515.5498[/C][C]566.3008[/C][C]0.2453[/C][C]0.2664[/C][C]0.0013[/C][C]0.1072[/C][/ROW]
[ROW][C]76[/C][C]526[/C][C]533.2544[/C][C]503.0769[/C][C]563.4319[/C][C]0.3188[/C][C]0.5325[/C][C]0.0041[/C][C]0.0615[/C][/ROW]
[ROW][C]77[/C][C]511[/C][C]529.6623[/C][C]495.322[/C][C]564.0026[/C][C]0.1434[/C][C]0.5828[/C][C]0.0067[/C][C]0.0593[/C][/ROW]
[ROW][C]78[/C][C]499[/C][C]531.1318[/C][C]493.0751[/C][C]569.1884[/C][C]0.049[/C][C]0.8501[/C][C]0.0155[/C][C]0.0914[/C][/ROW]
[ROW][C]79[/C][C]555[/C][C]581.1707[/C][C]539.7282[/C][C]622.6133[/C][C]0.1079[/C][C]0.9999[/C][C]0.0331[/C][C]0.8735[/C][/ROW]
[ROW][C]80[/C][C]565[/C][C]589.6336[/C][C]545.0612[/C][C]634.2059[/C][C]0.1394[/C][C]0.9361[/C][C]0.0549[/C][C]0.9244[/C][/ROW]
[ROW][C]81[/C][C]542[/C][C]586.3034[/C][C]538.8069[/C][C]633.7998[/C][C]0.0338[/C][C]0.8103[/C][C]0.0822[/C][C]0.8867[/C][/ROW]
[ROW][C]82[/C][C]527[/C][C]564.0106[/C][C]513.7599[/C][C]614.2613[/C][C]0.0744[/C][C]0.8047[/C][C]0.1747[/C][C]0.6077[/C][/ROW]
[ROW][C]83[/C][C]510[/C][C]544.223[/C][C]491.3614[/C][C]597.0846[/C][C]0.1022[/C][C]0.7385[/C][C]0.2097[/C][C]0.3178[/C][/ROW]
[ROW][C]84[/C][C]514[/C][C]540.5629[/C][C]485.2134[/C][C]595.9123[/C][C]0.1734[/C][C]0.8604[/C][C]0.2803[/C][C]0.2803[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=34212&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=34212&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[72])
60597-------
61593-------
62590-------
63580-------
64574-------
65573-------
66573-------
67620-------
68626-------
69620-------
70588-------
71566-------
72557-------
73561552.374540.1464564.60160.08340.229200.2292
74549549.1396529.5434568.73590.49440.117800.2159
75532540.9253515.5498566.30080.24530.26640.00130.1072
76526533.2544503.0769563.43190.31880.53250.00410.0615
77511529.6623495.322564.00260.14340.58280.00670.0593
78499531.1318493.0751569.18840.0490.85010.01550.0914
79555581.1707539.7282622.61330.10790.99990.03310.8735
80565589.6336545.0612634.20590.13940.93610.05490.9244
81542586.3034538.8069633.79980.03380.81030.08220.8867
82527564.0106513.7599614.26130.07440.80470.17470.6077
83510544.223491.3614597.08460.10220.73850.20970.3178
84514540.5629485.2134595.91230.17340.86040.28030.2803







Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPESq.EMSERMSE
730.01130.01560.001374.40766.20062.4901
740.0182-3e-0400.01950.00160.0403
750.0239-0.01650.001479.66086.63842.5765
760.0289-0.01360.001152.62634.38552.0942
770.0331-0.03520.0029348.281629.02355.3873
780.0366-0.06050.0051032.451686.03769.2756
790.0364-0.0450.0038684.907457.07567.5548
800.0386-0.04180.0035606.813850.56787.1111
810.0413-0.07560.00631962.787163.565612.7893
820.0455-0.06560.00551369.7831114.148610.684
830.0496-0.06290.00521171.213597.60119.8793
840.0522-0.04910.0041705.585758.79887.668

\begin{tabular}{lllllllll}
\hline
Univariate ARIMA Extrapolation Forecast Performance \tabularnewline
time & % S.E. & PE & MAPE & Sq.E & MSE & RMSE \tabularnewline
73 & 0.0113 & 0.0156 & 0.0013 & 74.4076 & 6.2006 & 2.4901 \tabularnewline
74 & 0.0182 & -3e-04 & 0 & 0.0195 & 0.0016 & 0.0403 \tabularnewline
75 & 0.0239 & -0.0165 & 0.0014 & 79.6608 & 6.6384 & 2.5765 \tabularnewline
76 & 0.0289 & -0.0136 & 0.0011 & 52.6263 & 4.3855 & 2.0942 \tabularnewline
77 & 0.0331 & -0.0352 & 0.0029 & 348.2816 & 29.0235 & 5.3873 \tabularnewline
78 & 0.0366 & -0.0605 & 0.005 & 1032.4516 & 86.0376 & 9.2756 \tabularnewline
79 & 0.0364 & -0.045 & 0.0038 & 684.9074 & 57.0756 & 7.5548 \tabularnewline
80 & 0.0386 & -0.0418 & 0.0035 & 606.8138 & 50.5678 & 7.1111 \tabularnewline
81 & 0.0413 & -0.0756 & 0.0063 & 1962.787 & 163.5656 & 12.7893 \tabularnewline
82 & 0.0455 & -0.0656 & 0.0055 & 1369.7831 & 114.1486 & 10.684 \tabularnewline
83 & 0.0496 & -0.0629 & 0.0052 & 1171.2135 & 97.6011 & 9.8793 \tabularnewline
84 & 0.0522 & -0.0491 & 0.0041 & 705.5857 & 58.7988 & 7.668 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=34212&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]73[/C][C]0.0113[/C][C]0.0156[/C][C]0.0013[/C][C]74.4076[/C][C]6.2006[/C][C]2.4901[/C][/ROW]
[ROW][C]74[/C][C]0.0182[/C][C]-3e-04[/C][C]0[/C][C]0.0195[/C][C]0.0016[/C][C]0.0403[/C][/ROW]
[ROW][C]75[/C][C]0.0239[/C][C]-0.0165[/C][C]0.0014[/C][C]79.6608[/C][C]6.6384[/C][C]2.5765[/C][/ROW]
[ROW][C]76[/C][C]0.0289[/C][C]-0.0136[/C][C]0.0011[/C][C]52.6263[/C][C]4.3855[/C][C]2.0942[/C][/ROW]
[ROW][C]77[/C][C]0.0331[/C][C]-0.0352[/C][C]0.0029[/C][C]348.2816[/C][C]29.0235[/C][C]5.3873[/C][/ROW]
[ROW][C]78[/C][C]0.0366[/C][C]-0.0605[/C][C]0.005[/C][C]1032.4516[/C][C]86.0376[/C][C]9.2756[/C][/ROW]
[ROW][C]79[/C][C]0.0364[/C][C]-0.045[/C][C]0.0038[/C][C]684.9074[/C][C]57.0756[/C][C]7.5548[/C][/ROW]
[ROW][C]80[/C][C]0.0386[/C][C]-0.0418[/C][C]0.0035[/C][C]606.8138[/C][C]50.5678[/C][C]7.1111[/C][/ROW]
[ROW][C]81[/C][C]0.0413[/C][C]-0.0756[/C][C]0.0063[/C][C]1962.787[/C][C]163.5656[/C][C]12.7893[/C][/ROW]
[ROW][C]82[/C][C]0.0455[/C][C]-0.0656[/C][C]0.0055[/C][C]1369.7831[/C][C]114.1486[/C][C]10.684[/C][/ROW]
[ROW][C]83[/C][C]0.0496[/C][C]-0.0629[/C][C]0.0052[/C][C]1171.2135[/C][C]97.6011[/C][C]9.8793[/C][/ROW]
[ROW][C]84[/C][C]0.0522[/C][C]-0.0491[/C][C]0.0041[/C][C]705.5857[/C][C]58.7988[/C][C]7.668[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=34212&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=34212&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
730.01130.01560.001374.40766.20062.4901
740.0182-3e-0400.01950.00160.0403
750.0239-0.01650.001479.66086.63842.5765
760.0289-0.01360.001152.62634.38552.0942
770.0331-0.03520.0029348.281629.02355.3873
780.0366-0.06050.0051032.451686.03769.2756
790.0364-0.0450.0038684.907457.07567.5548
800.0386-0.04180.0035606.813850.56787.1111
810.0413-0.07560.00631962.787163.565612.7893
820.0455-0.06560.00551369.7831114.148610.684
830.0496-0.06290.00521171.213597.60119.8793
840.0522-0.04910.0041705.585758.79887.668



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