R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(255202
+ ,34
+ ,131
+ ,104
+ ,124252
+ ,135248
+ ,30
+ ,117
+ ,111
+ ,98956
+ ,198520
+ ,38
+ ,146
+ ,93
+ ,98073
+ ,189326
+ ,34
+ ,132
+ ,119
+ ,106816
+ ,141365
+ ,25
+ ,80
+ ,57
+ ,41449
+ ,65295
+ ,31
+ ,117
+ ,80
+ ,76173
+ ,439387
+ ,29
+ ,112
+ ,107
+ ,177551
+ ,33186
+ ,18
+ ,67
+ ,22
+ ,22807
+ ,183696
+ ,30
+ ,116
+ ,103
+ ,126938
+ ,186657
+ ,29
+ ,107
+ ,72
+ ,61680
+ ,269127
+ ,40
+ ,148
+ ,129
+ ,72117
+ ,194414
+ ,50
+ ,190
+ ,168
+ ,79738
+ ,141409
+ ,33
+ ,109
+ ,100
+ ,57793
+ ,306730
+ ,46
+ ,159
+ ,143
+ ,91677
+ ,192691
+ ,38
+ ,146
+ ,79
+ ,64631
+ ,333497
+ ,52
+ ,201
+ ,183
+ ,106385
+ ,261835
+ ,32
+ ,124
+ ,123
+ ,161961
+ ,263451
+ ,35
+ ,131
+ ,81
+ ,112669
+ ,157448
+ ,25
+ ,96
+ ,74
+ ,114029
+ ,232190
+ ,42
+ ,163
+ ,158
+ ,124550
+ ,245725
+ ,40
+ ,151
+ ,133
+ ,105416
+ ,388603
+ ,35
+ ,128
+ ,128
+ ,72875
+ ,156540
+ ,25
+ ,89
+ ,84
+ ,81964
+ ,156189
+ ,46
+ ,184
+ ,184
+ ,104880
+ ,186381
+ ,36
+ ,136
+ ,127
+ ,76302
+ ,192167
+ ,35
+ ,134
+ ,128
+ ,96740
+ ,249893
+ ,38
+ ,146
+ ,118
+ ,93071
+ ,236812
+ ,35
+ ,130
+ ,125
+ ,78912
+ ,143160
+ ,28
+ ,105
+ ,89
+ ,35224
+ ,259667
+ ,37
+ ,142
+ ,122
+ ,90694
+ ,243020
+ ,40
+ ,155
+ ,151
+ ,125369
+ ,176062
+ ,42
+ ,154
+ ,122
+ ,80849
+ ,286683
+ ,44
+ ,169
+ ,162
+ ,104434
+ ,87485
+ ,33
+ ,125
+ ,121
+ ,65702
+ ,329737
+ ,38
+ ,147
+ ,144
+ ,108179
+ ,247082
+ ,37
+ ,139
+ ,110
+ ,63583
+ ,366219
+ ,41
+ ,151
+ ,141
+ ,95066
+ ,191653
+ ,32
+ ,124
+ ,80
+ ,62486
+ ,114673
+ ,17
+ ,55
+ ,46
+ ,31081
+ ,294371
+ ,38
+ ,147
+ ,140
+ ,94584
+ ,284195
+ ,33
+ ,125
+ ,103
+ ,87408
+ ,155568
+ ,35
+ ,128
+ ,95
+ ,68966
+ ,177306
+ ,32
+ ,107
+ ,100
+ ,88766
+ ,144595
+ ,35
+ ,130
+ ,102
+ ,57139
+ ,140319
+ ,45
+ ,73
+ ,45
+ ,90586
+ ,405267
+ ,38
+ ,138
+ ,122
+ ,109249
+ ,78800
+ ,26
+ ,82
+ ,66
+ ,33032
+ ,201970
+ ,45
+ ,173
+ ,159
+ ,96056
+ ,302705
+ ,44
+ ,169
+ ,153
+ ,146648
+ ,164733
+ ,40
+ ,145
+ ,131
+ ,80613
+ ,194221
+ ,33
+ ,134
+ ,113
+ ,87026
+ ,24188
+ ,4
+ ,12
+ ,7
+ ,5950
+ ,346142
+ ,41
+ ,151
+ ,147
+ ,131106
+ ,65029
+ ,18
+ ,67
+ ,61
+ ,32551
+ ,101097
+ ,14
+ ,52
+ ,41
+ ,31701
+ ,253745
+ ,36
+ ,131
+ ,117
+ ,91072
+ ,273513
+ ,49
+ ,186
+ ,184
+ ,159803
+ ,282220
+ ,32
+ ,120
+ ,115
+ ,143950
+ ,280928
+ ,37
+ ,135
+ ,132
+ ,112368
+ ,214872
+ ,32
+ ,123
+ ,113
+ ,82124
+ ,342048
+ ,43
+ ,166
+ ,149
+ ,144068
+ ,273924
+ ,25
+ ,90
+ ,65
+ ,162627
+ ,194396
+ ,42
+ ,165
+ ,94
+ ,55062
+ ,231162
+ ,37
+ ,143
+ ,126
+ ,95329
+ ,209798
+ ,33
+ ,125
+ ,112
+ ,105612
+ ,201345
+ ,28
+ ,110
+ ,81
+ ,62853
+ ,166424
+ ,31
+ ,121
+ ,116
+ ,125976
+ ,204441
+ ,40
+ ,151
+ ,132
+ ,79146
+ ,197813
+ ,32
+ ,123
+ ,104
+ ,108461
+ ,136421
+ ,25
+ ,92
+ ,80
+ ,99971
+ ,216092
+ ,42
+ ,162
+ ,145
+ ,77826
+ ,73566
+ ,23
+ ,88
+ ,67
+ ,22618
+ ,213998
+ ,42
+ ,163
+ ,159
+ ,84892
+ ,181728
+ ,38
+ ,133
+ ,90
+ ,92059
+ ,148758
+ ,34
+ ,132
+ ,120
+ ,77993
+ ,308343
+ ,39
+ ,147
+ ,129
+ ,104155
+ ,251437
+ ,32
+ ,124
+ ,118
+ ,109840
+ ,202388
+ ,37
+ ,140
+ ,112
+ ,238712
+ ,173286
+ ,34
+ ,132
+ ,123
+ ,67486
+ ,155529
+ ,33
+ ,122
+ ,98
+ ,68007
+ ,132672
+ ,25
+ ,97
+ ,78
+ ,48194
+ ,390163
+ ,45
+ ,175
+ ,138
+ ,134796
+ ,145905
+ ,26
+ ,99
+ ,99
+ ,38692
+ ,228012
+ ,40
+ ,106
+ ,81
+ ,93587
+ ,80953
+ ,8
+ ,28
+ ,27
+ ,56622
+ ,130805
+ ,27
+ ,101
+ ,77
+ ,15986
+ ,135163
+ ,32
+ ,120
+ ,118
+ ,113402
+ ,331003
+ ,37
+ ,143
+ ,137
+ ,97967
+ ,271806
+ ,50
+ ,178
+ ,103
+ ,74844
+ ,162828
+ ,41
+ ,155
+ ,143
+ ,136051
+ ,234092
+ ,37
+ ,138
+ ,85
+ ,50548
+ ,207158
+ ,38
+ ,141
+ ,131
+ ,112215
+ ,156583
+ ,28
+ ,102
+ ,81
+ ,59591
+ ,242395
+ ,36
+ ,140
+ ,135
+ ,59938
+ ,261601
+ ,32
+ ,124
+ ,116
+ ,137639
+ ,178489
+ ,32
+ ,124
+ ,123
+ ,143372
+ ,204221
+ ,33
+ ,119
+ ,119
+ ,138599
+ ,268066
+ ,35
+ ,129
+ ,100
+ ,174110
+ ,318087
+ ,58
+ ,223
+ ,221
+ ,135062
+ ,361799
+ ,27
+ ,102
+ ,95
+ ,175681
+ ,247131
+ ,45
+ ,174
+ ,153
+ ,130307
+ ,265849
+ ,37
+ ,141
+ ,118
+ ,139141
+ ,160309
+ ,32
+ ,122
+ ,50
+ ,44244
+ ,43287
+ ,19
+ ,71
+ ,64
+ ,43750
+ ,172244
+ ,22
+ ,81
+ ,34
+ ,48029
+ ,189021
+ ,35
+ ,131
+ ,76
+ ,95216
+ ,227681
+ ,36
+ ,139
+ ,112
+ ,92288
+ ,269329
+ ,36
+ ,137
+ ,115
+ ,94588
+ ,106503
+ ,23
+ ,91
+ ,69
+ ,197426
+ ,117891
+ ,40
+ ,157
+ ,123
+ ,151244
+ ,287201
+ ,40
+ ,149
+ ,143
+ ,139206
+ ,266805
+ ,42
+ ,155
+ ,110
+ ,106271
+ ,23623
+ ,1
+ ,0
+ ,0
+ ,1168
+ ,174954
+ ,36
+ ,139
+ ,94
+ ,71764
+ ,61857
+ ,11
+ ,32
+ ,30
+ ,25162
+ ,144889
+ ,40
+ ,149
+ ,106
+ ,45635
+ ,347988
+ ,34
+ ,128
+ ,91
+ ,101817
+ ,21054
+ ,0
+ ,0
+ ,0
+ ,855
+ ,224051
+ ,27
+ ,99
+ ,69
+ ,100174
+ ,31414
+ ,8
+ ,25
+ ,9
+ ,14116
+ ,277214
+ ,35
+ ,132
+ ,123
+ ,85008
+ ,209481
+ ,44
+ ,167
+ ,150
+ ,124254
+ ,156870
+ ,40
+ ,151
+ ,125
+ ,105793
+ ,112933
+ ,28
+ ,103
+ ,81
+ ,117129
+ ,38214
+ ,8
+ ,27
+ ,21
+ ,8773
+ ,166011
+ ,36
+ ,135
+ ,128
+ ,94747
+ ,316044
+ ,47
+ ,178
+ ,168
+ ,107549
+ ,181578
+ ,48
+ ,185
+ ,155
+ ,97392
+ ,358903
+ ,45
+ ,175
+ ,157
+ ,126893
+ ,275578
+ ,48
+ ,187
+ ,145
+ ,118850
+ ,368796
+ ,49
+ ,182
+ ,172
+ ,234853
+ ,172464
+ ,35
+ ,135
+ ,126
+ ,74783
+ ,94381
+ ,32
+ ,118
+ ,89
+ ,66089
+ ,249649
+ ,36
+ ,140
+ ,137
+ ,95684
+ ,382499
+ ,42
+ ,158
+ ,149
+ ,139537
+ ,118010
+ ,35
+ ,132
+ ,121
+ ,144253
+ ,365539
+ ,42
+ ,156
+ ,149
+ ,153824
+ ,147989
+ ,34
+ ,123
+ ,93
+ ,63995
+ ,231681
+ ,41
+ ,151
+ ,135
+ ,84891
+ ,193119
+ ,36
+ ,129
+ ,102
+ ,61263
+ ,189020
+ ,32
+ ,125
+ ,45
+ ,106221
+ ,341958
+ ,33
+ ,128
+ ,104
+ ,113587
+ ,219133
+ ,35
+ ,129
+ ,111
+ ,113864
+ ,173260
+ ,21
+ ,79
+ ,78
+ ,37238
+ ,274787
+ ,42
+ ,162
+ ,126
+ ,119906
+ ,130908
+ ,49
+ ,188
+ ,176
+ ,135096
+ ,204009
+ ,33
+ ,122
+ ,109
+ ,151611
+ ,262412
+ ,39
+ ,144
+ ,132
+ ,144645
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,14688
+ ,0
+ ,0
+ ,0
+ ,6023
+ ,98
+ ,0
+ ,0
+ ,0
+ ,0
+ ,455
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,195765
+ ,33
+ ,120
+ ,78
+ ,77457
+ ,330975
+ ,45
+ ,179
+ ,110
+ ,62464
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,203
+ ,0
+ ,0
+ ,0
+ ,0
+ ,7199
+ ,0
+ ,0
+ ,0
+ ,1644
+ ,46660
+ ,5
+ ,15
+ ,13
+ ,6179
+ ,17547
+ ,1
+ ,4
+ ,4
+ ,3926
+ ,107465
+ ,38
+ ,133
+ ,65
+ ,42087
+ ,969
+ ,0
+ ,0
+ ,0
+ ,0
+ ,179994
+ ,28
+ ,101
+ ,55
+ ,87656)
+ ,dim=c(5
+ ,164)
+ ,dimnames=list(c('TimeRFC'
+ ,'RvwdCompend'
+ ,'SubFeedback'
+ ,'sublongfb'
+ ,'compChara')
+ ,1:164))
> y <- array(NA,dim=c(5,164),dimnames=list(c('TimeRFC','RvwdCompend','SubFeedback','sublongfb','compChara'),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
> 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
TimeRFC RvwdCompend SubFeedback sublongfb compChara
1 255202 34 131 104 124252
2 135248 30 117 111 98956
3 198520 38 146 93 98073
4 189326 34 132 119 106816
5 141365 25 80 57 41449
6 65295 31 117 80 76173
7 439387 29 112 107 177551
8 33186 18 67 22 22807
9 183696 30 116 103 126938
10 186657 29 107 72 61680
11 269127 40 148 129 72117
12 194414 50 190 168 79738
13 141409 33 109 100 57793
14 306730 46 159 143 91677
15 192691 38 146 79 64631
16 333497 52 201 183 106385
17 261835 32 124 123 161961
18 263451 35 131 81 112669
19 157448 25 96 74 114029
20 232190 42 163 158 124550
21 245725 40 151 133 105416
22 388603 35 128 128 72875
23 156540 25 89 84 81964
24 156189 46 184 184 104880
25 186381 36 136 127 76302
26 192167 35 134 128 96740
27 249893 38 146 118 93071
28 236812 35 130 125 78912
29 143160 28 105 89 35224
30 259667 37 142 122 90694
31 243020 40 155 151 125369
32 176062 42 154 122 80849
33 286683 44 169 162 104434
34 87485 33 125 121 65702
35 329737 38 147 144 108179
36 247082 37 139 110 63583
37 366219 41 151 141 95066
38 191653 32 124 80 62486
39 114673 17 55 46 31081
40 294371 38 147 140 94584
41 284195 33 125 103 87408
42 155568 35 128 95 68966
43 177306 32 107 100 88766
44 144595 35 130 102 57139
45 140319 45 73 45 90586
46 405267 38 138 122 109249
47 78800 26 82 66 33032
48 201970 45 173 159 96056
49 302705 44 169 153 146648
50 164733 40 145 131 80613
51 194221 33 134 113 87026
52 24188 4 12 7 5950
53 346142 41 151 147 131106
54 65029 18 67 61 32551
55 101097 14 52 41 31701
56 253745 36 131 117 91072
57 273513 49 186 184 159803
58 282220 32 120 115 143950
59 280928 37 135 132 112368
60 214872 32 123 113 82124
61 342048 43 166 149 144068
62 273924 25 90 65 162627
63 194396 42 165 94 55062
64 231162 37 143 126 95329
65 209798 33 125 112 105612
66 201345 28 110 81 62853
67 166424 31 121 116 125976
68 204441 40 151 132 79146
69 197813 32 123 104 108461
70 136421 25 92 80 99971
71 216092 42 162 145 77826
72 73566 23 88 67 22618
73 213998 42 163 159 84892
74 181728 38 133 90 92059
75 148758 34 132 120 77993
76 308343 39 147 129 104155
77 251437 32 124 118 109840
78 202388 37 140 112 238712
79 173286 34 132 123 67486
80 155529 33 122 98 68007
81 132672 25 97 78 48194
82 390163 45 175 138 134796
83 145905 26 99 99 38692
84 228012 40 106 81 93587
85 80953 8 28 27 56622
86 130805 27 101 77 15986
87 135163 32 120 118 113402
88 331003 37 143 137 97967
89 271806 50 178 103 74844
90 162828 41 155 143 136051
91 234092 37 138 85 50548
92 207158 38 141 131 112215
93 156583 28 102 81 59591
94 242395 36 140 135 59938
95 261601 32 124 116 137639
96 178489 32 124 123 143372
97 204221 33 119 119 138599
98 268066 35 129 100 174110
99 318087 58 223 221 135062
100 361799 27 102 95 175681
101 247131 45 174 153 130307
102 265849 37 141 118 139141
103 160309 32 122 50 44244
104 43287 19 71 64 43750
105 172244 22 81 34 48029
106 189021 35 131 76 95216
107 227681 36 139 112 92288
108 269329 36 137 115 94588
109 106503 23 91 69 197426
110 117891 40 157 123 151244
111 287201 40 149 143 139206
112 266805 42 155 110 106271
113 23623 1 0 0 1168
114 174954 36 139 94 71764
115 61857 11 32 30 25162
116 144889 40 149 106 45635
117 347988 34 128 91 101817
118 21054 0 0 0 855
119 224051 27 99 69 100174
120 31414 8 25 9 14116
121 277214 35 132 123 85008
122 209481 44 167 150 124254
123 156870 40 151 125 105793
124 112933 28 103 81 117129
125 38214 8 27 21 8773
126 166011 36 135 128 94747
127 316044 47 178 168 107549
128 181578 48 185 155 97392
129 358903 45 175 157 126893
130 275578 48 187 145 118850
131 368796 49 182 172 234853
132 172464 35 135 126 74783
133 94381 32 118 89 66089
134 249649 36 140 137 95684
135 382499 42 158 149 139537
136 118010 35 132 121 144253
137 365539 42 156 149 153824
138 147989 34 123 93 63995
139 231681 41 151 135 84891
140 193119 36 129 102 61263
141 189020 32 125 45 106221
142 341958 33 128 104 113587
143 219133 35 129 111 113864
144 173260 21 79 78 37238
145 274787 42 162 126 119906
146 130908 49 188 176 135096
147 204009 33 122 109 151611
148 262412 39 144 132 144645
149 1 0 0 0 0
150 14688 0 0 0 6023
151 98 0 0 0 0
152 455 0 0 0 0
153 0 0 0 0 0
154 0 0 0 0 0
155 195765 33 120 78 77457
156 330975 45 179 110 62464
157 0 0 0 0 0
158 203 0 0 0 0
159 7199 0 0 0 1644
160 46660 5 15 13 6179
161 17547 1 4 4 3926
162 107465 38 133 65 42087
163 969 0 0 0 0
164 179994 28 101 55 87656
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) RvwdCompend SubFeedback sublongfb compChara
6942.5436 1569.0423 409.2360 298.1868 0.6783
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-173966 -33146 -1284 28213 188774
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.943e+03 1.285e+04 0.540 0.590
RvwdCompend 1.569e+03 1.962e+03 0.800 0.425
SubFeedback 4.092e+02 5.938e+02 0.689 0.492
sublongfb 2.982e+02 2.976e+02 1.002 0.318
compChara 6.783e-01 1.414e-01 4.797 3.68e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 60730 on 159 degrees of freedom
Multiple R-squared: 0.6358, Adjusted R-squared: 0.6267
F-statistic: 69.41 on 4 and 159 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.3511951 7.023902e-01 6.488049e-01
[2,] 0.4493145 8.986290e-01 5.506855e-01
[3,] 0.5435032 9.129937e-01 4.564968e-01
[4,] 0.7728444 4.543112e-01 2.271556e-01
[5,] 0.6881695 6.236610e-01 3.118305e-01
[6,] 0.7230816 5.538368e-01 2.769184e-01
[7,] 0.6377966 7.244069e-01 3.622034e-01
[8,] 0.5767692 8.464616e-01 4.232308e-01
[9,] 0.5988138 8.023725e-01 4.011862e-01
[10,] 0.5783738 8.432525e-01 4.216262e-01
[11,] 0.4992953 9.985906e-01 5.007047e-01
[12,] 0.4481449 8.962898e-01 5.518551e-01
[13,] 0.3903466 7.806931e-01 6.096534e-01
[14,] 0.3170964 6.341928e-01 6.829036e-01
[15,] 0.9054098 1.891803e-01 9.459017e-02
[16,] 0.8758857 2.482286e-01 1.241143e-01
[17,] 0.8970847 2.058307e-01 1.029153e-01
[18,] 0.8653648 2.692704e-01 1.346352e-01
[19,] 0.8289517 3.420967e-01 1.710483e-01
[20,] 0.8042213 3.915573e-01 1.957787e-01
[21,] 0.7774743 4.450514e-01 2.225257e-01
[22,] 0.7600559 4.798883e-01 2.399441e-01
[23,] 0.7441361 5.117279e-01 2.558639e-01
[24,] 0.7008225 5.983551e-01 2.991775e-01
[25,] 0.6989794 6.020412e-01 3.010206e-01
[26,] 0.6589222 6.821555e-01 3.410778e-01
[27,] 0.6964042 6.071916e-01 3.035958e-01
[28,] 0.7565950 4.868101e-01 2.434050e-01
[29,] 0.7644447 4.711106e-01 2.355553e-01
[30,] 0.8437027 3.125947e-01 1.562973e-01
[31,] 0.8305063 3.389874e-01 1.694937e-01
[32,] 0.8002294 3.995412e-01 1.997706e-01
[33,] 0.8096032 3.807936e-01 1.903968e-01
[34,] 0.8367040 3.265920e-01 1.632960e-01
[35,] 0.8172405 3.655190e-01 1.827595e-01
[36,] 0.8196825 3.606349e-01 1.803175e-01
[37,] 0.7935238 4.129525e-01 2.064762e-01
[38,] 0.8498947 3.002105e-01 1.501053e-01
[39,] 0.9600502 7.989961e-02 3.994980e-02
[40,] 0.9526523 9.469535e-02 4.734768e-02
[41,] 0.9520147 9.597065e-02 4.798533e-02
[42,] 0.9398374 1.203252e-01 6.016260e-02
[43,] 0.9374276 1.251448e-01 6.257239e-02
[44,] 0.9217605 1.564790e-01 7.823952e-02
[45,] 0.9024040 1.951920e-01 9.759601e-02
[46,] 0.9061582 1.876836e-01 9.384180e-02
[47,] 0.8908230 2.183541e-01 1.091770e-01
[48,] 0.8695148 2.609704e-01 1.304852e-01
[49,] 0.8519984 2.960032e-01 1.480016e-01
[50,] 0.8603027 2.793946e-01 1.396973e-01
[51,] 0.8419353 3.161293e-01 1.580647e-01
[52,] 0.8241554 3.516892e-01 1.758446e-01
[53,] 0.7943747 4.112506e-01 2.056253e-01
[54,] 0.7830214 4.339572e-01 2.169786e-01
[55,] 0.7726041 4.547918e-01 2.273959e-01
[56,] 0.7406545 5.186909e-01 2.593455e-01
[57,] 0.7018184 5.963632e-01 2.981816e-01
[58,] 0.6641706 6.716589e-01 3.358294e-01
[59,] 0.6396110 7.207780e-01 3.603890e-01
[60,] 0.6613040 6.773920e-01 3.386960e-01
[61,] 0.6214143 7.571714e-01 3.785857e-01
[62,] 0.5841376 8.317248e-01 4.158624e-01
[63,] 0.5677962 8.644077e-01 4.322038e-01
[64,] 0.5249731 9.500539e-01 4.750269e-01
[65,] 0.4947644 9.895287e-01 5.052356e-01
[66,] 0.4585018 9.170037e-01 5.414982e-01
[67,] 0.4247341 8.494682e-01 5.752659e-01
[68,] 0.4144694 8.289388e-01 5.855306e-01
[69,] 0.4281028 8.562057e-01 5.718972e-01
[70,] 0.3964871 7.929742e-01 6.035129e-01
[71,] 0.5753095 8.493811e-01 4.246905e-01
[72,] 0.5363635 9.272731e-01 4.636365e-01
[73,] 0.4998357 9.996715e-01 5.001643e-01
[74,] 0.4550929 9.101859e-01 5.449071e-01
[75,] 0.5542337 8.915327e-01 4.457663e-01
[76,] 0.5088918 9.822164e-01 4.911082e-01
[77,] 0.4724531 9.449063e-01 5.275469e-01
[78,] 0.4278205 8.556410e-01 5.721795e-01
[79,] 0.3857378 7.714756e-01 6.142622e-01
[80,] 0.4241788 8.483576e-01 5.758212e-01
[81,] 0.5021723 9.956553e-01 4.978277e-01
[82,] 0.4695157 9.390313e-01 5.304843e-01
[83,] 0.5615769 8.768463e-01 4.384231e-01
[84,] 0.5497482 9.005035e-01 4.502518e-01
[85,] 0.5155079 9.689843e-01 4.844921e-01
[86,] 0.4694264 9.388527e-01 5.305736e-01
[87,] 0.4457321 8.914642e-01 5.542679e-01
[88,] 0.4106545 8.213091e-01 5.893455e-01
[89,] 0.4102594 8.205189e-01 5.897406e-01
[90,] 0.3763062 7.526124e-01 6.236938e-01
[91,] 0.3343951 6.687902e-01 6.656049e-01
[92,] 0.3008614 6.017228e-01 6.991386e-01
[93,] 0.4603337 9.206673e-01 5.396663e-01
[94,] 0.4280619 8.561239e-01 5.719381e-01
[95,] 0.3890878 7.781757e-01 6.109122e-01
[96,] 0.3447770 6.895540e-01 6.552230e-01
[97,] 0.3581637 7.163273e-01 6.418363e-01
[98,] 0.3505545 7.011089e-01 6.494455e-01
[99,] 0.3094427 6.188853e-01 6.905573e-01
[100,] 0.2699638 5.399276e-01 7.300362e-01
[101,] 0.2596563 5.193126e-01 7.403437e-01
[102,] 0.3701147 7.402293e-01 6.298853e-01
[103,] 0.6540218 6.919565e-01 3.459782e-01
[104,] 0.6156799 7.686401e-01 3.843201e-01
[105,] 0.5808843 8.382315e-01 4.191157e-01
[106,] 0.5361679 9.276643e-01 4.638321e-01
[107,] 0.4964054 9.928109e-01 5.035946e-01
[108,] 0.4534079 9.068158e-01 5.465921e-01
[109,] 0.4248219 8.496439e-01 5.751781e-01
[110,] 0.6327670 7.344661e-01 3.672330e-01
[111,] 0.5845924 8.308152e-01 4.154076e-01
[112,] 0.5734486 8.531028e-01 4.265514e-01
[113,] 0.5220741 9.558518e-01 4.779259e-01
[114,] 0.5460080 9.079840e-01 4.539920e-01
[115,] 0.5410374 9.179252e-01 4.589626e-01
[116,] 0.5773632 8.452737e-01 4.226368e-01
[117,] 0.6100579 7.798841e-01 3.899421e-01
[118,] 0.5565467 8.869066e-01 4.434533e-01
[119,] 0.5368766 9.262468e-01 4.631234e-01
[120,] 0.5115469 9.769061e-01 4.884531e-01
[121,] 0.5929124 8.141753e-01 4.070876e-01
[122,] 0.5992352 8.015296e-01 4.007648e-01
[123,] 0.5512262 8.975475e-01 4.487738e-01
[124,] 0.4955130 9.910261e-01 5.044870e-01
[125,] 0.4641042 9.282084e-01 5.358958e-01
[126,] 0.5062393 9.875214e-01 4.937607e-01
[127,] 0.4461135 8.922270e-01 5.538865e-01
[128,] 0.6035522 7.928956e-01 3.964478e-01
[129,] 0.7905621 4.188758e-01 2.094379e-01
[130,] 0.8729688 2.540625e-01 1.270312e-01
[131,] 0.8383716 3.232568e-01 1.616284e-01
[132,] 0.7991282 4.017436e-01 2.008718e-01
[133,] 0.7656779 4.686441e-01 2.343221e-01
[134,] 0.8580393 2.839215e-01 1.419607e-01
[135,] 0.9433792 1.132417e-01 5.662083e-02
[136,] 0.9300621 1.398757e-01 6.993786e-02
[137,] 0.9947209 1.055829e-02 5.279144e-03
[138,] 0.9903266 1.934684e-02 9.673419e-03
[139,] 0.9999873 2.544579e-05 1.272289e-05
[140,] 0.9999960 7.942300e-06 3.971150e-06
[141,] 0.9999998 3.957290e-07 1.978645e-07
[142,] 0.9999989 2.180094e-06 1.090047e-06
[143,] 0.9999943 1.136546e-05 5.682728e-06
[144,] 0.9999708 5.833732e-05 2.916866e-05
[145,] 0.9998575 2.850790e-04 1.425395e-04
[146,] 0.9993541 1.291805e-03 6.459024e-04
[147,] 0.9972792 5.441549e-03 2.720775e-03
[148,] 0.9999906 1.881082e-05 9.405411e-06
[149,] 0.9999279 1.442837e-04 7.214185e-05
> postscript(file="/var/wessaorg/rcomp/tmp/12pgf1323799974.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/248d81323799974.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/3hz911323799974.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/4u3l81323799974.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/5xvra1323799974.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
26014.33716 -66863.99336 -22045.90083 -32917.39497 17347.27995
6 7 8 9 10
-113689.23115 188774.38840 -51447.51810 -34600.59867 27118.86719
11 12 13 14 15
51474.97894 -72914.73342 -30936.57162 57720.56319 -1017.59820
16 17 18 19 20
35981.93753 7407.66121 47408.98690 -27415.46903 -38949.76578
21 22 23 24 25
3066.82908 186764.96890 -6691.97521 -124232.18809 -22326.20397
26 27 28 29 30
-28313.34763 25265.13240 30955.34467 -1115.49782 38664.61788
31 32 33 34 35
-20175.98815 -51018.86273 22401.05472 -103034.70398 86699.74409
36 37 38 39 40
49274.13094 126626.38107 17518.54861 23750.87093 61747.56462
41 42 43 44 45
84320.14205 -33778.51065 -13660.09716 -39635.39756 -41964.79812
46 47 48 49 50
171747.22985 -44579.92174 -58940.82959 12474.26936 -58050.26400
51 52 53 54 55
-12059.75123 -64.55569 80315.42898 -37842.86176 17180.11284
56 57 58 59 60
40047.80440 -49686.38021 44031.41093 45107.58947 17986.76390
61 62 63 64 65
57556.70213 61237.08940 -11346.69323 5413.85567 -5107.75651
66 67 68 69 70
38668.91001 -58711.75442 -20100.84552 -14252.13733 -39059.53398
71 72 73 74 75
-19070.63908 -40796.89958 -30541.14257 -28544.15990 -54233.82129
76 77 78 79 80
70938.86043 33852.67758 -115210.13005 -23473.80460 -28468.11015
81 82 83 84 85
-9139.58276 108419.46302 1888.89604 27298.41314 3543.49293
86 87 88 89 90
6362.27810 -83200.37423 100185.52580 32089.69275 -106796.81017
91 92 93 94 95
52989.27986 -32284.90675 -606.68705 40764.55882 25757.83865
96 97 98 99 100
-63329.98790 -32690.72280 5503.35568 -28627.34056 123263.43870
101 102 103 104 105
-35631.35175 13588.48089 8311.61669 -71281.34813 54919.45473
106 107 108 109 110
-13692.24219 11376.07488 51387.96666 -128250.90808 -155324.45125
111 112 113 114 115
19460.70797 25650.17706 14319.19543 -22062.76002 -1452.78134
116 117 118 119 120
-48352.02843 139121.44907 13531.53605 45710.09582 -10569.91482
121 122 123 124 125
67000.51573 -63847.53200 -83658.38392 -83692.19094 -4542.63499
126 127 128 129 130
-55095.83489 39469.87360 -88664.20912 76854.27688 -7055.11885
131 132 133 134 135
-92.31693 -32936.44756 -82425.52166 23176.76524 105923.87129
136 137 138 139 140
-131791.18448 80091.90759 -33774.23727 778.89371 4931.61292
141 142 143 144 145
-4751.26319 122800.83118 -5846.67779 52521.95448 16748.33190
146 147 148 149 150
-173966.35420 -39974.20471 -2122.12227 -6941.54356 3660.23951
151 152 153 154 155
-6844.54356 -6487.54356 -6942.54356 -6942.54356 12140.45195
156 157 158 159 160
105004.33628 -6942.54356 -6739.54356 -858.61855 17666.24939
161 162 163 164
3542.83699 -61458.00813 -5973.54356 11930.77409
> postscript(file="/var/wessaorg/rcomp/tmp/64u4m1323799974.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 26014.33716 NA
1 -66863.99336 26014.33716
2 -22045.90083 -66863.99336
3 -32917.39497 -22045.90083
4 17347.27995 -32917.39497
5 -113689.23115 17347.27995
6 188774.38840 -113689.23115
7 -51447.51810 188774.38840
8 -34600.59867 -51447.51810
9 27118.86719 -34600.59867
10 51474.97894 27118.86719
11 -72914.73342 51474.97894
12 -30936.57162 -72914.73342
13 57720.56319 -30936.57162
14 -1017.59820 57720.56319
15 35981.93753 -1017.59820
16 7407.66121 35981.93753
17 47408.98690 7407.66121
18 -27415.46903 47408.98690
19 -38949.76578 -27415.46903
20 3066.82908 -38949.76578
21 186764.96890 3066.82908
22 -6691.97521 186764.96890
23 -124232.18809 -6691.97521
24 -22326.20397 -124232.18809
25 -28313.34763 -22326.20397
26 25265.13240 -28313.34763
27 30955.34467 25265.13240
28 -1115.49782 30955.34467
29 38664.61788 -1115.49782
30 -20175.98815 38664.61788
31 -51018.86273 -20175.98815
32 22401.05472 -51018.86273
33 -103034.70398 22401.05472
34 86699.74409 -103034.70398
35 49274.13094 86699.74409
36 126626.38107 49274.13094
37 17518.54861 126626.38107
38 23750.87093 17518.54861
39 61747.56462 23750.87093
40 84320.14205 61747.56462
41 -33778.51065 84320.14205
42 -13660.09716 -33778.51065
43 -39635.39756 -13660.09716
44 -41964.79812 -39635.39756
45 171747.22985 -41964.79812
46 -44579.92174 171747.22985
47 -58940.82959 -44579.92174
48 12474.26936 -58940.82959
49 -58050.26400 12474.26936
50 -12059.75123 -58050.26400
51 -64.55569 -12059.75123
52 80315.42898 -64.55569
53 -37842.86176 80315.42898
54 17180.11284 -37842.86176
55 40047.80440 17180.11284
56 -49686.38021 40047.80440
57 44031.41093 -49686.38021
58 45107.58947 44031.41093
59 17986.76390 45107.58947
60 57556.70213 17986.76390
61 61237.08940 57556.70213
62 -11346.69323 61237.08940
63 5413.85567 -11346.69323
64 -5107.75651 5413.85567
65 38668.91001 -5107.75651
66 -58711.75442 38668.91001
67 -20100.84552 -58711.75442
68 -14252.13733 -20100.84552
69 -39059.53398 -14252.13733
70 -19070.63908 -39059.53398
71 -40796.89958 -19070.63908
72 -30541.14257 -40796.89958
73 -28544.15990 -30541.14257
74 -54233.82129 -28544.15990
75 70938.86043 -54233.82129
76 33852.67758 70938.86043
77 -115210.13005 33852.67758
78 -23473.80460 -115210.13005
79 -28468.11015 -23473.80460
80 -9139.58276 -28468.11015
81 108419.46302 -9139.58276
82 1888.89604 108419.46302
83 27298.41314 1888.89604
84 3543.49293 27298.41314
85 6362.27810 3543.49293
86 -83200.37423 6362.27810
87 100185.52580 -83200.37423
88 32089.69275 100185.52580
89 -106796.81017 32089.69275
90 52989.27986 -106796.81017
91 -32284.90675 52989.27986
92 -606.68705 -32284.90675
93 40764.55882 -606.68705
94 25757.83865 40764.55882
95 -63329.98790 25757.83865
96 -32690.72280 -63329.98790
97 5503.35568 -32690.72280
98 -28627.34056 5503.35568
99 123263.43870 -28627.34056
100 -35631.35175 123263.43870
101 13588.48089 -35631.35175
102 8311.61669 13588.48089
103 -71281.34813 8311.61669
104 54919.45473 -71281.34813
105 -13692.24219 54919.45473
106 11376.07488 -13692.24219
107 51387.96666 11376.07488
108 -128250.90808 51387.96666
109 -155324.45125 -128250.90808
110 19460.70797 -155324.45125
111 25650.17706 19460.70797
112 14319.19543 25650.17706
113 -22062.76002 14319.19543
114 -1452.78134 -22062.76002
115 -48352.02843 -1452.78134
116 139121.44907 -48352.02843
117 13531.53605 139121.44907
118 45710.09582 13531.53605
119 -10569.91482 45710.09582
120 67000.51573 -10569.91482
121 -63847.53200 67000.51573
122 -83658.38392 -63847.53200
123 -83692.19094 -83658.38392
124 -4542.63499 -83692.19094
125 -55095.83489 -4542.63499
126 39469.87360 -55095.83489
127 -88664.20912 39469.87360
128 76854.27688 -88664.20912
129 -7055.11885 76854.27688
130 -92.31693 -7055.11885
131 -32936.44756 -92.31693
132 -82425.52166 -32936.44756
133 23176.76524 -82425.52166
134 105923.87129 23176.76524
135 -131791.18448 105923.87129
136 80091.90759 -131791.18448
137 -33774.23727 80091.90759
138 778.89371 -33774.23727
139 4931.61292 778.89371
140 -4751.26319 4931.61292
141 122800.83118 -4751.26319
142 -5846.67779 122800.83118
143 52521.95448 -5846.67779
144 16748.33190 52521.95448
145 -173966.35420 16748.33190
146 -39974.20471 -173966.35420
147 -2122.12227 -39974.20471
148 -6941.54356 -2122.12227
149 3660.23951 -6941.54356
150 -6844.54356 3660.23951
151 -6487.54356 -6844.54356
152 -6942.54356 -6487.54356
153 -6942.54356 -6942.54356
154 12140.45195 -6942.54356
155 105004.33628 12140.45195
156 -6942.54356 105004.33628
157 -6739.54356 -6942.54356
158 -858.61855 -6739.54356
159 17666.24939 -858.61855
160 3542.83699 17666.24939
161 -61458.00813 3542.83699
162 -5973.54356 -61458.00813
163 11930.77409 -5973.54356
164 NA 11930.77409
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -66863.99336 26014.33716
[2,] -22045.90083 -66863.99336
[3,] -32917.39497 -22045.90083
[4,] 17347.27995 -32917.39497
[5,] -113689.23115 17347.27995
[6,] 188774.38840 -113689.23115
[7,] -51447.51810 188774.38840
[8,] -34600.59867 -51447.51810
[9,] 27118.86719 -34600.59867
[10,] 51474.97894 27118.86719
[11,] -72914.73342 51474.97894
[12,] -30936.57162 -72914.73342
[13,] 57720.56319 -30936.57162
[14,] -1017.59820 57720.56319
[15,] 35981.93753 -1017.59820
[16,] 7407.66121 35981.93753
[17,] 47408.98690 7407.66121
[18,] -27415.46903 47408.98690
[19,] -38949.76578 -27415.46903
[20,] 3066.82908 -38949.76578
[21,] 186764.96890 3066.82908
[22,] -6691.97521 186764.96890
[23,] -124232.18809 -6691.97521
[24,] -22326.20397 -124232.18809
[25,] -28313.34763 -22326.20397
[26,] 25265.13240 -28313.34763
[27,] 30955.34467 25265.13240
[28,] -1115.49782 30955.34467
[29,] 38664.61788 -1115.49782
[30,] -20175.98815 38664.61788
[31,] -51018.86273 -20175.98815
[32,] 22401.05472 -51018.86273
[33,] -103034.70398 22401.05472
[34,] 86699.74409 -103034.70398
[35,] 49274.13094 86699.74409
[36,] 126626.38107 49274.13094
[37,] 17518.54861 126626.38107
[38,] 23750.87093 17518.54861
[39,] 61747.56462 23750.87093
[40,] 84320.14205 61747.56462
[41,] -33778.51065 84320.14205
[42,] -13660.09716 -33778.51065
[43,] -39635.39756 -13660.09716
[44,] -41964.79812 -39635.39756
[45,] 171747.22985 -41964.79812
[46,] -44579.92174 171747.22985
[47,] -58940.82959 -44579.92174
[48,] 12474.26936 -58940.82959
[49,] -58050.26400 12474.26936
[50,] -12059.75123 -58050.26400
[51,] -64.55569 -12059.75123
[52,] 80315.42898 -64.55569
[53,] -37842.86176 80315.42898
[54,] 17180.11284 -37842.86176
[55,] 40047.80440 17180.11284
[56,] -49686.38021 40047.80440
[57,] 44031.41093 -49686.38021
[58,] 45107.58947 44031.41093
[59,] 17986.76390 45107.58947
[60,] 57556.70213 17986.76390
[61,] 61237.08940 57556.70213
[62,] -11346.69323 61237.08940
[63,] 5413.85567 -11346.69323
[64,] -5107.75651 5413.85567
[65,] 38668.91001 -5107.75651
[66,] -58711.75442 38668.91001
[67,] -20100.84552 -58711.75442
[68,] -14252.13733 -20100.84552
[69,] -39059.53398 -14252.13733
[70,] -19070.63908 -39059.53398
[71,] -40796.89958 -19070.63908
[72,] -30541.14257 -40796.89958
[73,] -28544.15990 -30541.14257
[74,] -54233.82129 -28544.15990
[75,] 70938.86043 -54233.82129
[76,] 33852.67758 70938.86043
[77,] -115210.13005 33852.67758
[78,] -23473.80460 -115210.13005
[79,] -28468.11015 -23473.80460
[80,] -9139.58276 -28468.11015
[81,] 108419.46302 -9139.58276
[82,] 1888.89604 108419.46302
[83,] 27298.41314 1888.89604
[84,] 3543.49293 27298.41314
[85,] 6362.27810 3543.49293
[86,] -83200.37423 6362.27810
[87,] 100185.52580 -83200.37423
[88,] 32089.69275 100185.52580
[89,] -106796.81017 32089.69275
[90,] 52989.27986 -106796.81017
[91,] -32284.90675 52989.27986
[92,] -606.68705 -32284.90675
[93,] 40764.55882 -606.68705
[94,] 25757.83865 40764.55882
[95,] -63329.98790 25757.83865
[96,] -32690.72280 -63329.98790
[97,] 5503.35568 -32690.72280
[98,] -28627.34056 5503.35568
[99,] 123263.43870 -28627.34056
[100,] -35631.35175 123263.43870
[101,] 13588.48089 -35631.35175
[102,] 8311.61669 13588.48089
[103,] -71281.34813 8311.61669
[104,] 54919.45473 -71281.34813
[105,] -13692.24219 54919.45473
[106,] 11376.07488 -13692.24219
[107,] 51387.96666 11376.07488
[108,] -128250.90808 51387.96666
[109,] -155324.45125 -128250.90808
[110,] 19460.70797 -155324.45125
[111,] 25650.17706 19460.70797
[112,] 14319.19543 25650.17706
[113,] -22062.76002 14319.19543
[114,] -1452.78134 -22062.76002
[115,] -48352.02843 -1452.78134
[116,] 139121.44907 -48352.02843
[117,] 13531.53605 139121.44907
[118,] 45710.09582 13531.53605
[119,] -10569.91482 45710.09582
[120,] 67000.51573 -10569.91482
[121,] -63847.53200 67000.51573
[122,] -83658.38392 -63847.53200
[123,] -83692.19094 -83658.38392
[124,] -4542.63499 -83692.19094
[125,] -55095.83489 -4542.63499
[126,] 39469.87360 -55095.83489
[127,] -88664.20912 39469.87360
[128,] 76854.27688 -88664.20912
[129,] -7055.11885 76854.27688
[130,] -92.31693 -7055.11885
[131,] -32936.44756 -92.31693
[132,] -82425.52166 -32936.44756
[133,] 23176.76524 -82425.52166
[134,] 105923.87129 23176.76524
[135,] -131791.18448 105923.87129
[136,] 80091.90759 -131791.18448
[137,] -33774.23727 80091.90759
[138,] 778.89371 -33774.23727
[139,] 4931.61292 778.89371
[140,] -4751.26319 4931.61292
[141,] 122800.83118 -4751.26319
[142,] -5846.67779 122800.83118
[143,] 52521.95448 -5846.67779
[144,] 16748.33190 52521.95448
[145,] -173966.35420 16748.33190
[146,] -39974.20471 -173966.35420
[147,] -2122.12227 -39974.20471
[148,] -6941.54356 -2122.12227
[149,] 3660.23951 -6941.54356
[150,] -6844.54356 3660.23951
[151,] -6487.54356 -6844.54356
[152,] -6942.54356 -6487.54356
[153,] -6942.54356 -6942.54356
[154,] 12140.45195 -6942.54356
[155,] 105004.33628 12140.45195
[156,] -6942.54356 105004.33628
[157,] -6739.54356 -6942.54356
[158,] -858.61855 -6739.54356
[159,] 17666.24939 -858.61855
[160,] 3542.83699 17666.24939
[161,] -61458.00813 3542.83699
[162,] -5973.54356 -61458.00813
[163,] 11930.77409 -5973.54356
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -66863.99336 26014.33716
2 -22045.90083 -66863.99336
3 -32917.39497 -22045.90083
4 17347.27995 -32917.39497
5 -113689.23115 17347.27995
6 188774.38840 -113689.23115
7 -51447.51810 188774.38840
8 -34600.59867 -51447.51810
9 27118.86719 -34600.59867
10 51474.97894 27118.86719
11 -72914.73342 51474.97894
12 -30936.57162 -72914.73342
13 57720.56319 -30936.57162
14 -1017.59820 57720.56319
15 35981.93753 -1017.59820
16 7407.66121 35981.93753
17 47408.98690 7407.66121
18 -27415.46903 47408.98690
19 -38949.76578 -27415.46903
20 3066.82908 -38949.76578
21 186764.96890 3066.82908
22 -6691.97521 186764.96890
23 -124232.18809 -6691.97521
24 -22326.20397 -124232.18809
25 -28313.34763 -22326.20397
26 25265.13240 -28313.34763
27 30955.34467 25265.13240
28 -1115.49782 30955.34467
29 38664.61788 -1115.49782
30 -20175.98815 38664.61788
31 -51018.86273 -20175.98815
32 22401.05472 -51018.86273
33 -103034.70398 22401.05472
34 86699.74409 -103034.70398
35 49274.13094 86699.74409
36 126626.38107 49274.13094
37 17518.54861 126626.38107
38 23750.87093 17518.54861
39 61747.56462 23750.87093
40 84320.14205 61747.56462
41 -33778.51065 84320.14205
42 -13660.09716 -33778.51065
43 -39635.39756 -13660.09716
44 -41964.79812 -39635.39756
45 171747.22985 -41964.79812
46 -44579.92174 171747.22985
47 -58940.82959 -44579.92174
48 12474.26936 -58940.82959
49 -58050.26400 12474.26936
50 -12059.75123 -58050.26400
51 -64.55569 -12059.75123
52 80315.42898 -64.55569
53 -37842.86176 80315.42898
54 17180.11284 -37842.86176
55 40047.80440 17180.11284
56 -49686.38021 40047.80440
57 44031.41093 -49686.38021
58 45107.58947 44031.41093
59 17986.76390 45107.58947
60 57556.70213 17986.76390
61 61237.08940 57556.70213
62 -11346.69323 61237.08940
63 5413.85567 -11346.69323
64 -5107.75651 5413.85567
65 38668.91001 -5107.75651
66 -58711.75442 38668.91001
67 -20100.84552 -58711.75442
68 -14252.13733 -20100.84552
69 -39059.53398 -14252.13733
70 -19070.63908 -39059.53398
71 -40796.89958 -19070.63908
72 -30541.14257 -40796.89958
73 -28544.15990 -30541.14257
74 -54233.82129 -28544.15990
75 70938.86043 -54233.82129
76 33852.67758 70938.86043
77 -115210.13005 33852.67758
78 -23473.80460 -115210.13005
79 -28468.11015 -23473.80460
80 -9139.58276 -28468.11015
81 108419.46302 -9139.58276
82 1888.89604 108419.46302
83 27298.41314 1888.89604
84 3543.49293 27298.41314
85 6362.27810 3543.49293
86 -83200.37423 6362.27810
87 100185.52580 -83200.37423
88 32089.69275 100185.52580
89 -106796.81017 32089.69275
90 52989.27986 -106796.81017
91 -32284.90675 52989.27986
92 -606.68705 -32284.90675
93 40764.55882 -606.68705
94 25757.83865 40764.55882
95 -63329.98790 25757.83865
96 -32690.72280 -63329.98790
97 5503.35568 -32690.72280
98 -28627.34056 5503.35568
99 123263.43870 -28627.34056
100 -35631.35175 123263.43870
101 13588.48089 -35631.35175
102 8311.61669 13588.48089
103 -71281.34813 8311.61669
104 54919.45473 -71281.34813
105 -13692.24219 54919.45473
106 11376.07488 -13692.24219
107 51387.96666 11376.07488
108 -128250.90808 51387.96666
109 -155324.45125 -128250.90808
110 19460.70797 -155324.45125
111 25650.17706 19460.70797
112 14319.19543 25650.17706
113 -22062.76002 14319.19543
114 -1452.78134 -22062.76002
115 -48352.02843 -1452.78134
116 139121.44907 -48352.02843
117 13531.53605 139121.44907
118 45710.09582 13531.53605
119 -10569.91482 45710.09582
120 67000.51573 -10569.91482
121 -63847.53200 67000.51573
122 -83658.38392 -63847.53200
123 -83692.19094 -83658.38392
124 -4542.63499 -83692.19094
125 -55095.83489 -4542.63499
126 39469.87360 -55095.83489
127 -88664.20912 39469.87360
128 76854.27688 -88664.20912
129 -7055.11885 76854.27688
130 -92.31693 -7055.11885
131 -32936.44756 -92.31693
132 -82425.52166 -32936.44756
133 23176.76524 -82425.52166
134 105923.87129 23176.76524
135 -131791.18448 105923.87129
136 80091.90759 -131791.18448
137 -33774.23727 80091.90759
138 778.89371 -33774.23727
139 4931.61292 778.89371
140 -4751.26319 4931.61292
141 122800.83118 -4751.26319
142 -5846.67779 122800.83118
143 52521.95448 -5846.67779
144 16748.33190 52521.95448
145 -173966.35420 16748.33190
146 -39974.20471 -173966.35420
147 -2122.12227 -39974.20471
148 -6941.54356 -2122.12227
149 3660.23951 -6941.54356
150 -6844.54356 3660.23951
151 -6487.54356 -6844.54356
152 -6942.54356 -6487.54356
153 -6942.54356 -6942.54356
154 12140.45195 -6942.54356
155 105004.33628 12140.45195
156 -6942.54356 105004.33628
157 -6739.54356 -6942.54356
158 -858.61855 -6739.54356
159 17666.24939 -858.61855
160 3542.83699 17666.24939
161 -61458.00813 3542.83699
162 -5973.54356 -61458.00813
163 11930.77409 -5973.54356
> 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/7kc9a1323799974.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/85bn71323799974.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/904m51323799974.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/10dzdv1323799974.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/11ynws1323799974.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/12qi1o1323799974.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/13dsyi1323799975.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/14n3571323799975.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/15gfil1323799975.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/16q5sq1323799975.tab")
+ }
>
> try(system("convert tmp/12pgf1323799974.ps tmp/12pgf1323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/248d81323799974.ps tmp/248d81323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/3hz911323799974.ps tmp/3hz911323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/4u3l81323799974.ps tmp/4u3l81323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/5xvra1323799974.ps tmp/5xvra1323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/64u4m1323799974.ps tmp/64u4m1323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/7kc9a1323799974.ps tmp/7kc9a1323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/85bn71323799974.ps tmp/85bn71323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/904m51323799974.ps tmp/904m51323799974.png",intern=TRUE))
character(0)
> try(system("convert tmp/10dzdv1323799974.ps tmp/10dzdv1323799974.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.006 0.636 5.654