Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_arimabackwardselection.wasp
Title produced by softwareARIMA Backward Selection
Date of computationWed, 14 Dec 2016 15:25:24 +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/14/t1481726067vpm4ik79s5g8zuh.htm/, Retrieved Fri, 03 May 2024 18:50:33 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=299501, Retrieved Fri, 03 May 2024 18:50:33 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact78
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [ARIMA Backward Selection] [] [2016-12-14 14:25:24] [df90c754990be6fd2b18fcd529010a59] [Current]
Feedback Forum

Post a new message
Dataseries X:
2160
2660
3680
3380
3600
3940
3080
2680
2920
2660
2360
2440
2660
3000
4140
3580
3960
4280
3000
3620
4280
4500
4360
3840
4620
4700
5280
4700
5340
5200
3880
4920
4600
5360
4960
4060
4880
4980
5440
5320
5960
5460
3780
5220
5920
6060
5100
4400
5480
5240
5160
5620
5440
5460
4680
4940
5900
5580
4480
4600
5540
5800
6460
6100
6080
6080
4860
5740
5980
6660
5520
5360
5900
6360
7280
6220
6660
6860
4460
6360
6480
6800
6460
6060
6760
6860
7320
6680
7220
7160
4100
6560
5780
5500
5800
5300
4240
5620
7100
5960
7360
7420
4760
6040
5940
6720
4700
3100
3880
3540
4160
5260
6040
5800
4180
5120
5980
6940
5440
4360
4640
5540
6840
6340
6620
6680




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299501&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 time3 seconds
R ServerBig Analytics Cloud Computing Center







ARIMA Parameter Estimation and Backward Selection
Iterationar1ma1
Estimates ( 1 )0.886-0.3359
(p-val)(0 )(0.0011 )
Estimates ( 2 )0.74830
(p-val)(0 )(NA )
Estimates ( 3 )NANA
(p-val)(NA )(NA )

\begin{tabular}{lllllllll}
\hline
ARIMA Parameter Estimation and Backward Selection \tabularnewline
Iteration & ar1 & ma1 \tabularnewline
Estimates ( 1 ) & 0.886 & -0.3359 \tabularnewline
(p-val) & (0 ) & (0.0011 ) \tabularnewline
Estimates ( 2 ) & 0.7483 & 0 \tabularnewline
(p-val) & (0 ) & (NA ) \tabularnewline
Estimates ( 3 ) & NA & NA \tabularnewline
(p-val) & (NA ) & (NA ) \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=299501&T=1

