R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(293403
+ ,111
+ ,74
+ ,91256
+ ,123
+ ,119
+ ,277108
+ ,70
+ ,69
+ ,86997
+ ,64
+ ,64
+ ,264020
+ ,76
+ ,76
+ ,55709
+ ,101
+ ,100
+ ,260646
+ ,109
+ ,60
+ ,75741
+ ,104
+ ,104
+ ,246100
+ ,81
+ ,89
+ ,92046
+ ,135
+ ,135
+ ,244051
+ ,67
+ ,111
+ ,84607
+ ,130
+ ,124
+ ,241329
+ ,54
+ ,57
+ ,73586
+ ,93
+ ,93
+ ,234730
+ ,106
+ ,116
+ ,162365
+ ,159
+ ,155
+ ,234509
+ ,125
+ ,122
+ ,70817
+ ,125
+ ,120
+ ,233482
+ ,68
+ ,90
+ ,59635
+ ,81
+ ,78
+ ,233406
+ ,96
+ ,85
+ ,109104
+ ,117
+ ,117
+ ,228548
+ ,106
+ ,65
+ ,120087
+ ,205
+ ,198
+ ,223914
+ ,104
+ ,89
+ ,72631
+ ,115
+ ,110
+ ,223696
+ ,88
+ ,82
+ ,104911
+ ,115
+ ,114
+ ,223004
+ ,87
+ ,84
+ ,85224
+ ,147
+ ,137
+ ,213765
+ ,84
+ ,56
+ ,58233
+ ,150
+ ,150
+ ,210554
+ ,81
+ ,73
+ ,117986
+ ,126
+ ,124
+ ,202204
+ ,44
+ ,79
+ ,67271
+ ,61
+ ,56
+ ,199512
+ ,75
+ ,59
+ ,55071
+ ,82
+ ,82
+ ,195304
+ ,93
+ ,47
+ ,114425
+ ,152
+ ,145
+ ,191467
+ ,76
+ ,75
+ ,79194
+ ,109
+ ,104
+ ,191381
+ ,87
+ ,71
+ ,101653
+ ,210
+ ,212
+ ,191276
+ ,112
+ ,90
+ ,81493
+ ,151
+ ,141
+ ,190410
+ ,84
+ ,107
+ ,64664
+ ,96
+ ,94
+ ,188967
+ ,86
+ ,75
+ ,63717
+ ,98
+ ,94
+ ,188780
+ ,98
+ ,85
+ ,72369
+ ,98
+ ,98
+ ,185139
+ ,121
+ ,83
+ ,86281
+ ,128
+ ,126
+ ,185039
+ ,94
+ ,73
+ ,63958
+ ,100
+ ,98
+ ,184217
+ ,69
+ ,45
+ ,73795
+ ,74
+ ,74
+ ,181853
+ ,87
+ ,93
+ ,96750
+ ,92
+ ,91
+ ,181379
+ ,92
+ ,123
+ ,83038
+ ,101
+ ,96
+ ,181344
+ ,75
+ ,114
+ ,65196
+ ,109
+ ,108
+ ,179562
+ ,76
+ ,89
+ ,62932
+ ,116
+ ,116
+ ,178863
+ ,86
+ ,78
+ ,57637
+ ,88
+ ,87
+ ,178140
+ ,56
+ ,91
+ ,70111
+ ,83
+ ,78
+ ,176789
+ ,115
+ ,66
+ ,123328
+ ,149
+ ,149
+ ,176460
+ ,97
+ ,55
+ ,38885
+ ,122
+ ,122
+ ,175877
+ ,95
+ ,81
+ ,54628
+ ,96
+ ,95
+ ,175568
+ ,106
+ ,80
+ ,74482
+ ,105
+ ,102
+ ,174107
+ ,49
+ ,71
+ ,76168
+ ,95
+ ,91
+ ,173587
+ ,70
+ ,70
+ ,71170
+ ,97
+ ,95
+ ,173260
+ ,41
+ ,78
+ ,37238
+ ,16
+ ,15
+ ,172684
+ ,87
+ ,112
+ ,101773
+ ,103
+ ,102
+ ,167845
+ ,105
+ ,77
+ ,103646
+ ,145
+ ,145
+ ,167131
+ ,71
+ ,69
+ ,37048
+ ,56
+ ,56
+ ,167105
+ ,56
+ ,32
+ ,85903
+ ,75
+ ,71
+ ,166790
+ ,49
+ ,59
+ ,43460
+ ,46
+ ,46
+ ,164767
+ ,51
+ ,87
+ ,90257
+ ,81
+ ,80
+ ,162810
+ ,49
+ ,76
+ ,70027
+ ,83
+ ,80
+ ,162336
+ ,111
+ ,84
+ ,111436
+ ,153
+ ,151
+ ,161678
+ ,75
+ ,59
+ ,65911
+ ,87
+ ,83
+ ,158980
+ ,84
+ ,75
+ ,105965
+ ,123
+ ,122
+ ,157250
+ ,84
+ ,106
+ ,61704
+ ,104
+ ,104
+ ,156833
+ ,79
+ ,73
+ ,48204
+ ,85
+ ,85
+ ,155383
+ ,83
+ ,75
+ ,60029
+ ,99
+ ,99
+ ,154991
+ ,63
+ ,87
+ ,52295
+ ,99
+ ,98
+ ,154730
+ ,78
+ ,82
+ ,82204
+ ,98
+ ,98
+ ,151503
+ ,93
+ ,83
+ ,56316
+ ,99
+ ,98
+ ,146455
+ ,65
+ ,68
+ ,95556
+ ,127
+ ,128
+ ,143937
+ ,98
+ ,66
+ ,78792
+ ,140
+ ,139
+ ,142339
+ ,75
+ ,67
+ ,125410
+ ,144
+ ,142
+ ,142146
+ ,108
+ ,88
+ ,76013
+ ,152
+ ,139
+ ,142141
+ ,73
+ ,87
+ ,91939
+ ,61
+ ,61
+ ,142069
+ ,66
+ ,88
+ ,57231
+ ,83
+ ,82
+ ,141933
+ ,90
+ ,75
+ ,51370
+ ,100
+ ,99
+ ,139350
+ ,70
+ ,79
+ ,99518
+ ,89
+ ,88
+ ,139144
+ ,57
+ ,76
+ ,56530
+ ,75
+ ,75
+ ,137793
+ ,70
+ ,78
+ ,56699
+ ,77
+ ,77
+ ,136911
+ ,95
+ ,86
+ ,74349
+ ,117
+ ,103
+ ,136548
+ ,89
+ ,62
+ ,83042
+ ,158
+ ,157
+ ,135171
+ ,80
+ ,61
+ ,71181
+ ,82
+ ,82
+ ,134043
+ ,54
+ ,69
+ ,55901
+ ,57
+ ,54
+ ,131876
+ ,27
+ ,83
+ ,38417
+ ,36
+ ,36
+ ,131122
+ ,56
+ ,50
+ ,65724
+ ,89
+ ,89
+ ,130539
+ ,60
+ ,47
+ ,48821
+ ,66
+ ,66
+ ,130533
+ ,64
+ ,76
+ ,85168
+ ,78
+ ,79
+ ,130232
+ ,102
+ ,83
+ ,55027
+ ,107
+ ,105
+ ,129100
+ ,38
+ ,60
+ ,73713
+ ,87
+ ,87
+ ,128655
+ ,75
+ ,70
+ ,79774
+ ,111
+ ,108
+ ,128066
+ ,42
+ ,48
+ ,42564
+ ,80
+ ,80
+ ,127619
+ ,49
+ ,50
+ ,36311
+ ,52
+ ,50
+ ,127324
+ ,79
+ ,87
+ ,56733
+ ,104
+ ,101
+ ,126683
+ ,71
+ ,123
+ ,63262
+ ,72
+ ,71
+ ,126681
+ ,39
+ ,90
+ ,94137
+ ,67
+ ,66
+ ,125971
+ ,61
+ ,45
+ ,38439
+ ,71
+ ,71
+ ,125366
+ ,69
+ ,22
+ ,34497
+ ,68
+ ,68
+ ,122433
+ ,51
+ ,91
+ ,58425
+ ,66
+ ,66
+ ,121135
+ ,50
+ ,51
+ ,42051
+ ,69
+ ,68
+ ,119291
+ ,83
+ ,38
+ ,64102
+ ,123
+ ,120
+ ,118958
+ ,52
+ ,68
+ ,54506
+ ,61
+ ,58
+ ,118807
+ ,56
+ ,81
+ ,55827
+ ,70
+ ,70
+ ,118372
+ ,72
+ ,35
+ ,66477
+ ,142
+ ,145
+ ,116900
+ ,42
+ ,36
+ ,28340
+ ,58
+ ,57
+ ,116775
+ ,30
+ ,83
+ ,73087
+ ,124
+ ,112
+ ,115199
+ ,84
+ ,54
+ ,51360
+ ,87
+ ,87
+ ,114928
+ ,44
+ ,72
+ ,53009
+ ,96
+ ,91
+ ,114397
+ ,70
+ ,65
+ ,55064
+ ,87
+ ,85
+ ,113337
+ ,58
+ ,37
+ ,63016
+ ,68
+ ,68
+ ,111664
+ ,55
+ ,59
+ ,38650
+ ,98
+ ,98
+ ,108715
+ ,64
+ ,35
+ ,40671
+ ,80
+ ,78
+ ,107342
+ ,77
+ ,53
+ ,82043
+ ,116
+ ,111
+ ,107335
+ ,48
+ ,61
+ ,49319
+ ,65
+ ,64
+ ,106539
+ ,36
+ ,68
+ ,77411
+ ,63
+ ,63
+ ,105615
+ ,57
+ ,70
+ ,202316
+ ,51
+ ,48
+ ,105410
+ ,62
+ ,72
+ ,89041
+ ,88
+ ,86
+ ,105324
+ ,42
+ ,71
+ ,26982
+ ,46
+ ,46
+ ,103012
+ ,30
+ ,37
+ ,29467
+ ,28
+ ,26
+ ,102531
+ ,46
+ ,63
+ ,40001
+ ,64
+ ,63
+ ,101324
+ ,81
+ ,104
+ ,70780
+ ,103
+ ,100
+ ,100885
+ ,39
+ ,29
+ ,49288
+ ,49
+ ,48
+ ,100672
+ ,38
+ ,69
+ ,50466
+ ,55
+ ,55
+ ,99946
+ ,106
+ ,80
+ ,99501
+ ,125
+ ,119
+ ,99768
+ ,24
+ ,62
+ ,15430
+ ,27
+ ,27
+ ,99246
+ ,27
+ ,63
+ ,37361
+ ,52
+ ,51
+ ,98599
+ ,48
+ ,55
+ ,36252
+ ,46
+ ,44
+ ,98030
+ ,30
+ ,41
+ ,31701
+ ,35
+ ,35
+ ,94763
+ ,94
+ ,75
+ ,56979
+ ,100
+ ,99
+ ,93340
+ ,41
+ ,63
+ ,43448
+ ,60
+ ,60
+ ,93125
+ ,30
+ ,29
+ ,50838
+ ,37
+ ,36
+ ,91185
+ ,57
+ ,66
+ ,21067
+ ,67
+ ,67
+ ,90961
+ ,42
+ ,78
+ ,63785
+ ,49
+ ,49
+ ,90938
+ ,40
+ ,51
+ ,37137
+ ,43
+ ,42
+ ,89318
+ ,75
+ ,78
+ ,44970
+ ,82
+ ,81
+ ,88817
+ ,70
+ ,60
+ ,46765
+ ,56
+ ,56
+ ,84944
+ ,54
+ ,72
+ ,54565
+ ,90
+ ,89
+ ,84572
+ ,43
+ ,82
+ ,72571
+ ,84
+ ,84
+ ,84256
+ ,97
+ ,58
+ ,59155
+ ,76
+ ,75
+ ,80953
+ ,49
+ ,27
+ ,56622
+ ,59
+ ,58
+ ,78800
+ ,20
+ ,66
+ ,33032
+ ,21
+ ,21
+ ,78776
+ ,30
+ ,18
+ ,26998
+ ,34
+ ,34
+ ,75812
+ ,28
+ ,57
+ ,35606
+ ,30
+ ,30
+ ,75426
+ ,3
+ ,19
+ ,47261
+ ,36
+ ,33
+ ,74398
+ ,41
+ ,30
+ ,31258
+ ,51
+ ,51
+ ,74112
+ ,28
+ ,54
+ ,174949
+ ,52
+ ,52
+ ,73567
+ ,37
+ ,31
+ ,23238
+ ,18
+ ,18
+ ,69471
+ ,22
+ ,63
+ ,22618
+ ,26
+ ,25
+ ,68948
+ ,31
+ ,47
+ ,35838
+ ,45
+ ,43
+ ,67746
+ ,18
+ ,35
+ ,62832
+ ,58
+ ,56
+ ,67507
+ ,101
+ ,112
+ ,78956
+ ,49
+ ,49
+ ,65029
+ ,21
+ ,61
+ ,32551
+ ,21
+ ,21
+ ,64320
+ ,16
+ ,56
+ ,62147
+ ,24
+ ,23
+ ,61857
+ ,23
+ ,30
+ ,25162
+ ,31
+ ,28
+ ,61499
+ ,28
+ ,75
+ ,36990
+ ,15
+ ,15
+ ,50999
+ ,2
+ ,66
+ ,63989
+ ,8
+ ,8
+ ,46660
+ ,12
+ ,13
+ ,6179
+ ,13
+ ,13
+ ,43287
+ ,13
+ ,64
+ ,43750
+ ,49
+ ,49
+ ,38214
+ ,16
+ ,21
+ ,8773
+ ,16
+ ,16
+ ,35523
+ ,0
+ ,53
+ ,52491
+ ,33
+ ,33
+ ,32750
+ ,1
+ ,22
+ ,22807
+ ,5
+ ,5
+ ,31414
+ ,18
+ ,9
+ ,14116
+ ,39
+ ,39
+ ,24188
+ ,8
+ ,7
+ ,5950
+ ,7
+ ,7
+ ,22938
+ ,12
+ ,0
+ ,1168
+ ,11
+ ,11
+ ,21054
+ ,4
+ ,0
+ ,855
+ ,4
+ ,4
+ ,17547
+ ,0
+ ,4
+ ,3926
+ ,3
+ ,3
+ ,14688
+ ,4
+ ,0
+ ,6023
+ ,5
+ ,5
+ ,7199
+ ,7
+ ,0
+ ,1644
+ ,6
+ ,6
+ ,969
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,455
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,203
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,98
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0)
+ ,dim=c(6
+ ,164)
+ ,dimnames=list(c('Y'
+ ,'X1'
+ ,'X2'
+ ,'X3'
+ ,'X4'
+ ,'X5')
+ ,1:164))
> y <- array(NA,dim=c(6,164),dimnames=list(c('Y','X1','X2','X3','X4','X5'),1:164))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X1 X2 X3 X4 X5
1 293403 111 74 91256 123 119
2 277108 70 69 86997 64 64
3 264020 76 76 55709 101 100
4 260646 109 60 75741 104 104
5 246100 81 89 92046 135 135
6 244051 67 111 84607 130 124
7 241329 54 57 73586 93 93
8 234730 106 116 162365 159 155
9 234509 125 122 70817 125 120
10 233482 68 90 59635 81 78
11 233406 96 85 109104 117 117
12 228548 106 65 120087 205 198
13 223914 104 89 72631 115 110
14 223696 88 82 104911 115 114
15 223004 87 84 85224 147 137
16 213765 84 56 58233 150 150
17 210554 81 73 117986 126 124
18 202204 44 79 67271 61 56
19 199512 75 59 55071 82 82
20 195304 93 47 114425 152 145
21 191467 76 75 79194 109 104
22 191381 87 71 101653 210 212
23 191276 112 90 81493 151 141
24 190410 84 107 64664 96 94
25 188967 86 75 63717 98 94
26 188780 98 85 72369 98 98
27 185139 121 83 86281 128 126
28 185039 94 73 63958 100 98
29 184217 69 45 73795 74 74
30 181853 87 93 96750 92 91
31 181379 92 123 83038 101 96
32 181344 75 114 65196 109 108
33 179562 76 89 62932 116 116
34 178863 86 78 57637 88 87
35 178140 56 91 70111 83 78
36 176789 115 66 123328 149 149
37 176460 97 55 38885 122 122
38 175877 95 81 54628 96 95
39 175568 106 80 74482 105 102
40 174107 49 71 76168 95 91
41 173587 70 70 71170 97 95
42 173260 41 78 37238 16 15
43 172684 87 112 101773 103 102
44 167845 105 77 103646 145 145
45 167131 71 69 37048 56 56
46 167105 56 32 85903 75 71
47 166790 49 59 43460 46 46
48 164767 51 87 90257 81 80
49 162810 49 76 70027 83 80
50 162336 111 84 111436 153 151
51 161678 75 59 65911 87 83
52 158980 84 75 105965 123 122
53 157250 84 106 61704 104 104
54 156833 79 73 48204 85 85
55 155383 83 75 60029 99 99
56 154991 63 87 52295 99 98
57 154730 78 82 82204 98 98
58 151503 93 83 56316 99 98
59 146455 65 68 95556 127 128
60 143937 98 66 78792 140 139
61 142339 75 67 125410 144 142
62 142146 108 88 76013 152 139
63 142141 73 87 91939 61 61
64 142069 66 88 57231 83 82
65 141933 90 75 51370 100 99
66 139350 70 79 99518 89 88
67 139144 57 76 56530 75 75
68 137793 70 78 56699 77 77
69 136911 95 86 74349 117 103
70 136548 89 62 83042 158 157
71 135171 80 61 71181 82 82
72 134043 54 69 55901 57 54
73 131876 27 83 38417 36 36
74 131122 56 50 65724 89 89
75 130539 60 47 48821 66 66
76 130533 64 76 85168 78 79
77 130232 102 83 55027 107 105
78 129100 38 60 73713 87 87
79 128655 75 70 79774 111 108
80 128066 42 48 42564 80 80
81 127619 49 50 36311 52 50
82 127324 79 87 56733 104 101
83 126683 71 123 63262 72 71
84 126681 39 90 94137 67 66
85 125971 61 45 38439 71 71
86 125366 69 22 34497 68 68
87 122433 51 91 58425 66 66
88 121135 50 51 42051 69 68
89 119291 83 38 64102 123 120
90 118958 52 68 54506 61 58
91 118807 56 81 55827 70 70
92 118372 72 35 66477 142 145
93 116900 42 36 28340 58 57
94 116775 30 83 73087 124 112
95 115199 84 54 51360 87 87
96 114928 44 72 53009 96 91
97 114397 70 65 55064 87 85
98 113337 58 37 63016 68 68
99 111664 55 59 38650 98 98
100 108715 64 35 40671 80 78
101 107342 77 53 82043 116 111
102 107335 48 61 49319 65 64
103 106539 36 68 77411 63 63
104 105615 57 70 202316 51 48
105 105410 62 72 89041 88 86
106 105324 42 71 26982 46 46
107 103012 30 37 29467 28 26
108 102531 46 63 40001 64 63
109 101324 81 104 70780 103 100
110 100885 39 29 49288 49 48
111 100672 38 69 50466 55 55
112 99946 106 80 99501 125 119
113 99768 24 62 15430 27 27
114 99246 27 63 37361 52 51
115 98599 48 55 36252 46 44
116 98030 30 41 31701 35 35
117 94763 94 75 56979 100 99
118 93340 41 63 43448 60 60
119 93125 30 29 50838 37 36
120 91185 57 66 21067 67 67
121 90961 42 78 63785 49 49
122 90938 40 51 37137 43 42
123 89318 75 78 44970 82 81
124 88817 70 60 46765 56 56
125 84944 54 72 54565 90 89
126 84572 43 82 72571 84 84
127 84256 97 58 59155 76 75
128 80953 49 27 56622 59 58
129 78800 20 66 33032 21 21
130 78776 30 18 26998 34 34
131 75812 28 57 35606 30 30
132 75426 3 19 47261 36 33
133 74398 41 30 31258 51 51
134 74112 28 54 174949 52 52
135 73567 37 31 23238 18 18
136 69471 22 63 22618 26 25
137 68948 31 47 35838 45 43
138 67746 18 35 62832 58 56
139 67507 101 112 78956 49 49
140 65029 21 61 32551 21 21
141 64320 16 56 62147 24 23
142 61857 23 30 25162 31 28
143 61499 28 75 36990 15 15
144 50999 2 66 63989 8 8
145 46660 12 13 6179 13 13
146 43287 13 64 43750 49 49
147 38214 16 21 8773 16 16
148 35523 0 53 52491 33 33
149 32750 1 22 22807 5 5
150 31414 18 9 14116 39 39
151 24188 8 7 5950 7 7
152 22938 12 0 1168 11 11
153 21054 4 0 855 4 4
154 17547 0 4 3926 3 3
155 14688 4 0 6023 5 5
156 7199 7 0 1644 6 6
157 969 0 0 0 0 0
158 455 0 0 0 0 0
159 203 0 0 0 0 0
160 98 0 0 0 0 0
161 0 0 0 0 0 0
162 0 0 0 0 0 0
163 0 0 0 0 0 0
164 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X1 X2 X3 X4 X5
1.739e+04 6.781e+02 5.216e+02 1.546e-01 6.522e-01 3.788e+02
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-107586 -17611 -6073 17865 138531
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.739e+04 7.196e+03 2.416 0.016827 *
X1 6.781e+02 1.918e+02 3.535 0.000535 ***
X2 5.216e+02 1.482e+02 3.519 0.000565 ***
X3 1.546e-01 1.307e-01 1.182 0.238791
X4 6.522e-01 1.254e+03 0.001 0.999586
X5 3.788e+02 1.281e+03 0.296 0.767801
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 37290 on 158 degrees of freedom
Multiple R-squared: 0.6684, Adjusted R-squared: 0.6579
F-statistic: 63.68 on 5 and 158 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.2822556 5.645112e-01 7.177444e-01
[2,] 0.2245091 4.490181e-01 7.754909e-01
[3,] 0.1500564 3.001127e-01 8.499436e-01
[4,] 0.1777832 3.555663e-01 8.222168e-01
[5,] 0.2113002 4.226004e-01 7.886998e-01
[6,] 0.2122011 4.244022e-01 7.877989e-01
[7,] 0.1674945 3.349890e-01 8.325055e-01
[8,] 0.1519214 3.038429e-01 8.480786e-01
[9,] 0.1968766 3.937532e-01 8.031234e-01
[10,] 0.3012547 6.025093e-01 6.987453e-01
[11,] 0.4650174 9.300348e-01 5.349826e-01
[12,] 0.4770562 9.541124e-01 5.229438e-01
[13,] 0.5255796 9.488408e-01 4.744204e-01
[14,] 0.5084158 9.831685e-01 4.915842e-01
[15,] 0.5168380 9.663240e-01 4.831620e-01
[16,] 0.6232369 7.535262e-01 3.767631e-01
[17,] 0.6813817 6.372367e-01 3.186183e-01
[18,] 0.7733345 4.533310e-01 2.266655e-01
[19,] 0.8191380 3.617239e-01 1.808620e-01
[20,] 0.8404287 3.191426e-01 1.595713e-01
[21,] 0.8937432 2.125137e-01 1.062568e-01
[22,] 0.9238845 1.522310e-01 7.611549e-02
[23,] 0.9300278 1.399444e-01 6.997219e-02
[24,] 0.9256886 1.486228e-01 7.431139e-02
[25,] 0.9227173 1.545653e-01 7.728266e-02
[26,] 0.9284179 1.431643e-01 7.158215e-02
[27,] 0.9356814 1.286371e-01 6.431856e-02
[28,] 0.9533777 9.324461e-02 4.662231e-02
[29,] 0.9510691 9.786182e-02 4.893091e-02
[30,] 0.9496071 1.007859e-01 5.039293e-02
[31,] 0.9501066 9.978672e-02 4.989336e-02
[32,] 0.9634589 7.308227e-02 3.654113e-02
[33,] 0.9688365 6.232710e-02 3.116355e-02
[34,] 0.9844212 3.115761e-02 1.557881e-02
[35,] 0.9855018 2.899636e-02 1.449818e-02
[36,] 0.9876038 2.479246e-02 1.239623e-02
[37,] 0.9910839 1.783210e-02 8.916052e-03
[38,] 0.9969883 6.023405e-03 3.011703e-03
[39,] 0.9988442 2.311562e-03 1.155781e-03
[40,] 0.9991729 1.654139e-03 8.270697e-04
[41,] 0.9994851 1.029788e-03 5.148939e-04
[42,] 0.9996710 6.580167e-04 3.290084e-04
[43,] 0.9998294 3.411919e-04 1.705960e-04
[44,] 0.9998583 2.833953e-04 1.416976e-04
[45,] 0.9998540 2.919464e-04 1.459732e-04
[46,] 0.9998754 2.491705e-04 1.245852e-04
[47,] 0.9998806 2.387786e-04 1.193893e-04
[48,] 0.9998747 2.506683e-04 1.253341e-04
[49,] 0.9998815 2.369783e-04 1.184891e-04
[50,] 0.9998834 2.331983e-04 1.165991e-04
[51,] 0.9998855 2.289855e-04 1.144928e-04
[52,] 0.9999080 1.840102e-04 9.200508e-05
[53,] 0.9999357 1.286824e-04 6.434119e-05
[54,] 0.9999714 5.722295e-05 2.861147e-05
[55,] 0.9999807 3.856410e-05 1.928205e-05
[56,] 0.9999806 3.876292e-05 1.938146e-05
[57,] 0.9999799 4.022615e-05 2.011307e-05
[58,] 0.9999828 3.430399e-05 1.715199e-05
[59,] 0.9999838 3.248694e-05 1.624347e-05
[60,] 0.9999839 3.213530e-05 1.606765e-05
[61,] 0.9999884 2.327712e-05 1.163856e-05
[62,] 0.9999906 1.886303e-05 9.431514e-06
[63,] 0.9999915 1.691394e-05 8.456970e-06
[64,] 0.9999947 1.057332e-05 5.286660e-06
[65,] 0.9999971 5.791582e-06 2.895791e-06
[66,] 0.9999970 6.065240e-06 3.032620e-06
[67,] 0.9999978 4.347171e-06 2.173585e-06
[68,] 0.9999978 4.382040e-06 2.191020e-06
[69,] 0.9999979 4.270633e-06 2.135317e-06
[70,] 0.9999976 4.768402e-06 2.384201e-06
[71,] 0.9999974 5.287327e-06 2.643664e-06
[72,] 0.9999975 5.035670e-06 2.517835e-06
[73,] 0.9999987 2.556747e-06 1.278374e-06
[74,] 0.9999985 3.034831e-06 1.517416e-06
[75,] 0.9999983 3.442584e-06 1.721292e-06
[76,] 0.9999982 3.664373e-06 1.832187e-06
[77,] 0.9999985 3.067859e-06 1.533930e-06
[78,] 0.9999992 1.524714e-06 7.623572e-07
[79,] 0.9999990 1.921845e-06 9.609225e-07
[80,] 0.9999992 1.639319e-06 8.196593e-07
[81,] 0.9999990 2.033758e-06 1.016879e-06
[82,] 0.9999990 1.922864e-06 9.614322e-07
[83,] 0.9999988 2.411757e-06 1.205878e-06
[84,] 0.9999983 3.474701e-06 1.737351e-06
[85,] 0.9999991 1.844388e-06 9.221940e-07
[86,] 0.9999986 2.840089e-06 1.420045e-06
[87,] 0.9999984 3.260789e-06 1.630395e-06
[88,] 0.9999973 5.332820e-06 2.666410e-06
[89,] 0.9999965 7.030108e-06 3.515054e-06
[90,] 0.9999974 5.161869e-06 2.580935e-06
[91,] 0.9999960 7.968086e-06 3.984043e-06
[92,] 0.9999960 8.040043e-06 4.020022e-06
[93,] 0.9999954 9.213441e-06 4.606721e-06
[94,] 0.9999944 1.115746e-05 5.578729e-06
[95,] 0.9999933 1.330720e-05 6.653598e-06
[96,] 0.9999950 1.008798e-05 5.043988e-06
[97,] 0.9999932 1.362859e-05 6.814294e-06
[98,] 0.9999925 1.506872e-05 7.534361e-06
[99,] 0.9999969 6.261616e-06 3.130808e-06
[100,] 0.9999958 8.373992e-06 4.186996e-06
[101,] 0.9999976 4.742316e-06 2.371158e-06
[102,] 0.9999988 2.362252e-06 1.181126e-06
[103,] 0.9999984 3.238640e-06 1.619320e-06
[104,] 0.9999998 3.347341e-07 1.673670e-07
[105,] 0.9999999 1.387203e-07 6.936015e-08
[106,] 0.9999999 1.801447e-07 9.007233e-08
[107,] 0.9999999 2.773840e-07 1.386920e-07
[108,] 1.0000000 5.467889e-08 2.733944e-08
[109,] 1.0000000 4.203789e-08 2.101895e-08
[110,] 1.0000000 5.599011e-08 2.799505e-08
[111,] 1.0000000 2.288326e-08 1.144163e-08
[112,] 1.0000000 3.755335e-08 1.877668e-08
[113,] 1.0000000 5.726616e-08 2.863308e-08
[114,] 1.0000000 6.062621e-08 3.031310e-08
[115,] 1.0000000 8.919007e-08 4.459504e-08
[116,] 0.9999999 1.355141e-07 6.775707e-08
[117,] 0.9999999 1.973022e-07 9.865111e-08
[118,] 0.9999998 3.130607e-07 1.565304e-07
[119,] 0.9999998 3.338307e-07 1.669154e-07
[120,] 0.9999996 7.228115e-07 3.614058e-07
[121,] 0.9999997 6.384136e-07 3.192068e-07
[122,] 0.9999999 1.694832e-07 8.474160e-08
[123,] 0.9999999 1.631126e-07 8.155629e-08
[124,] 0.9999998 3.269505e-07 1.634753e-07
[125,] 0.9999999 2.379808e-07 1.189904e-07
[126,] 0.9999998 4.524706e-07 2.262353e-07
[127,] 1.0000000 1.545757e-08 7.728784e-09
[128,] 1.0000000 4.865296e-08 2.432648e-08
[129,] 0.9999999 1.562844e-07 7.814222e-08
[130,] 0.9999998 4.455545e-07 2.227772e-07
[131,] 1.0000000 6.141600e-10 3.070800e-10
[132,] 1.0000000 1.607204e-09 8.036020e-10
[133,] 1.0000000 4.844486e-09 2.422243e-09
[134,] 1.0000000 2.312877e-08 1.156439e-08
[135,] 1.0000000 2.239668e-08 1.119834e-08
[136,] 1.0000000 2.037238e-08 1.018619e-08
[137,] 1.0000000 4.879007e-09 2.439503e-09
[138,] 1.0000000 3.079933e-08 1.539967e-08
[139,] 0.9999999 1.983844e-07 9.919221e-08
[140,] 0.9999997 5.323520e-07 2.661760e-07
[141,] 0.9999988 2.401882e-06 1.200941e-06
[142,] 0.9999997 6.642145e-07 3.321072e-07
[143,] 0.9999998 3.957583e-07 1.978792e-07
[144,] 1.0000000 7.610828e-12 3.805414e-12
[145,] 1.0000000 8.215098e-10 4.107549e-10
[146,] 1.0000000 8.134935e-08 4.067468e-08
[147,] 0.9999964 7.268616e-06 3.634308e-06
> postscript(file="/var/wessaorg/rcomp/tmp/1hkrt1355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2lse71355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/31w5c1355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4dmsa1355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/55wj71355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 164
Frequency = 1
1 2 3 4 5 6
102885.3667 138530.8798 108899.9258 86879.6367 61911.4396 63200.8709
7 8 9 10 11 12
110930.6500 1042.9458 12240.9886 84223.7666 45324.7192 11680.9032
13 14 15 16 17 18
36612.9088 44390.3039 37644.0194 44290.7235 34873.0907 82123.7490
19 20 21 22 23 24
60866.2249 17626.3680 31717.4048 -18187.7786 -15107.3353 14587.0683
25 26 27 28 29 30
28623.9766 12230.9322 -18739.7231 18760.5645 57082.9737 7476.5115
31 32 33 34 35 36
-11815.8062 2579.2868 10474.2502 20553.1428 34876.6559 -28607.0253
37 38 39 40 41 42
12307.1346 7329.0570 -5644.3669 40153.9748 25171.4253 75938.1256
43 44 45 46 47 48
-16553.1035 -31946.8578 38633.3326 54830.9921 61229.8354 23109.7841
49 50 51 52 53 54
31372.8076 -48657.9421 20974.3215 -17160.4813 -21386.7418 8095.7776
55 56 57 58 59 60
-4250.0689 4235.5422 -8212.4786 -18131.1654 -13816.1987 -39252.1440
61 62 63 64 65 66
-34121.1858 -58877.5711 -7484.9069 -5934.5819 -21108.8439 -15485.8453
67 68 69 70 71 72
6267.6429 -5727.0303 -40337.7188 -45938.5663 -10399.1418 14915.5202
73 74 75 76 77 78
33290.0538 5751.7786 15361.2527 -13034.6681 -47962.5980 10243.6613
79 80 81 82 83 84
-29414.5997 20227.9989 26339.3893 -36107.0089 -39725.6102 -3691.4167
85 86 87 88 89 90
10866.2209 18580.7153 -11076.6663 10939.1440 -29642.7825 406.2813
91 92 93 94 95 96
-13993.3706 -31386.8100 26246.4605 -18049.9616 -28265.2755 -12576.3209
97 98 99 100 101 102
-25126.2904 1778.0211 -16951.7168 -6210.5731 -44707.1051 -6326.4770
103 104 105 106 107 108
-6599.1988 -36427.5600 -37971.8082 798.9961 31561.7629 -8997.4435
109 110 111 112 113 114
-74122.5827 16093.3036 -7142.8705 -91586.6091 21138.5692 5563.0692
115 116 117 118 119 120
-2324.7541 20734.4193 -71858.4533 -14191.8261 18749.8959 -27957.3742
121 122 123 124 125 126
-24043.2035 -1851.7607 -57297.6843 -35810.4455 -48820.5517 -47835.1489
127 128 129 130 131 132
-66762.7142 -14504.8138 351.9769 14583.6169 -7179.4192 26265.9384
133 134 135 136 137 138
-10621.7308 -37204.5552 4499.2958 -8676.8472 -15831.6083 -11064.8692
139 140 141 142 143 144
-107585.6308 -11414.8009 -11460.3071 -1289.2349 -25403.6058 -15096.2835
145 146 147 148 149 150
8468.3522 -41652.1411 -8402.1950 -30143.5438 -2211.9662 -19852.2600
151 152 153 154 155 156
-5849.6214 -6939.3496 -694.0149 -3670.2792 -8238.4193 -17464.2032
157 158 159 160 161 162
-16416.6433 -16930.6433 -17182.6433 -17287.6433 -17385.6433 -17385.6433
163 164
-17385.6433 -17385.6433
> postscript(file="/var/wessaorg/rcomp/tmp/6n3491355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 164
Frequency = 1
lag(myerror, k = 1) myerror
0 102885.3667 NA
1 138530.8798 102885.3667
2 108899.9258 138530.8798
3 86879.6367 108899.9258
4 61911.4396 86879.6367
5 63200.8709 61911.4396
6 110930.6500 63200.8709
7 1042.9458 110930.6500
8 12240.9886 1042.9458
9 84223.7666 12240.9886
10 45324.7192 84223.7666
11 11680.9032 45324.7192
12 36612.9088 11680.9032
13 44390.3039 36612.9088
14 37644.0194 44390.3039
15 44290.7235 37644.0194
16 34873.0907 44290.7235
17 82123.7490 34873.0907
18 60866.2249 82123.7490
19 17626.3680 60866.2249
20 31717.4048 17626.3680
21 -18187.7786 31717.4048
22 -15107.3353 -18187.7786
23 14587.0683 -15107.3353
24 28623.9766 14587.0683
25 12230.9322 28623.9766
26 -18739.7231 12230.9322
27 18760.5645 -18739.7231
28 57082.9737 18760.5645
29 7476.5115 57082.9737
30 -11815.8062 7476.5115
31 2579.2868 -11815.8062
32 10474.2502 2579.2868
33 20553.1428 10474.2502
34 34876.6559 20553.1428
35 -28607.0253 34876.6559
36 12307.1346 -28607.0253
37 7329.0570 12307.1346
38 -5644.3669 7329.0570
39 40153.9748 -5644.3669
40 25171.4253 40153.9748
41 75938.1256 25171.4253
42 -16553.1035 75938.1256
43 -31946.8578 -16553.1035
44 38633.3326 -31946.8578
45 54830.9921 38633.3326
46 61229.8354 54830.9921
47 23109.7841 61229.8354
48 31372.8076 23109.7841
49 -48657.9421 31372.8076
50 20974.3215 -48657.9421
51 -17160.4813 20974.3215
52 -21386.7418 -17160.4813
53 8095.7776 -21386.7418
54 -4250.0689 8095.7776
55 4235.5422 -4250.0689
56 -8212.4786 4235.5422
57 -18131.1654 -8212.4786
58 -13816.1987 -18131.1654
59 -39252.1440 -13816.1987
60 -34121.1858 -39252.1440
61 -58877.5711 -34121.1858
62 -7484.9069 -58877.5711
63 -5934.5819 -7484.9069
64 -21108.8439 -5934.5819
65 -15485.8453 -21108.8439
66 6267.6429 -15485.8453
67 -5727.0303 6267.6429
68 -40337.7188 -5727.0303
69 -45938.5663 -40337.7188
70 -10399.1418 -45938.5663
71 14915.5202 -10399.1418
72 33290.0538 14915.5202
73 5751.7786 33290.0538
74 15361.2527 5751.7786
75 -13034.6681 15361.2527
76 -47962.5980 -13034.6681
77 10243.6613 -47962.5980
78 -29414.5997 10243.6613
79 20227.9989 -29414.5997
80 26339.3893 20227.9989
81 -36107.0089 26339.3893
82 -39725.6102 -36107.0089
83 -3691.4167 -39725.6102
84 10866.2209 -3691.4167
85 18580.7153 10866.2209
86 -11076.6663 18580.7153
87 10939.1440 -11076.6663
88 -29642.7825 10939.1440
89 406.2813 -29642.7825
90 -13993.3706 406.2813
91 -31386.8100 -13993.3706
92 26246.4605 -31386.8100
93 -18049.9616 26246.4605
94 -28265.2755 -18049.9616
95 -12576.3209 -28265.2755
96 -25126.2904 -12576.3209
97 1778.0211 -25126.2904
98 -16951.7168 1778.0211
99 -6210.5731 -16951.7168
100 -44707.1051 -6210.5731
101 -6326.4770 -44707.1051
102 -6599.1988 -6326.4770
103 -36427.5600 -6599.1988
104 -37971.8082 -36427.5600
105 798.9961 -37971.8082
106 31561.7629 798.9961
107 -8997.4435 31561.7629
108 -74122.5827 -8997.4435
109 16093.3036 -74122.5827
110 -7142.8705 16093.3036
111 -91586.6091 -7142.8705
112 21138.5692 -91586.6091
113 5563.0692 21138.5692
114 -2324.7541 5563.0692
115 20734.4193 -2324.7541
116 -71858.4533 20734.4193
117 -14191.8261 -71858.4533
118 18749.8959 -14191.8261
119 -27957.3742 18749.8959
120 -24043.2035 -27957.3742
121 -1851.7607 -24043.2035
122 -57297.6843 -1851.7607
123 -35810.4455 -57297.6843
124 -48820.5517 -35810.4455
125 -47835.1489 -48820.5517
126 -66762.7142 -47835.1489
127 -14504.8138 -66762.7142
128 351.9769 -14504.8138
129 14583.6169 351.9769
130 -7179.4192 14583.6169
131 26265.9384 -7179.4192
132 -10621.7308 26265.9384
133 -37204.5552 -10621.7308
134 4499.2958 -37204.5552
135 -8676.8472 4499.2958
136 -15831.6083 -8676.8472
137 -11064.8692 -15831.6083
138 -107585.6308 -11064.8692
139 -11414.8009 -107585.6308
140 -11460.3071 -11414.8009
141 -1289.2349 -11460.3071
142 -25403.6058 -1289.2349
143 -15096.2835 -25403.6058
144 8468.3522 -15096.2835
145 -41652.1411 8468.3522
146 -8402.1950 -41652.1411
147 -30143.5438 -8402.1950
148 -2211.9662 -30143.5438
149 -19852.2600 -2211.9662
150 -5849.6214 -19852.2600
151 -6939.3496 -5849.6214
152 -694.0149 -6939.3496
153 -3670.2792 -694.0149
154 -8238.4193 -3670.2792
155 -17464.2032 -8238.4193
156 -16416.6433 -17464.2032
157 -16930.6433 -16416.6433
158 -17182.6433 -16930.6433
159 -17287.6433 -17182.6433
160 -17385.6433 -17287.6433
161 -17385.6433 -17385.6433
162 -17385.6433 -17385.6433
163 -17385.6433 -17385.6433
164 NA -17385.6433
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 138530.8798 102885.3667
[2,] 108899.9258 138530.8798
[3,] 86879.6367 108899.9258
[4,] 61911.4396 86879.6367
[5,] 63200.8709 61911.4396
[6,] 110930.6500 63200.8709
[7,] 1042.9458 110930.6500
[8,] 12240.9886 1042.9458
[9,] 84223.7666 12240.9886
[10,] 45324.7192 84223.7666
[11,] 11680.9032 45324.7192
[12,] 36612.9088 11680.9032
[13,] 44390.3039 36612.9088
[14,] 37644.0194 44390.3039
[15,] 44290.7235 37644.0194
[16,] 34873.0907 44290.7235
[17,] 82123.7490 34873.0907
[18,] 60866.2249 82123.7490
[19,] 17626.3680 60866.2249
[20,] 31717.4048 17626.3680
[21,] -18187.7786 31717.4048
[22,] -15107.3353 -18187.7786
[23,] 14587.0683 -15107.3353
[24,] 28623.9766 14587.0683
[25,] 12230.9322 28623.9766
[26,] -18739.7231 12230.9322
[27,] 18760.5645 -18739.7231
[28,] 57082.9737 18760.5645
[29,] 7476.5115 57082.9737
[30,] -11815.8062 7476.5115
[31,] 2579.2868 -11815.8062
[32,] 10474.2502 2579.2868
[33,] 20553.1428 10474.2502
[34,] 34876.6559 20553.1428
[35,] -28607.0253 34876.6559
[36,] 12307.1346 -28607.0253
[37,] 7329.0570 12307.1346
[38,] -5644.3669 7329.0570
[39,] 40153.9748 -5644.3669
[40,] 25171.4253 40153.9748
[41,] 75938.1256 25171.4253
[42,] -16553.1035 75938.1256
[43,] -31946.8578 -16553.1035
[44,] 38633.3326 -31946.8578
[45,] 54830.9921 38633.3326
[46,] 61229.8354 54830.9921
[47,] 23109.7841 61229.8354
[48,] 31372.8076 23109.7841
[49,] -48657.9421 31372.8076
[50,] 20974.3215 -48657.9421
[51,] -17160.4813 20974.3215
[52,] -21386.7418 -17160.4813
[53,] 8095.7776 -21386.7418
[54,] -4250.0689 8095.7776
[55,] 4235.5422 -4250.0689
[56,] -8212.4786 4235.5422
[57,] -18131.1654 -8212.4786
[58,] -13816.1987 -18131.1654
[59,] -39252.1440 -13816.1987
[60,] -34121.1858 -39252.1440
[61,] -58877.5711 -34121.1858
[62,] -7484.9069 -58877.5711
[63,] -5934.5819 -7484.9069
[64,] -21108.8439 -5934.5819
[65,] -15485.8453 -21108.8439
[66,] 6267.6429 -15485.8453
[67,] -5727.0303 6267.6429
[68,] -40337.7188 -5727.0303
[69,] -45938.5663 -40337.7188
[70,] -10399.1418 -45938.5663
[71,] 14915.5202 -10399.1418
[72,] 33290.0538 14915.5202
[73,] 5751.7786 33290.0538
[74,] 15361.2527 5751.7786
[75,] -13034.6681 15361.2527
[76,] -47962.5980 -13034.6681
[77,] 10243.6613 -47962.5980
[78,] -29414.5997 10243.6613
[79,] 20227.9989 -29414.5997
[80,] 26339.3893 20227.9989
[81,] -36107.0089 26339.3893
[82,] -39725.6102 -36107.0089
[83,] -3691.4167 -39725.6102
[84,] 10866.2209 -3691.4167
[85,] 18580.7153 10866.2209
[86,] -11076.6663 18580.7153
[87,] 10939.1440 -11076.6663
[88,] -29642.7825 10939.1440
[89,] 406.2813 -29642.7825
[90,] -13993.3706 406.2813
[91,] -31386.8100 -13993.3706
[92,] 26246.4605 -31386.8100
[93,] -18049.9616 26246.4605
[94,] -28265.2755 -18049.9616
[95,] -12576.3209 -28265.2755
[96,] -25126.2904 -12576.3209
[97,] 1778.0211 -25126.2904
[98,] -16951.7168 1778.0211
[99,] -6210.5731 -16951.7168
[100,] -44707.1051 -6210.5731
[101,] -6326.4770 -44707.1051
[102,] -6599.1988 -6326.4770
[103,] -36427.5600 -6599.1988
[104,] -37971.8082 -36427.5600
[105,] 798.9961 -37971.8082
[106,] 31561.7629 798.9961
[107,] -8997.4435 31561.7629
[108,] -74122.5827 -8997.4435
[109,] 16093.3036 -74122.5827
[110,] -7142.8705 16093.3036
[111,] -91586.6091 -7142.8705
[112,] 21138.5692 -91586.6091
[113,] 5563.0692 21138.5692
[114,] -2324.7541 5563.0692
[115,] 20734.4193 -2324.7541
[116,] -71858.4533 20734.4193
[117,] -14191.8261 -71858.4533
[118,] 18749.8959 -14191.8261
[119,] -27957.3742 18749.8959
[120,] -24043.2035 -27957.3742
[121,] -1851.7607 -24043.2035
[122,] -57297.6843 -1851.7607
[123,] -35810.4455 -57297.6843
[124,] -48820.5517 -35810.4455
[125,] -47835.1489 -48820.5517
[126,] -66762.7142 -47835.1489
[127,] -14504.8138 -66762.7142
[128,] 351.9769 -14504.8138
[129,] 14583.6169 351.9769
[130,] -7179.4192 14583.6169
[131,] 26265.9384 -7179.4192
[132,] -10621.7308 26265.9384
[133,] -37204.5552 -10621.7308
[134,] 4499.2958 -37204.5552
[135,] -8676.8472 4499.2958
[136,] -15831.6083 -8676.8472
[137,] -11064.8692 -15831.6083
[138,] -107585.6308 -11064.8692
[139,] -11414.8009 -107585.6308
[140,] -11460.3071 -11414.8009
[141,] -1289.2349 -11460.3071
[142,] -25403.6058 -1289.2349
[143,] -15096.2835 -25403.6058
[144,] 8468.3522 -15096.2835
[145,] -41652.1411 8468.3522
[146,] -8402.1950 -41652.1411
[147,] -30143.5438 -8402.1950
[148,] -2211.9662 -30143.5438
[149,] -19852.2600 -2211.9662
[150,] -5849.6214 -19852.2600
[151,] -6939.3496 -5849.6214
[152,] -694.0149 -6939.3496
[153,] -3670.2792 -694.0149
[154,] -8238.4193 -3670.2792
[155,] -17464.2032 -8238.4193
[156,] -16416.6433 -17464.2032
[157,] -16930.6433 -16416.6433
[158,] -17182.6433 -16930.6433
[159,] -17287.6433 -17182.6433
[160,] -17385.6433 -17287.6433
[161,] -17385.6433 -17385.6433
[162,] -17385.6433 -17385.6433
[163,] -17385.6433 -17385.6433
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 138530.8798 102885.3667
2 108899.9258 138530.8798
3 86879.6367 108899.9258
4 61911.4396 86879.6367
5 63200.8709 61911.4396
6 110930.6500 63200.8709
7 1042.9458 110930.6500
8 12240.9886 1042.9458
9 84223.7666 12240.9886
10 45324.7192 84223.7666
11 11680.9032 45324.7192
12 36612.9088 11680.9032
13 44390.3039 36612.9088
14 37644.0194 44390.3039
15 44290.7235 37644.0194
16 34873.0907 44290.7235
17 82123.7490 34873.0907
18 60866.2249 82123.7490
19 17626.3680 60866.2249
20 31717.4048 17626.3680
21 -18187.7786 31717.4048
22 -15107.3353 -18187.7786
23 14587.0683 -15107.3353
24 28623.9766 14587.0683
25 12230.9322 28623.9766
26 -18739.7231 12230.9322
27 18760.5645 -18739.7231
28 57082.9737 18760.5645
29 7476.5115 57082.9737
30 -11815.8062 7476.5115
31 2579.2868 -11815.8062
32 10474.2502 2579.2868
33 20553.1428 10474.2502
34 34876.6559 20553.1428
35 -28607.0253 34876.6559
36 12307.1346 -28607.0253
37 7329.0570 12307.1346
38 -5644.3669 7329.0570
39 40153.9748 -5644.3669
40 25171.4253 40153.9748
41 75938.1256 25171.4253
42 -16553.1035 75938.1256
43 -31946.8578 -16553.1035
44 38633.3326 -31946.8578
45 54830.9921 38633.3326
46 61229.8354 54830.9921
47 23109.7841 61229.8354
48 31372.8076 23109.7841
49 -48657.9421 31372.8076
50 20974.3215 -48657.9421
51 -17160.4813 20974.3215
52 -21386.7418 -17160.4813
53 8095.7776 -21386.7418
54 -4250.0689 8095.7776
55 4235.5422 -4250.0689
56 -8212.4786 4235.5422
57 -18131.1654 -8212.4786
58 -13816.1987 -18131.1654
59 -39252.1440 -13816.1987
60 -34121.1858 -39252.1440
61 -58877.5711 -34121.1858
62 -7484.9069 -58877.5711
63 -5934.5819 -7484.9069
64 -21108.8439 -5934.5819
65 -15485.8453 -21108.8439
66 6267.6429 -15485.8453
67 -5727.0303 6267.6429
68 -40337.7188 -5727.0303
69 -45938.5663 -40337.7188
70 -10399.1418 -45938.5663
71 14915.5202 -10399.1418
72 33290.0538 14915.5202
73 5751.7786 33290.0538
74 15361.2527 5751.7786
75 -13034.6681 15361.2527
76 -47962.5980 -13034.6681
77 10243.6613 -47962.5980
78 -29414.5997 10243.6613
79 20227.9989 -29414.5997
80 26339.3893 20227.9989
81 -36107.0089 26339.3893
82 -39725.6102 -36107.0089
83 -3691.4167 -39725.6102
84 10866.2209 -3691.4167
85 18580.7153 10866.2209
86 -11076.6663 18580.7153
87 10939.1440 -11076.6663
88 -29642.7825 10939.1440
89 406.2813 -29642.7825
90 -13993.3706 406.2813
91 -31386.8100 -13993.3706
92 26246.4605 -31386.8100
93 -18049.9616 26246.4605
94 -28265.2755 -18049.9616
95 -12576.3209 -28265.2755
96 -25126.2904 -12576.3209
97 1778.0211 -25126.2904
98 -16951.7168 1778.0211
99 -6210.5731 -16951.7168
100 -44707.1051 -6210.5731
101 -6326.4770 -44707.1051
102 -6599.1988 -6326.4770
103 -36427.5600 -6599.1988
104 -37971.8082 -36427.5600
105 798.9961 -37971.8082
106 31561.7629 798.9961
107 -8997.4435 31561.7629
108 -74122.5827 -8997.4435
109 16093.3036 -74122.5827
110 -7142.8705 16093.3036
111 -91586.6091 -7142.8705
112 21138.5692 -91586.6091
113 5563.0692 21138.5692
114 -2324.7541 5563.0692
115 20734.4193 -2324.7541
116 -71858.4533 20734.4193
117 -14191.8261 -71858.4533
118 18749.8959 -14191.8261
119 -27957.3742 18749.8959
120 -24043.2035 -27957.3742
121 -1851.7607 -24043.2035
122 -57297.6843 -1851.7607
123 -35810.4455 -57297.6843
124 -48820.5517 -35810.4455
125 -47835.1489 -48820.5517
126 -66762.7142 -47835.1489
127 -14504.8138 -66762.7142
128 351.9769 -14504.8138
129 14583.6169 351.9769
130 -7179.4192 14583.6169
131 26265.9384 -7179.4192
132 -10621.7308 26265.9384
133 -37204.5552 -10621.7308
134 4499.2958 -37204.5552
135 -8676.8472 4499.2958
136 -15831.6083 -8676.8472
137 -11064.8692 -15831.6083
138 -107585.6308 -11064.8692
139 -11414.8009 -107585.6308
140 -11460.3071 -11414.8009
141 -1289.2349 -11460.3071
142 -25403.6058 -1289.2349
143 -15096.2835 -25403.6058
144 8468.3522 -15096.2835
145 -41652.1411 8468.3522
146 -8402.1950 -41652.1411
147 -30143.5438 -8402.1950
148 -2211.9662 -30143.5438
149 -19852.2600 -2211.9662
150 -5849.6214 -19852.2600
151 -6939.3496 -5849.6214
152 -694.0149 -6939.3496
153 -3670.2792 -694.0149
154 -8238.4193 -3670.2792
155 -17464.2032 -8238.4193
156 -16416.6433 -17464.2032
157 -16930.6433 -16416.6433
158 -17182.6433 -16930.6433
159 -17287.6433 -17182.6433
160 -17385.6433 -17287.6433
161 -17385.6433 -17385.6433
162 -17385.6433 -17385.6433
163 -17385.6433 -17385.6433
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/7mav01355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/84k091355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9nlww1355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/10u7bq1355234422.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/11mm2e1355234422.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12fbuo1355234422.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13hr431355234422.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14p3n71355234422.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15tjf11355234422.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/16phle1355234422.tab")
+ }
>
> try(system("convert tmp/1hkrt1355234422.ps tmp/1hkrt1355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/2lse71355234422.ps tmp/2lse71355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/31w5c1355234422.ps tmp/31w5c1355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/4dmsa1355234422.ps tmp/4dmsa1355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/55wj71355234422.ps tmp/55wj71355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/6n3491355234422.ps tmp/6n3491355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mav01355234422.ps tmp/7mav01355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/84k091355234422.ps tmp/84k091355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/9nlww1355234422.ps tmp/9nlww1355234422.png",intern=TRUE))
character(0)
> try(system("convert tmp/10u7bq1355234422.ps tmp/10u7bq1355234422.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
11.017 1.737 12.806