[TABLE]
[ROW][C]ARIMA Parameter Estimation and Backward Selection[/C][/ROW]
[ROW][C]Iteration[/C][C]ar1[/C][C]ma1[/C][/ROW]
[ROW][C]Estimates ( 1 )[/C][C]0.886[/C][C]-0.3359[/C][/ROW]
[ROW][C](p-val)[/C][C](0 )[/C][C](0.0011 )[/C][/ROW]
[ROW][C]Estimates ( 2 )[/C][C]0.7483[/C][C]0[/C][/ROW]
[ROW][C](p-val)[/C][C](0 )[/C][C](NA )[/C][/ROW]
[ROW][C]Estimates ( 3 )[/C][C]NA[/C][C]NA[/C][/ROW]
[ROW][C](p-val)[/C][C](NA )[/C][C](NA )[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=299501&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299501&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

ARIMA Parameter Estimation and Backward Selection
Iterationar1ma1
Estimates ( 1 )0.886-0.3359
(p-val)(0 )(0.0011 )
Estimates ( 2 )0.74830
(p-val)(0 )(NA )
Estimates ( 3 )NANA
(p-val)(NA )(NA )







Estimated ARIMA Residuals
Value
0.00779965142803385
0.13413873191825
-0.0340475707267239
0.000132951388717006
-0.0468048016159802
0.0286601744968187
0.00795489067390989
-0.0969806941271865
0.291398076084313
0.213871131787248
0.258815296492914
0.23493627142718
-0.0114404822357292
0.146451559898902
0.00901590431433717
-0.151507044527352
0.00580827706065712
0.0597661720531644
-0.0501137887703482
0.0678821134025096
0.101739148991269
-0.165574863397206
0.0553867148248468
-0.00740970471503921
-0.0610124036303716
-0.0151027921408833
0.00428585869952869
-0.0199773817941065
0.0907508891572046
0.0305444337631808
-0.0382714064996055
-0.0821942450845494
0.054713860842277
0.218217861843671
-0.0274721820753054
-0.0901448603067578
0.0254803100695842
0.0532660008558405
-0.0339556150888427
-0.109337757142089
0.0649495004112115
-0.118078734230398
0.0412204350745533
0.227420144804608
-0.167965803994909
-0.0109577064636408
-0.0832034638819898
-0.0844528616884439
0.130923762876938
0.0154831524993835
0.0970893384934648
0.167344937991569
-0.0609070465848234
0.0181535569668974
0.0151088273974498
-0.0524781364412537
0.0990287574042057
-0.0862495963183605
0.136026540732688
0.0976874591490731
0.000766257322414532
-0.0722595708148894
0.0121182104273316
0.0419098903020387
-0.0723185135422089
0.0495627145583022
0.0566241068770328
-0.173811033305874
0.120283087163532
0.0298279735686844
-0.0403226032890736
0.125275614688396
0.0255028454474129
0.0358853205733904
-0.032824231257111
-0.0725972373372628
0.0421077350980639
0.0316658073314198
-0.0180917308863009
-0.128161509903705
0.0624790462064837
-0.120762214689648
-0.151455170534598
0.0293391373913963
-0.0286634097570904
-0.35736230679127
0.0938643419133225
0.177658845949926
-0.0273349727007641
0.111068151163718
0.0559617008564981
0.136455888454428
-0.168994345940547
0.0437108081863116
0.190830247809366
-0.323694540119766
-0.458714670430984
0.232349612434728
-0.305545831407089
-0.22770392122033
0.272207013137979
0.00447429981737457
-0.0696968602611374
0.0648905264134232
-0.0283301972295824
0.143604873524419
0.0745045765478416
0.142701846005858
0.259457305797781
-0.0361533218642638
0.277238426578977
0.193590938972141
-0.188803649862667
-0.137185051221023
0.013941566609919

\begin{tabular}{lllllllll}
\hline
Estimated ARIMA Residuals \tabularnewline
Value \tabularnewline
0.00779965142803385 \tabularnewline
0.13413873191825 \tabularnewline
-0.0340475707267239 \tabularnewline
0.000132951388717006 \tabularnewline
-0.0468048016159802 \tabularnewline
0.0286601744968187 \tabularnewline
0.00795489067390989 \tabularnewline
-0.0969806941271865 \tabularnewline
0.291398076084313 \tabularnewline
0.213871131787248 \tabularnewline
0.258815296492914 \tabularnewline
0.23493627142718 \tabularnewline
-0.0114404822357292 \tabularnewline
0.146451559898902 \tabularnewline
0.00901590431433717 \tabularnewline
-0.151507044527352 \tabularnewline
0.00580827706065712 \tabularnewline
0.0597661720531644 \tabularnewline
-0.0501137887703482 \tabularnewline
0.0678821134025096 \tabularnewline
0.101739148991269 \tabularnewline
-0.165574863397206 \tabularnewline
0.0553867148248468 \tabularnewline
-0.00740970471503921 \tabularnewline
-0.0610124036303716 \tabularnewline
-0.0151027921408833 \tabularnewline
0.00428585869952869 \tabularnewline
-0.0199773817941065 \tabularnewline
0.0907508891572046 \tabularnewline
0.0305444337631808 \tabularnewline
-0.0382714064996055 \tabularnewline
-0.0821942450845494 \tabularnewline
0.054713860842277 \tabularnewline
0.218217861843671 \tabularnewline
-0.0274721820753054 \tabularnewline
-0.0901448603067578 \tabularnewline
0.0254803100695842 \tabularnewline
0.0532660008558405 \tabularnewline
-0.0339556150888427 \tabularnewline
-0.109337757142089 \tabularnewline
0.0649495004112115 \tabularnewline
-0.118078734230398 \tabularnewline
0.0412204350745533 \tabularnewline
0.227420144804608 \tabularnewline
-0.167965803994909 \tabularnewline
-0.0109577064636408 \tabularnewline
-0.0832034638819898 \tabularnewline
-0.0844528616884439 \tabularnewline
0.130923762876938 \tabularnewline
0.0154831524993835 \tabularnewline
0.0970893384934648 \tabularnewline
0.167344937991569 \tabularnewline
-0.0609070465848234 \tabularnewline
0.0181535569668974 \tabularnewline
0.0151088273974498 \tabularnewline
-0.0524781364412537 \tabularnewline
0.0990287574042057 \tabularnewline
-0.0862495963183605 \tabularnewline
0.136026540732688 \tabularnewline
0.0976874591490731 \tabularnewline
0.000766257322414532 \tabularnewline
-0.0722595708148894 \tabularnewline
0.0121182104273316 \tabularnewline
0.0419098903020387 \tabularnewline
-0.0723185135422089 \tabularnewline
0.0495627145583022 \tabularnewline
0.0566241068770328 \tabularnewline
-0.173811033305874 \tabularnewline
0.120283087163532 \tabularnewline
0.0298279735686844 \tabularnewline
-0.0403226032890736 \tabularnewline
0.125275614688396 \tabularnewline
0.0255028454474129 \tabularnewline
0.0358853205733904 \tabularnewline
-0.032824231257111 \tabularnewline
-0.0725972373372628 \tabularnewline
0.0421077350980639 \tabularnewline
0.0316658073314198 \tabularnewline
-0.0180917308863009 \tabularnewline
-0.128161509903705 \tabularnewline
0.0624790462064837 \tabularnewline
-0.120762214689648 \tabularnewline
-0.151455170534598 \tabularnewline
0.0293391373913963 \tabularnewline
-0.0286634097570904 \tabularnewline
-0.35736230679127 \tabularnewline
0.0938643419133225 \tabularnewline
0.177658845949926 \tabularnewline
-0.0273349727007641 \tabularnewline
0.111068151163718 \tabularnewline
0.0559617008564981 \tabularnewline
0.136455888454428 \tabularnewline
-0.168994345940547 \tabularnewline
0.0437108081863116 \tabularnewline
0.190830247809366 \tabularnewline
-0.323694540119766 \tabularnewline
-0.458714670430984 \tabularnewline
0.232349612434728 \tabularnewline
-0.305545831407089 \tabularnewline
-0.22770392122033 \tabularnewline
0.272207013137979 \tabularnewline
0.00447429981737457 \tabularnewline
-0.0696968602611374 \tabularnewline
0.0648905264134232 \tabularnewline
-0.0283301972295824 \tabularnewline
0.143604873524419 \tabularnewline
0.0745045765478416 \tabularnewline
0.142701846005858 \tabularnewline
0.259457305797781 \tabularnewline
-0.0361533218642638 \tabularnewline
0.277238426578977 \tabularnewline
0.193590938972141 \tabularnewline
-0.188803649862667 \tabularnewline
-0.137185051221023 \tabularnewline
0.013941566609919 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=299501&T=2

[TABLE]
[ROW][C]Estimated ARIMA Residuals[/C][/ROW]
[ROW][C]Value[/C][/ROW]
[ROW][C]0.00779965142803385[/C][/ROW]
[ROW][C]0.13413873191825[/C][/ROW]
[ROW][C]-0.0340475707267239[/C][/ROW]
[ROW][C]0.000132951388717006[/C][/ROW]
[ROW][C]-0.0468048016159802[/C][/ROW]
[ROW][C]0.0286601744968187[/C][/ROW]
[ROW][C]0.00795489067390989[/C][/ROW]
[ROW][C]-0.0969806941271865[/C][/ROW]
[ROW][C]0.291398076084313[/C][/ROW]
[ROW][C]0.213871131787248[/C][/ROW]
[ROW][C]0.258815296492914[/C][/ROW]
[ROW][C]0.23493627142718[/C][/ROW]
[ROW][C]-0.0114404822357292[/C][/ROW]
[ROW][C]0.146451559898902[/C][/ROW]
[ROW][C]0.00901590431433717[/C][/ROW]
[ROW][C]-0.151507044527352[/C][/ROW]
[ROW][C]0.00580827706065712[/C][/ROW]
[ROW][C]0.0597661720531644[/C][/ROW]
[ROW][C]-0.0501137887703482[/C][/ROW]
[ROW][C]0.0678821134025096[/C][/ROW]
[ROW][C]0.101739148991269[/C][/ROW]
[ROW][C]-0.165574863397206[/C][/ROW]
[ROW][C]0.0553867148248468[/C][/ROW]
[ROW][C]-0.00740970471503921[/C][/ROW]
[ROW][C]-0.0610124036303716[/C][/ROW]
[ROW][C]-0.0151027921408833[/C][/ROW]
[ROW][C]0.00428585869952869[/C][/ROW]
[ROW][C]-0.0199773817941065[/C][/ROW]
[ROW][C]0.0907508891572046[/C][/ROW]
[ROW][C]0.0305444337631808[/C][/ROW]
[ROW][C]-0.0382714064996055[/C][/ROW]
[ROW][C]-0.0821942450845494[/C][/ROW]
[ROW][C]0.054713860842277[/C][/ROW]
[ROW][C]0.218217861843671[/C][/ROW]
[ROW][C]-0.0274721820753054[/C][/ROW]
[ROW][C]-0.0901448603067578[/C][/ROW]
[ROW][C]0.0254803100695842[/C][/ROW]
[ROW][C]0.0532660008558405[/C][/ROW]
[ROW][C]-0.0339556150888427[/C][/ROW]
[ROW][C]-0.109337757142089[/C][/ROW]
[ROW][C]0.0649495004112115[/C][/ROW]
[ROW][C]-0.118078734230398[/C][/ROW]
[ROW][C]0.0412204350745533[/C][/ROW]
[ROW][C]0.227420144804608[/C][/ROW]
[ROW][C]-0.167965803994909[/C][/ROW]
[ROW][C]-0.0109577064636408[/C][/ROW]
[ROW][C]-0.0832034638819898[/C][/ROW]
[ROW][C]-0.0844528616884439[/C][/ROW]
[ROW][C]0.130923762876938[/C][/ROW]
[ROW][C]0.0154831524993835[/C][/ROW]
[ROW][C]0.0970893384934648[/C][/ROW]
[ROW][C]0.167344937991569[/C][/ROW]
[ROW][C]-0.0609070465848234[/C][/ROW]
[ROW][C]0.0181535569668974[/C][/ROW]
[ROW][C]0.0151088273974498[/C][/ROW]
[ROW][C]-0.0524781364412537[/C][/ROW]
[ROW][C]0.0990287574042057[/C][/ROW]
[ROW][C]-0.0862495963183605[/C][/ROW]
[ROW][C]0.136026540732688[/C][/ROW]
[ROW][C]0.0976874591490731[/C][/ROW]
[ROW][C]0.000766257322414532[/C][/ROW]
[ROW][C]-0.0722595708148894[/C][/ROW]
[ROW][C]0.0121182104273316[/C][/ROW]
[ROW][C]0.0419098903020387[/C][/ROW]
[ROW][C]-0.0723185135422089[/C][/ROW]
[ROW][C]0.0495627145583022[/C][/ROW]
[ROW][C]0.0566241068770328[/C][/ROW]
[ROW][C]-0.173811033305874[/C][/ROW]
[ROW][C]0.120283087163532[/C][/ROW]
[ROW][C]0.0298279735686844[/C][/ROW]
[ROW][C]-0.0403226032890736[/C][/ROW]
[ROW][C]0.125275614688396[/C][/ROW]
[ROW][C]0.0255028454474129[/C][/ROW]
[ROW][C]0.0358853205733904[/C][/ROW]
[ROW][C]-0.032824231257111[/C][/ROW]
[ROW][C]-0.0725972373372628[/C][/ROW]
[ROW][C]0.0421077350980639[/C][/ROW]
[ROW][C]0.0316658073314198[/C][/ROW]
[ROW][C]-0.0180917308863009[/C][/ROW]
[ROW][C]-0.128161509903705[/C][/ROW]
[ROW][C]0.0624790462064837[/C][/ROW]
[ROW][C]-0.120762214689648[/C][/ROW]
[ROW][C]-0.151455170534598[/C][/ROW]
[ROW][C]0.0293391373913963[/C][/ROW]
[ROW][C]-0.0286634097570904[/C][/ROW]
[ROW][C]-0.35736230679127[/C][/ROW]
[ROW][C]0.0938643419133225[/C][/ROW]
[ROW][C]0.177658845949926[/C][/ROW]
[ROW][C]-0.0273349727007641[/C][/ROW]
[ROW][C]0.111068151163718[/C][/ROW]
[ROW][C]0.0559617008564981[/C][/ROW]
[ROW][C]0.136455888454428[/C][/ROW]
[ROW][C]-0.168994345940547[/C][/ROW]
[ROW][C]0.0437108081863116[/C][/ROW]
[ROW][C]0.190830247809366[/C][/ROW]
[ROW][C]-0.323694540119766[/C][/ROW]
[ROW][C]-0.458714670430984[/C][/ROW]
[ROW][C]0.232349612434728[/C][/ROW]
[ROW][C]-0.305545831407089[/C][/ROW]
[ROW][C]-0.22770392122033[/C][/ROW]
[ROW][C]0.272207013137979[/C][/ROW]
[ROW][C]0.00447429981737457[/C][/ROW]
[ROW][C]-0.0696968602611374[/C][/ROW]
[ROW][C]0.0648905264134232[/C][/ROW]
[ROW][C]-0.0283301972295824[/C][/ROW]
[ROW][C]0.143604873524419[/C][/ROW]
[ROW][C]0.0745045765478416[/C][/ROW]
[ROW][C]0.142701846005858[/C][/ROW]
[ROW][C]0.259457305797781[/C][/ROW]
[ROW][C]-0.0361533218642638[/C][/ROW]
[ROW][C]0.277238426578977[/C][/ROW]
[ROW][C]0.193590938972141[/C][/ROW]
[ROW][C]-0.188803649862667[/C][/ROW]
[ROW][C]-0.137185051221023[/C][/ROW]
[ROW][C]0.013941566609919[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=299501&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299501&T=2

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Estimated ARIMA Residuals
Value
0.00779965142803385
0.13413873191825
-0.0340475707267239
0.000132951388717006
-0.0468048016159802
0.0286601744968187
0.00795489067390989
-0.0969806941271865
0.291398076084313
0.213871131787248
0.258815296492914
0.23493627142718
-0.0114404822357292
0.146451559898902
0.00901590431433717
-0.151507044527352
0.00580827706065712
0.0597661720531644
-0.0501137887703482
0.0678821134025096
0.101739148991269
-0.165574863397206
0.0553867148248468
-0.00740970471503921
-0.0610124036303716
-0.0151027921408833
0.00428585869952869
-0.0199773817941065
0.0907508891572046
0.0305444337631808
-0.0382714064996055
-0.0821942450845494
0.054713860842277
0.218217861843671
-0.0274721820753054
-0.0901448603067578
0.0254803100695842
0.0532660008558405
-0.0339556150888427
-0.109337757142089
0.0649495004112115
-0.118078734230398
0.0412204350745533
0.227420144804608
-0.167965803994909
-0.0109577064636408
-0.0832034638819898
-0.0844528616884439
0.130923762876938
0.0154831524993835
0.0970893384934648
0.167344937991569
-0.0609070465848234
0.0181535569668974
0.0151088273974498
-0.0524781364412537
0.0990287574042057
-0.0862495963183605
0.136026540732688
0.0976874591490731
0.000766257322414532
-0.0722595708148894
0.0121182104273316
0.0419098903020387
-0.0723185135422089
0.0495627145583022
0.0566241068770328
-0.173811033305874
0.120283087163532
0.0298279735686844
-0.0403226032890736
0.125275614688396
0.0255028454474129
0.0358853205733904
-0.032824231257111
-0.0725972373372628
0.0421077350980639
0.0316658073314198
-0.0180917308863009
-0.128161509903705
0.0624790462064837
-0.120762214689648
-0.151455170534598
0.0293391373913963
-0.0286634097570904
-0.35736230679127
0.0938643419133225
0.177658845949926
-0.0273349727007641
0.111068151163718
0.0559617008564981
0.136455888454428
-0.168994345940547
0.0437108081863116
0.190830247809366
-0.323694540119766
-0.458714670430984
0.232349612434728
-0.305545831407089
-0.22770392122033
0.272207013137979
0.00447429981737457
-0.0696968602611374
0.0648905264134232
-0.0283301972295824
0.143604873524419
0.0745045765478416
0.142701846005858
0.259457305797781
-0.0361533218642638
0.277238426578977
0.193590938972141
-0.188803649862667
-0.137185051221023
0.013941566609919



Parameters (Session):
par1 = FALSE ; par2 = 0.0 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 1 ; par7 = 1 ; par8 = 0 ; par9 = 0 ;
Parameters (R input):
par1 = FALSE ; par2 = 0.0 ; par3 = 0 ; par4 = 1 ; par5 = 12 ; par6 = 1 ; par7 = 1 ; par8 = 0 ; par9 = 0 ;
R code (references can be found in the software module):
library(lattice)
if (par1 == 'TRUE') par1 <- TRUE
if (par1 == 'FALSE') par1 <- FALSE
par2 <- as.numeric(par2) #Box-Cox lambda transformation parameter
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) #degree (p) of the non-seasonal AR(p) polynomial
par7 <- as.numeric(par7) #degree (q) of the non-seasonal MA(q) polynomial
par8 <- as.numeric(par8) #degree (P) of the seasonal AR(P) polynomial
par9 <- as.numeric(par9) #degree (Q) of the seasonal MA(Q) polynomial
armaGR <- function(arima.out, names, n){
try1 <- arima.out$coef
try2 <- sqrt(diag(arima.out$var.coef))
try.data.frame <- data.frame(matrix(NA,ncol=4,nrow=length(names)))
dimnames(try.data.frame) <- list(names,c('coef','std','tstat','pv'))
try.data.frame[,1] <- try1
for(i in 1:length(try2)) try.data.frame[which(rownames(try.data.frame)==names(try2)[i]),2] <- try2[i]
try.data.frame[,3] <- try.data.frame[,1] / try.data.frame[,2]
try.data.frame[,4] <- round((1-pt(abs(try.data.frame[,3]),df=n-(length(try2)+1)))*2,5)
vector <- rep(NA,length(names))
vector[is.na(try.data.frame[,4])] <- 0
maxi <- which.max(try.data.frame[,4])
continue <- max(try.data.frame[,4],na.rm=TRUE) > .05
vector[maxi] <- 0
list(summary=try.data.frame,next.vector=vector,continue=continue)
}
arimaSelect <- function(series, order=c(13,0,0), seasonal=list(order=c(2,0,0),period=12), include.mean=F){
nrc <- order[1]+order[3]+seasonal$order[1]+seasonal$order[3]
coeff <- matrix(NA, nrow=nrc*2, ncol=nrc)
pval <- matrix(NA, nrow=nrc*2, ncol=nrc)
mylist <- rep(list(NULL), nrc)
names <- NULL
if(order[1] > 0) names <- paste('ar',1:order[1],sep='')
if(order[3] > 0) names <- c( names , paste('ma',1:order[3],sep='') )
if(seasonal$order[1] > 0) names <- c(names, paste('sar',1:seasonal$order[1],sep=''))
if(seasonal$order[3] > 0) names <- c(names, paste('sma',1:seasonal$order[3],sep=''))
arima.out <- arima(series, order=order, seasonal=seasonal, include.mean=include.mean, method='ML')
mylist[[1]] <- arima.out
last.arma <- armaGR(arima.out, names, length(series))
mystop <- FALSE
i <- 1
coeff[i,] <- last.arma[[1]][,1]
pval [i,] <- last.arma[[1]][,4]
i <- 2
aic <- arima.out$aic
while(!mystop){
mylist[[i]] <- arima.out
arima.out <- arima(series, order=order, seasonal=seasonal, include.mean=include.mean, method='ML', fixed=last.arma$next.vector)
aic <- c(aic, arima.out$aic)
last.arma <- armaGR(arima.out, names, length(series))
mystop <- !last.arma$continue
coeff[i,] <- last.arma[[1]][,1]
pval [i,] <- last.arma[[1]][,4]
i <- i+1
}
list(coeff, pval, mylist, aic=aic)
}
arimaSelectplot <- function(arimaSelect.out,noms,choix){
noms <- names(arimaSelect.out[[3]][[1]]$coef)
coeff <- arimaSelect.out[[1]]
k <- min(which(is.na(coeff[,1])))-1
coeff <- coeff[1:k,]
pval <- arimaSelect.out[[2]][1:k,]
aic <- arimaSelect.out$aic[1:k]
coeff[coeff==0] <- NA
n <- ncol(coeff)
if(missing(choix)) choix <- k
layout(matrix(c(1,1,1,2,
3,3,3,2,
3,3,3,4,
5,6,7,7),nr=4),
widths=c(10,35,45,15),
heights=c(30,30,15,15))
couleurs <- rainbow(75)[1:50]#(50)
ticks <- pretty(coeff)
par(mar=c(1,1,3,1))
plot(aic,k:1-.5,type='o',pch=21,bg='blue',cex=2,axes=F,lty=2,xpd=NA)
points(aic[choix],k-choix+.5,pch=21,cex=4,bg=2,xpd=NA)
title('aic',line=2)
par(mar=c(3,0,0,0))
plot(0,axes=F,xlab='',ylab='',xlim=range(ticks),ylim=c(.1,1))
rect(xleft = min(ticks) + (0:49)/50*(max(ticks)-min(ticks)),
xright = min(ticks) + (1:50)/50*(max(ticks)-min(ticks)),
ytop = rep(1,50),
ybottom= rep(0,50),col=couleurs,border=NA)
axis(1,ticks)
rect(xleft=min(ticks),xright=max(ticks),ytop=1,ybottom=0)
text(mean(coeff,na.rm=T),.5,'coefficients',cex=2,font=2)
par(mar=c(1,1,3,1))
image(1:n,1:k,t(coeff[k:1,]),axes=F,col=couleurs,zlim=range(ticks))
for(i in 1:n) for(j in 1:k) if(!is.na(coeff[j,i])) {
if(pval[j,i]<.01) symb = 'green'
else if( (pval[j,i]<.05) & (pval[j,i]>=.01)) symb = 'orange'
else if( (pval[j,i]<.1) & (pval[j,i]>=.05)) symb = 'red'
else symb = 'black'
polygon(c(i+.5 ,i+.2 ,i+.5 ,i+.5),
c(k-j+0.5,k-j+0.5,k-j+0.8,k-j+0.5),
col=symb)
if(j==choix) {
rect(xleft=i-.5,
xright=i+.5,
ybottom=k-j+1.5,
ytop=k-j+.5,
lwd=4)
text(i,
k-j+1,
round(coeff[j,i],2),
cex=1.2,
font=2)
}
else{
rect(xleft=i-.5,xright=i+.5,ybottom=k-j+1.5,ytop=k-j+.5)
text(i,k-j+1,round(coeff[j,i],2),cex=1.2,font=1)
}
}
axis(3,1:n,noms)
par(mar=c(0.5,0,0,0.5))
plot(0,axes=F,xlab='',ylab='',type='n',xlim=c(0,8),ylim=c(-.2,.8))
cols <- c('green','orange','red','black')
niv <- c('0','0.01','0.05','0.1')
for(i in 0:3){
polygon(c(1+2*i ,1+2*i ,1+2*i-.5 ,1+2*i),
c(.4 ,.7 , .4 , .4),
col=cols[i+1])
text(2*i,0.5,niv[i+1],cex=1.5)
}
text(8,.5,1,cex=1.5)
text(4,0,'p-value',cex=2)
box()
residus <- arimaSelect.out[[3]][[choix]]$res
par(mar=c(1,2,4,1))
acf(residus,main='')
title('acf',line=.5)
par(mar=c(1,2,4,1))
pacf(residus,main='')
title('pacf',line=.5)
par(mar=c(2,2,4,1))
qqnorm(residus,main='')
title('qq-norm',line=.5)
qqline(residus)
residus
}
if (par2 == 0) x <- log(x)
if (par2 != 0) x <- x^par2
(selection <- arimaSelect(x, order=c(par6,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5)))
bitmap(file='test1.png')
resid <- arimaSelectplot(selection)
dev.off()
resid
bitmap(file='test2.png')
acf(resid,length(resid)/2, main='Residual Autocorrelation Function')
dev.off()
bitmap(file='test3.png')
pacf(resid,length(resid)/2, main='Residual Partial Autocorrelation Function')
dev.off()
bitmap(file='test4.png')
cpgram(resid, main='Residual Cumulative Periodogram')
dev.off()
bitmap(file='test5.png')
hist(resid, main='Residual Histogram', xlab='values of Residuals')
dev.off()
bitmap(file='test6.png')
densityplot(~resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
dev.off()
bitmap(file='test7.png')
qqnorm(resid, main='Residual Normal Q-Q Plot')
qqline(resid)
dev.off()
ncols <- length(selection[[1]][1,])
nrows <- length(selection[[2]][,1])-1
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'ARIMA Parameter Estimation and Backward Selection', ncols+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Iteration', header=TRUE)
for (i in 1:ncols) {
a<-table.element(a,names(selection[[3]][[1]]$coef)[i],header=TRUE)
}
a<-table.row.end(a)
for (j in 1:nrows) {
a<-table.row.start(a)
mydum <- 'Estimates ('
mydum <- paste(mydum,j)
mydum <- paste(mydum,')')
a<-table.element(a,mydum, header=TRUE)
for (i in 1:ncols) {
a<-table.element(a,round(selection[[1]][j,i],4))
}
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'(p-val)', header=TRUE)
for (i in 1:ncols) {
mydum <- '('
mydum <- paste(mydum,round(selection[[2]][j,i],4),sep='')
mydum <- paste(mydum,')')
a<-table.element(a,mydum)
}
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,'Estimated ARIMA Residuals', 1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Value', 1,TRUE)
a<-table.row.end(a)
for (i in (par4*par5+par3):length(resid)) {
a<-table.row.start(a)
a<-table.element(a,resid[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')