R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(158258
+ ,48
+ ,18
+ ,63
+ ,20465
+ ,23975
+ ,186930
+ ,53
+ ,20
+ ,56
+ ,33629
+ ,85634
+ ,7215
+ ,0
+ ,0
+ ,0
+ ,1423
+ ,1929
+ ,128162
+ ,51
+ ,27
+ ,63
+ ,25629
+ ,36294
+ ,226974
+ ,76
+ ,31
+ ,116
+ ,54002
+ ,72255
+ ,500344
+ ,125
+ ,36
+ ,138
+ ,151036
+ ,189748
+ ,171007
+ ,59
+ ,23
+ ,71
+ ,33287
+ ,61834
+ ,179835
+ ,80
+ ,30
+ ,107
+ ,31172
+ ,68167
+ ,154581
+ ,55
+ ,30
+ ,50
+ ,28113
+ ,38462
+ ,278960
+ ,67
+ ,26
+ ,79
+ ,57803
+ ,101219
+ ,121844
+ ,50
+ ,24
+ ,58
+ ,49830
+ ,43270
+ ,183086
+ ,77
+ ,30
+ ,91
+ ,52143
+ ,76183
+ ,98796
+ ,44
+ ,22
+ ,41
+ ,21055
+ ,31476
+ ,209322
+ ,79
+ ,25
+ ,91
+ ,47007
+ ,62157
+ ,157125
+ ,51
+ ,18
+ ,61
+ ,28735
+ ,46261
+ ,154565
+ ,54
+ ,22
+ ,74
+ ,59147
+ ,50063
+ ,134198
+ ,75
+ ,33
+ ,131
+ ,78950
+ ,64483
+ ,69128
+ ,2
+ ,15
+ ,45
+ ,13497
+ ,2341
+ ,150680
+ ,73
+ ,34
+ ,110
+ ,46154
+ ,48149
+ ,27997
+ ,13
+ ,18
+ ,41
+ ,53249
+ ,12743
+ ,69919
+ ,19
+ ,15
+ ,37
+ ,10726
+ ,18743
+ ,233044
+ ,93
+ ,30
+ ,84
+ ,83700
+ ,97057
+ ,195820
+ ,38
+ ,25
+ ,67
+ ,40400
+ ,17675
+ ,127994
+ ,48
+ ,34
+ ,69
+ ,33797
+ ,33106
+ ,145433
+ ,50
+ ,21
+ ,58
+ ,36205
+ ,53311
+ ,170864
+ ,48
+ ,21
+ ,60
+ ,30165
+ ,42754
+ ,199655
+ ,60
+ ,25
+ ,88
+ ,58534
+ ,59056
+ ,188633
+ ,81
+ ,31
+ ,75
+ ,44663
+ ,101621
+ ,354266
+ ,60
+ ,31
+ ,98
+ ,92556
+ ,118120
+ ,192399
+ ,52
+ ,20
+ ,67
+ ,40078
+ ,79572
+ ,165753
+ ,50
+ ,28
+ ,84
+ ,34711
+ ,42744
+ ,173721
+ ,60
+ ,20
+ ,58
+ ,31076
+ ,65931
+ ,126739
+ ,53
+ ,17
+ ,35
+ ,74608
+ ,38575
+ ,224762
+ ,76
+ ,25
+ ,74
+ ,58092
+ ,28795
+ ,219428
+ ,63
+ ,24
+ ,89
+ ,42009
+ ,94440
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,217267
+ ,54
+ ,27
+ ,75
+ ,36022
+ ,38229
+ ,99706
+ ,44
+ ,14
+ ,39
+ ,23333
+ ,31972
+ ,136733
+ ,36
+ ,35
+ ,101
+ ,53349
+ ,40071
+ ,249965
+ ,83
+ ,34
+ ,135
+ ,92596
+ ,132480
+ ,232951
+ ,105
+ ,22
+ ,76
+ ,49598
+ ,62797
+ ,143755
+ ,37
+ ,34
+ ,118
+ ,44093
+ ,40429
+ ,95734
+ ,25
+ ,23
+ ,76
+ ,84205
+ ,45545
+ ,191416
+ ,63
+ ,24
+ ,65
+ ,63369
+ ,57568
+ ,114820
+ ,55
+ ,26
+ ,97
+ ,60132
+ ,39019
+ ,157625
+ ,41
+ ,22
+ ,67
+ ,37403
+ ,53866
+ ,81293
+ ,23
+ ,35
+ ,63
+ ,24460
+ ,38345
+ ,210040
+ ,63
+ ,24
+ ,96
+ ,46456
+ ,50210
+ ,223771
+ ,54
+ ,31
+ ,112
+ ,66616
+ ,80947
+ ,160344
+ ,68
+ ,26
+ ,75
+ ,41554
+ ,43461
+ ,48188
+ ,12
+ ,22
+ ,39
+ ,22346
+ ,14812
+ ,145235
+ ,84
+ ,21
+ ,63
+ ,30874
+ ,37819
+ ,287839
+ ,66
+ ,27
+ ,93
+ ,68701
+ ,102738
+ ,235223
+ ,56
+ ,30
+ ,76
+ ,35728
+ ,54509
+ ,195583
+ ,67
+ ,33
+ ,117
+ ,29010
+ ,62956
+ ,145942
+ ,40
+ ,11
+ ,30
+ ,23110
+ ,55411
+ ,207309
+ ,53
+ ,26
+ ,65
+ ,38844
+ ,50611
+ ,93764
+ ,26
+ ,26
+ ,78
+ ,27084
+ ,26692
+ ,151985
+ ,67
+ ,23
+ ,87
+ ,35139
+ ,60056
+ ,190545
+ ,36
+ ,38
+ ,85
+ ,57476
+ ,25155
+ ,146414
+ ,50
+ ,30
+ ,111
+ ,33277
+ ,42840
+ ,130794
+ ,48
+ ,19
+ ,60
+ ,31141
+ ,39358
+ ,124234
+ ,46
+ ,19
+ ,53
+ ,61281
+ ,47241
+ ,112718
+ ,53
+ ,26
+ ,67
+ ,25820
+ ,49611
+ ,160817
+ ,27
+ ,26
+ ,90
+ ,23284
+ ,41833
+ ,99070
+ ,38
+ ,33
+ ,100
+ ,35378
+ ,48930
+ ,178653
+ ,68
+ ,36
+ ,135
+ ,74990
+ ,110600
+ ,138708
+ ,93
+ ,25
+ ,71
+ ,29653
+ ,52235
+ ,114408
+ ,59
+ ,24
+ ,75
+ ,64622
+ ,53986
+ ,31970
+ ,5
+ ,21
+ ,42
+ ,4157
+ ,4105
+ ,224494
+ ,53
+ ,19
+ ,42
+ ,29245
+ ,59331
+ ,123328
+ ,36
+ ,12
+ ,8
+ ,50008
+ ,47796
+ ,113504
+ ,72
+ ,30
+ ,86
+ ,52338
+ ,38302
+ ,105932
+ ,49
+ ,21
+ ,41
+ ,13310
+ ,14063
+ ,162203
+ ,81
+ ,34
+ ,118
+ ,92901
+ ,54414
+ ,100098
+ ,27
+ ,32
+ ,91
+ ,10956
+ ,9903
+ ,174768
+ ,94
+ ,28
+ ,102
+ ,34241
+ ,53987
+ ,156752
+ ,71
+ ,28
+ ,89
+ ,75043
+ ,88937
+ ,77269
+ ,18
+ ,21
+ ,46
+ ,21152
+ ,21928
+ ,84971
+ ,34
+ ,31
+ ,60
+ ,42249
+ ,29487
+ ,80522
+ ,54
+ ,26
+ ,69
+ ,42005
+ ,35334
+ ,276525
+ ,44
+ ,29
+ ,95
+ ,41152
+ ,57596
+ ,62974
+ ,26
+ ,23
+ ,17
+ ,14399
+ ,29750
+ ,120296
+ ,44
+ ,25
+ ,61
+ ,28263
+ ,41029
+ ,75555
+ ,35
+ ,22
+ ,55
+ ,17215
+ ,12416
+ ,157988
+ ,32
+ ,26
+ ,55
+ ,48140
+ ,51158
+ ,223247
+ ,55
+ ,33
+ ,124
+ ,62897
+ ,79935
+ ,115019
+ ,58
+ ,24
+ ,73
+ ,22883
+ ,26552
+ ,99602
+ ,44
+ ,24
+ ,73
+ ,41622
+ ,25807
+ ,151804
+ ,39
+ ,21
+ ,67
+ ,40715
+ ,50620
+ ,146005
+ ,49
+ ,28
+ ,66
+ ,65897
+ ,61467
+ ,163444
+ ,72
+ ,27
+ ,75
+ ,76542
+ ,65292
+ ,151517
+ ,39
+ ,25
+ ,83
+ ,37477
+ ,55516
+ ,133686
+ ,28
+ ,15
+ ,55
+ ,53216
+ ,42006
+ ,58128
+ ,24
+ ,13
+ ,27
+ ,40911
+ ,26273
+ ,234325
+ ,49
+ ,36
+ ,115
+ ,57021
+ ,90248
+ ,195576
+ ,96
+ ,24
+ ,76
+ ,73116
+ ,61476
+ ,19349
+ ,13
+ ,1
+ ,0
+ ,3895
+ ,9604
+ ,213189
+ ,32
+ ,24
+ ,83
+ ,46609
+ ,45108
+ ,151672
+ ,41
+ ,31
+ ,90
+ ,29351
+ ,47232
+ ,59117
+ ,24
+ ,4
+ ,4
+ ,2325
+ ,3439
+ ,71931
+ ,52
+ ,20
+ ,56
+ ,31747
+ ,30553
+ ,126653
+ ,57
+ ,23
+ ,63
+ ,32665
+ ,24751
+ ,113552
+ ,28
+ ,23
+ ,52
+ ,19249
+ ,34458
+ ,85338
+ ,36
+ ,12
+ ,24
+ ,15292
+ ,24649
+ ,27676
+ ,2
+ ,16
+ ,17
+ ,5842
+ ,2342
+ ,138522
+ ,80
+ ,29
+ ,105
+ ,33994
+ ,52739
+ ,122417
+ ,29
+ ,26
+ ,20
+ ,13018
+ ,6245
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,87592
+ ,46
+ ,25
+ ,51
+ ,98177
+ ,35381
+ ,107205
+ ,25
+ ,21
+ ,76
+ ,37941
+ ,19595
+ ,144664
+ ,51
+ ,23
+ ,59
+ ,31032
+ ,50848
+ ,136540
+ ,59
+ ,21
+ ,70
+ ,32683
+ ,39443
+ ,71894
+ ,36
+ ,21
+ ,38
+ ,34545
+ ,27023
+ ,3616
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,175055
+ ,38
+ ,23
+ ,81
+ ,27525
+ ,61022
+ ,144618
+ ,68
+ ,33
+ ,78
+ ,66856
+ ,63528
+ ,152826
+ ,28
+ ,28
+ ,67
+ ,28549
+ ,34835
+ ,113245
+ ,36
+ ,23
+ ,89
+ ,38610
+ ,37172
+ ,43410
+ ,7
+ ,1
+ ,3
+ ,2781
+ ,13
+ ,175762
+ ,70
+ ,29
+ ,87
+ ,41211
+ ,62548
+ ,93634
+ ,30
+ ,17
+ ,48
+ ,22698
+ ,31334
+ ,117426
+ ,59
+ ,31
+ ,66
+ ,41194
+ ,20839
+ ,60493
+ ,3
+ ,12
+ ,32
+ ,32689
+ ,5084
+ ,19764
+ ,10
+ ,2
+ ,4
+ ,5752
+ ,9927
+ ,164062
+ ,46
+ ,21
+ ,70
+ ,26757
+ ,53229
+ ,128144
+ ,34
+ ,26
+ ,94
+ ,22527
+ ,29877
+ ,154959
+ ,54
+ ,29
+ ,91
+ ,44810
+ ,37310
+ ,11796
+ ,1
+ ,2
+ ,1
+ ,0
+ ,0
+ ,10674
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,138547
+ ,35
+ ,18
+ ,39
+ ,100674
+ ,50067
+ ,6836
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,154135
+ ,48
+ ,21
+ ,45
+ ,57786
+ ,47708
+ ,5118
+ ,5
+ ,0
+ ,0
+ ,0
+ ,0
+ ,40248
+ ,8
+ ,4
+ ,7
+ ,5444
+ ,6012
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,120460
+ ,36
+ ,25
+ ,75
+ ,28470
+ ,27749
+ ,88837
+ ,21
+ ,26
+ ,52
+ ,61849
+ ,47555
+ ,7131
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,9056
+ ,0
+ ,4
+ ,1
+ ,2179
+ ,1336
+ ,68916
+ ,15
+ ,17
+ ,49
+ ,8019
+ ,11017
+ ,132697
+ ,50
+ ,21
+ ,69
+ ,39644
+ ,55184
+ ,100681
+ ,17
+ ,22
+ ,56
+ ,23494
+ ,43485)
+ ,dim=c(6
+ ,144)
+ ,dimnames=list(c('A'
+ ,'B'
+ ,'C'
+ ,'D'
+ ,'E'
+ ,'F')
+ ,1:144))
> y <- array(NA,dim=c(6,144),dimnames=list(c('A','B','C','D','E','F'),1:144))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '5'
> 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
E A B C D F t
1 20465 158258 48 18 63 23975 1
2 33629 186930 53 20 56 85634 2
3 1423 7215 0 0 0 1929 3
4 25629 128162 51 27 63 36294 4
5 54002 226974 76 31 116 72255 5
6 151036 500344 125 36 138 189748 6
7 33287 171007 59 23 71 61834 7
8 31172 179835 80 30 107 68167 8
9 28113 154581 55 30 50 38462 9
10 57803 278960 67 26 79 101219 10
11 49830 121844 50 24 58 43270 11
12 52143 183086 77 30 91 76183 12
13 21055 98796 44 22 41 31476 13
14 47007 209322 79 25 91 62157 14
15 28735 157125 51 18 61 46261 15
16 59147 154565 54 22 74 50063 16
17 78950 134198 75 33 131 64483 17
18 13497 69128 2 15 45 2341 18
19 46154 150680 73 34 110 48149 19
20 53249 27997 13 18 41 12743 20
21 10726 69919 19 15 37 18743 21
22 83700 233044 93 30 84 97057 22
23 40400 195820 38 25 67 17675 23
24 33797 127994 48 34 69 33106 24
25 36205 145433 50 21 58 53311 25
26 30165 170864 48 21 60 42754 26
27 58534 199655 60 25 88 59056 27
28 44663 188633 81 31 75 101621 28
29 92556 354266 60 31 98 118120 29
30 40078 192399 52 20 67 79572 30
31 34711 165753 50 28 84 42744 31
32 31076 173721 60 20 58 65931 32
33 74608 126739 53 17 35 38575 33
34 58092 224762 76 25 74 28795 34
35 42009 219428 63 24 89 94440 35
36 0 0 0 0 0 0 36
37 36022 217267 54 27 75 38229 37
38 23333 99706 44 14 39 31972 38
39 53349 136733 36 35 101 40071 39
40 92596 249965 83 34 135 132480 40
41 49598 232951 105 22 76 62797 41
42 44093 143755 37 34 118 40429 42
43 84205 95734 25 23 76 45545 43
44 63369 191416 63 24 65 57568 44
45 60132 114820 55 26 97 39019 45
46 37403 157625 41 22 67 53866 46
47 24460 81293 23 35 63 38345 47
48 46456 210040 63 24 96 50210 48
49 66616 223771 54 31 112 80947 49
50 41554 160344 68 26 75 43461 50
51 22346 48188 12 22 39 14812 51
52 30874 145235 84 21 63 37819 52
53 68701 287839 66 27 93 102738 53
54 35728 235223 56 30 76 54509 54
55 29010 195583 67 33 117 62956 55
56 23110 145942 40 11 30 55411 56
57 38844 207309 53 26 65 50611 57
58 27084 93764 26 26 78 26692 58
59 35139 151985 67 23 87 60056 59
60 57476 190545 36 38 85 25155 60
61 33277 146414 50 30 111 42840 61
62 31141 130794 48 19 60 39358 62
63 61281 124234 46 19 53 47241 63
64 25820 112718 53 26 67 49611 64
65 23284 160817 27 26 90 41833 65
66 35378 99070 38 33 100 48930 66
67 74990 178653 68 36 135 110600 67
68 29653 138708 93 25 71 52235 68
69 64622 114408 59 24 75 53986 69
70 4157 31970 5 21 42 4105 70
71 29245 224494 53 19 42 59331 71
72 50008 123328 36 12 8 47796 72
73 52338 113504 72 30 86 38302 73
74 13310 105932 49 21 41 14063 74
75 92901 162203 81 34 118 54414 75
76 10956 100098 27 32 91 9903 76
77 34241 174768 94 28 102 53987 77
78 75043 156752 71 28 89 88937 78
79 21152 77269 18 21 46 21928 79
80 42249 84971 34 31 60 29487 80
81 42005 80522 54 26 69 35334 81
82 41152 276525 44 29 95 57596 82
83 14399 62974 26 23 17 29750 83
84 28263 120296 44 25 61 41029 84
85 17215 75555 35 22 55 12416 85
86 48140 157988 32 26 55 51158 86
87 62897 223247 55 33 124 79935 87
88 22883 115019 58 24 73 26552 88
89 41622 99602 44 24 73 25807 89
90 40715 151804 39 21 67 50620 90
91 65897 146005 49 28 66 61467 91
92 76542 163444 72 27 75 65292 92
93 37477 151517 39 25 83 55516 93
94 53216 133686 28 15 55 42006 94
95 40911 58128 24 13 27 26273 95
96 57021 234325 49 36 115 90248 96
97 73116 195576 96 24 76 61476 97
98 3895 19349 13 1 0 9604 98
99 46609 213189 32 24 83 45108 99
100 29351 151672 41 31 90 47232 100
101 2325 59117 24 4 4 3439 101
102 31747 71931 52 20 56 30553 102
103 32665 126653 57 23 63 24751 103
104 19249 113552 28 23 52 34458 104
105 15292 85338 36 12 24 24649 105
106 5842 27676 2 16 17 2342 106
107 33994 138522 80 29 105 52739 107
108 13018 122417 29 26 20 6245 108
109 0 0 0 0 0 0 109
110 98177 87592 46 25 51 35381 110
111 37941 107205 25 21 76 19595 111
112 31032 144664 51 23 59 50848 112
113 32683 136540 59 21 70 39443 113
114 34545 71894 36 21 38 27023 114
115 0 3616 0 0 0 0 115
116 0 0 0 0 0 0 116
117 27525 175055 38 23 81 61022 117
118 66856 144618 68 33 78 63528 118
119 28549 152826 28 28 67 34835 119
120 38610 113245 36 23 89 37172 120
121 2781 43410 7 1 3 13 121
122 41211 175762 70 29 87 62548 122
123 22698 93634 30 17 48 31334 123
124 41194 117426 59 31 66 20839 124
125 32689 60493 3 12 32 5084 125
126 5752 19764 10 2 4 9927 126
127 26757 164062 46 21 70 53229 127
128 22527 128144 34 26 94 29877 128
129 44810 154959 54 29 91 37310 129
130 0 11796 1 2 1 0 130
131 0 10674 0 0 0 0 131
132 100674 138547 35 18 39 50067 132
133 0 6836 0 1 0 0 133
134 57786 154135 48 21 45 47708 134
135 0 5118 5 0 0 0 135
136 5444 40248 8 4 7 6012 136
137 0 0 0 0 0 0 137
138 28470 120460 36 25 75 27749 138
139 61849 88837 21 26 52 47555 139
140 0 7131 0 0 0 0 140
141 2179 9056 0 4 1 1336 141
142 8019 68916 15 17 49 11017 142
143 39644 132697 50 21 69 55184 143
144 23494 100681 17 22 56 43485 144
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) A B C D F
-2.763e+03 1.135e-03 1.182e+02 6.281e+02 -2.470e+01 4.750e-01
t
3.644e+01
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-29271 -10445 -3308 6312 60208
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.763e+03 5.340e+03 -0.517 0.6057
A 1.135e-03 3.947e-02 0.029 0.9771
B 1.182e+02 9.356e+01 1.263 0.2088
C 6.281e+02 3.034e+02 2.070 0.0403 *
D -2.470e+01 9.580e+01 -0.258 0.7969
F 4.750e-01 9.465e-02 5.019 1.59e-06 ***
t 3.644e+01 3.621e+01 1.006 0.3160
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 15930 on 137 degrees of freedom
Multiple R-squared: 0.6144, Adjusted R-squared: 0.5975
F-statistic: 36.38 on 6 and 137 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.5484142 0.90317170 0.45158585
[2,] 0.7233818 0.55323635 0.27661818
[3,] 0.5962160 0.80756801 0.40378400
[4,] 0.4856138 0.97122755 0.51438622
[5,] 0.4098133 0.81962658 0.59018671
[6,] 0.3391631 0.67832613 0.66083694
[7,] 0.3864978 0.77299563 0.61350218
[8,] 0.4299250 0.85985003 0.57007498
[9,] 0.4134593 0.82691854 0.58654073
[10,] 0.3390187 0.67803735 0.66098133
[11,] 0.5096851 0.98062970 0.49031485
[12,] 0.5517081 0.89658371 0.44829186
[13,] 0.4916744 0.98334875 0.50832562
[14,] 0.4241374 0.84827472 0.57586264
[15,] 0.3813907 0.76278138 0.61860931
[16,] 0.3819832 0.76396642 0.61801679
[17,] 0.3683555 0.73671101 0.63164450
[18,] 0.3088626 0.61772529 0.69113736
[19,] 0.4462219 0.89244373 0.55377814
[20,] 0.4078402 0.81568039 0.59215981
[21,] 0.4329378 0.86587556 0.56706222
[22,] 0.4061350 0.81226996 0.59386502
[23,] 0.3823823 0.76476462 0.61761769
[24,] 0.7941249 0.41175020 0.20587510
[25,] 0.7857914 0.42841716 0.21420858
[26,] 0.8456607 0.30867858 0.15433929
[27,] 0.8087725 0.38245498 0.19122749
[28,] 0.7920945 0.41581104 0.20790552
[29,] 0.7536297 0.49274052 0.24637026
[30,] 0.7206016 0.55879683 0.27939842
[31,] 0.6723529 0.65529426 0.32764713
[32,] 0.6291734 0.74165323 0.37082662
[33,] 0.5876290 0.82474198 0.41237099
[34,] 0.8631291 0.27374175 0.13687087
[35,] 0.8528642 0.29427150 0.14713575
[36,] 0.8624602 0.27507969 0.13753984
[37,] 0.8486214 0.30275728 0.15137864
[38,] 0.8483877 0.30322454 0.15161227
[39,] 0.8383051 0.32338976 0.16169488
[40,] 0.8150105 0.36997897 0.18498948
[41,] 0.7818674 0.43626511 0.21813255
[42,] 0.7425916 0.51481683 0.25740842
[43,] 0.7100754 0.57984924 0.28992462
[44,] 0.6746712 0.65065750 0.32532875
[45,] 0.6692614 0.66147711 0.33073856
[46,] 0.7659191 0.46816171 0.23408085
[47,] 0.7525500 0.49490001 0.24745001
[48,] 0.7146970 0.57060600 0.28530300
[49,] 0.6759230 0.64815403 0.32407701
[50,] 0.6573628 0.68527432 0.34263716
[51,] 0.6935537 0.61289254 0.30644627
[52,] 0.6705229 0.65895413 0.32947706
[53,] 0.6241355 0.75172903 0.37586452
[54,] 0.6912658 0.61746831 0.30873415
[55,] 0.6940630 0.61187409 0.30593705
[56,] 0.6915599 0.61688029 0.30844014
[57,] 0.6587533 0.68249339 0.34124669
[58,] 0.6274683 0.74506341 0.37253171
[59,] 0.6515867 0.69682660 0.34841330
[60,] 0.6798623 0.64027533 0.32013766
[61,] 0.6465610 0.70687803 0.35343902
[62,] 0.6452486 0.70950278 0.35475139
[63,] 0.6516035 0.69679300 0.34839650
[64,] 0.6264782 0.74704366 0.37352183
[65,] 0.5970798 0.80584033 0.40292016
[66,] 0.8238966 0.35220680 0.17610340
[67,] 0.8114283 0.37714340 0.18857170
[68,] 0.8159510 0.36809807 0.18404904
[69,] 0.7916028 0.41679444 0.20839722
[70,] 0.7542317 0.49153661 0.24576830
[71,] 0.7238936 0.55221275 0.27610638
[72,] 0.6848633 0.63027343 0.31513671
[73,] 0.6496532 0.70069369 0.35034684
[74,] 0.6910606 0.61787873 0.30893937
[75,] 0.6765961 0.64680779 0.32340390
[76,] 0.6332496 0.73350089 0.36675044
[77,] 0.5910505 0.81789908 0.40894954
[78,] 0.5436958 0.91260831 0.45630415
[79,] 0.5099366 0.98012673 0.49006337
[80,] 0.4881406 0.97628125 0.51185938
[81,] 0.4368927 0.87378532 0.56310734
[82,] 0.4140306 0.82806113 0.58596943
[83,] 0.4281470 0.85629398 0.57185301
[84,] 0.3875612 0.77512235 0.61243883
[85,] 0.4362394 0.87247884 0.56376058
[86,] 0.4356122 0.87122432 0.56438784
[87,] 0.4053027 0.81060541 0.59469729
[88,] 0.4176149 0.83522986 0.58238507
[89,] 0.3702141 0.74042820 0.62978590
[90,] 0.3838408 0.76768165 0.61615917
[91,] 0.3653572 0.73071437 0.63464282
[92,] 0.3188028 0.63760566 0.68119717
[93,] 0.2722285 0.54445690 0.72777155
[94,] 0.2316069 0.46321387 0.76839307
[95,] 0.2295118 0.45902366 0.77048817
[96,] 0.2028302 0.40566043 0.79716978
[97,] 0.1982978 0.39659552 0.80170224
[98,] 0.1967680 0.39353598 0.80323201
[99,] 0.2783613 0.55672268 0.72163866
[100,] 0.2352683 0.47053654 0.76473173
[101,] 0.7538626 0.49227477 0.24613738
[102,] 0.8027403 0.39451934 0.19725967
[103,] 0.8131635 0.37367299 0.18683649
[104,] 0.7676954 0.46460926 0.23230463
[105,] 0.7212186 0.55756271 0.27878135
[106,] 0.6621198 0.67576033 0.33788016
[107,] 0.5978962 0.80420755 0.40210377
[108,] 0.6273806 0.74523880 0.37261940
[109,] 0.5622428 0.87551443 0.43775722
[110,] 0.7170359 0.56592813 0.28296407
[111,] 0.7826494 0.43470112 0.21735056
[112,] 0.7481308 0.50373843 0.25186921
[113,] 0.7143114 0.57137722 0.28568861
[114,] 0.6831501 0.63369974 0.31684987
[115,] 0.6644504 0.67109912 0.33554956
[116,] 0.6536972 0.69260550 0.34630275
[117,] 0.5943238 0.81135236 0.40567618
[118,] 0.8147434 0.37051327 0.18525663
[119,] 0.7431286 0.51374281 0.25687140
[120,] 0.6483366 0.70332680 0.35166340
[121,] 0.6026276 0.79474479 0.39737240
[122,] 0.5572239 0.88555222 0.44277611
[123,] 0.9961191 0.00776182 0.00388091
[124,] 0.9875443 0.02491137 0.01245568
[125,] 0.9547869 0.09042612 0.04521306
> postscript(file="/var/www/rcomp/tmp/1t0qn1324507210.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/www/rcomp/tmp/23kj71324507210.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/www/rcomp/tmp/3p1ig1324507210.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/www/rcomp/tmp/4mk7c1324507210.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/www/rcomp/tmp/5aiot1324507210.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 = 144
Frequency = 1
1 2 3 4 5 6
-3798.3109 -22012.8465 3151.7677 -10568.6447 -3583.9377 28904.3815
7 8 9 10 11 12
-13436.0588 -24594.6351 -12004.6301 -10492.7726 11949.6042 -7621.5964
13 14 15 16 17 18
-9724.3876 -3293.3438 -7027.4973 18999.1384 23956.3985 5866.8437
19 20 21 22 23 24
-2082.5023 37368.6601 -7011.9359 11535.2772 15168.7172 -5508.8789
25 26 27 28 29 30
-5097.7908 -5902.5240 11414.7707 -29270.5298 13609.8071 -13320.9282
31 32 33 34 35 36
-5568.4120 -17062.2455 41624.8094 22827.8294 -21934.2309 1450.7761
37 38 39 40 41 42
-2456.5418 -3618.6670 11758.0673 2857.9326 -3575.1675 3144.5060
43 44 45 46 47 48
48133.9134 16052.1012 22156.1946 -4284.9537 -15942.1379 3233.0606
49 50 51 52 53 54
5801.9707 -845.0411 1886.6700 -7946.9923 -2057.5071 -13219.7321
55 56 57 58 59 60
-26113.1366 -13549.6038 -5734.5486 -2528.7880 -13162.8028 19864.8543
61 62 63 64 65 66
-8708.6341 -3323.4976 23106.2905 -18381.8640 -13674.1426 -10367.1466
67 68 69 70 71 72
-4741.3137 -19969.7893 18902.6231 -10360.9087 -16176.8137 15709.5470
73 74 75 76 77 78
8891.3493 -11391.3111 38887.1113 -14910.3066 -17819.7505 8760.4750
79 80 81 82 83 84
-3648.8789 5986.5893 3933.4103 -7814.1651 -17164.6913 -11056.2860
85 86 87 88 89 90
-5698.5161 4535.0568 101.6085 -10428.7540 10299.3257 -163.3535
91 92 93 94 95 96
14233.2875 21137.9446 -7953.3105 21076.2121 17331.4138 -12411.5200
97 98 99 100 101 102
18379.3185 -3661.6742 7289.3138 -16231.4245 -5542.7427 -1125.1553
103 104 105 106 107 108
148.2532 -14745.6683 -8775.2358 -6267.8809 -17425.8482 -10523.2582
109 110 111 112 113 114
-1209.3164 60147.0812 12962.1590 -13619.8152 -5995.7093 3730.2570
115 116 117 118 119 120
-1432.0575 -1464.3938 -20097.1284 8141.9618 -8985.9345 2711.9830
121 122 123 124 125 126
-302.0964 -14720.2695 -7048.9595 4593.8353 21311.6741 -3153.7395
127 128 129 130 131 132
-17475.8513 -11738.6079 2625.2294 -3337.5775 -2023.1008 60208.2983
133 134 135 136 137 138
-2719.7186 15078.2424 -2753.3147 -2935.4407 -2229.6258 -5217.8732
139 140 141 142 143 144
19328.3357 -2347.0369 -3328.9768 -10944.1470 -6562.2767 -14205.1694
> postscript(file="/var/www/rcomp/tmp/6klmo1324507210.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 = 144
Frequency = 1
lag(myerror, k = 1) myerror
0 -3798.3109 NA
1 -22012.8465 -3798.3109
2 3151.7677 -22012.8465
3 -10568.6447 3151.7677
4 -3583.9377 -10568.6447
5 28904.3815 -3583.9377
6 -13436.0588 28904.3815
7 -24594.6351 -13436.0588
8 -12004.6301 -24594.6351
9 -10492.7726 -12004.6301
10 11949.6042 -10492.7726
11 -7621.5964 11949.6042
12 -9724.3876 -7621.5964
13 -3293.3438 -9724.3876
14 -7027.4973 -3293.3438
15 18999.1384 -7027.4973
16 23956.3985 18999.1384
17 5866.8437 23956.3985
18 -2082.5023 5866.8437
19 37368.6601 -2082.5023
20 -7011.9359 37368.6601
21 11535.2772 -7011.9359
22 15168.7172 11535.2772
23 -5508.8789 15168.7172
24 -5097.7908 -5508.8789
25 -5902.5240 -5097.7908
26 11414.7707 -5902.5240
27 -29270.5298 11414.7707
28 13609.8071 -29270.5298
29 -13320.9282 13609.8071
30 -5568.4120 -13320.9282
31 -17062.2455 -5568.4120
32 41624.8094 -17062.2455
33 22827.8294 41624.8094
34 -21934.2309 22827.8294
35 1450.7761 -21934.2309
36 -2456.5418 1450.7761
37 -3618.6670 -2456.5418
38 11758.0673 -3618.6670
39 2857.9326 11758.0673
40 -3575.1675 2857.9326
41 3144.5060 -3575.1675
42 48133.9134 3144.5060
43 16052.1012 48133.9134
44 22156.1946 16052.1012
45 -4284.9537 22156.1946
46 -15942.1379 -4284.9537
47 3233.0606 -15942.1379
48 5801.9707 3233.0606
49 -845.0411 5801.9707
50 1886.6700 -845.0411
51 -7946.9923 1886.6700
52 -2057.5071 -7946.9923
53 -13219.7321 -2057.5071
54 -26113.1366 -13219.7321
55 -13549.6038 -26113.1366
56 -5734.5486 -13549.6038
57 -2528.7880 -5734.5486
58 -13162.8028 -2528.7880
59 19864.8543 -13162.8028
60 -8708.6341 19864.8543
61 -3323.4976 -8708.6341
62 23106.2905 -3323.4976
63 -18381.8640 23106.2905
64 -13674.1426 -18381.8640
65 -10367.1466 -13674.1426
66 -4741.3137 -10367.1466
67 -19969.7893 -4741.3137
68 18902.6231 -19969.7893
69 -10360.9087 18902.6231
70 -16176.8137 -10360.9087
71 15709.5470 -16176.8137
72 8891.3493 15709.5470
73 -11391.3111 8891.3493
74 38887.1113 -11391.3111
75 -14910.3066 38887.1113
76 -17819.7505 -14910.3066
77 8760.4750 -17819.7505
78 -3648.8789 8760.4750
79 5986.5893 -3648.8789
80 3933.4103 5986.5893
81 -7814.1651 3933.4103
82 -17164.6913 -7814.1651
83 -11056.2860 -17164.6913
84 -5698.5161 -11056.2860
85 4535.0568 -5698.5161
86 101.6085 4535.0568
87 -10428.7540 101.6085
88 10299.3257 -10428.7540
89 -163.3535 10299.3257
90 14233.2875 -163.3535
91 21137.9446 14233.2875
92 -7953.3105 21137.9446
93 21076.2121 -7953.3105
94 17331.4138 21076.2121
95 -12411.5200 17331.4138
96 18379.3185 -12411.5200
97 -3661.6742 18379.3185
98 7289.3138 -3661.6742
99 -16231.4245 7289.3138
100 -5542.7427 -16231.4245
101 -1125.1553 -5542.7427
102 148.2532 -1125.1553
103 -14745.6683 148.2532
104 -8775.2358 -14745.6683
105 -6267.8809 -8775.2358
106 -17425.8482 -6267.8809
107 -10523.2582 -17425.8482
108 -1209.3164 -10523.2582
109 60147.0812 -1209.3164
110 12962.1590 60147.0812
111 -13619.8152 12962.1590
112 -5995.7093 -13619.8152
113 3730.2570 -5995.7093
114 -1432.0575 3730.2570
115 -1464.3938 -1432.0575
116 -20097.1284 -1464.3938
117 8141.9618 -20097.1284
118 -8985.9345 8141.9618
119 2711.9830 -8985.9345
120 -302.0964 2711.9830
121 -14720.2695 -302.0964
122 -7048.9595 -14720.2695
123 4593.8353 -7048.9595
124 21311.6741 4593.8353
125 -3153.7395 21311.6741
126 -17475.8513 -3153.7395
127 -11738.6079 -17475.8513
128 2625.2294 -11738.6079
129 -3337.5775 2625.2294
130 -2023.1008 -3337.5775
131 60208.2983 -2023.1008
132 -2719.7186 60208.2983
133 15078.2424 -2719.7186
134 -2753.3147 15078.2424
135 -2935.4407 -2753.3147
136 -2229.6258 -2935.4407
137 -5217.8732 -2229.6258
138 19328.3357 -5217.8732
139 -2347.0369 19328.3357
140 -3328.9768 -2347.0369
141 -10944.1470 -3328.9768
142 -6562.2767 -10944.1470
143 -14205.1694 -6562.2767
144 NA -14205.1694
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -22012.8465 -3798.3109
[2,] 3151.7677 -22012.8465
[3,] -10568.6447 3151.7677
[4,] -3583.9377 -10568.6447
[5,] 28904.3815 -3583.9377
[6,] -13436.0588 28904.3815
[7,] -24594.6351 -13436.0588
[8,] -12004.6301 -24594.6351
[9,] -10492.7726 -12004.6301
[10,] 11949.6042 -10492.7726
[11,] -7621.5964 11949.6042
[12,] -9724.3876 -7621.5964
[13,] -3293.3438 -9724.3876
[14,] -7027.4973 -3293.3438
[15,] 18999.1384 -7027.4973
[16,] 23956.3985 18999.1384
[17,] 5866.8437 23956.3985
[18,] -2082.5023 5866.8437
[19,] 37368.6601 -2082.5023
[20,] -7011.9359 37368.6601
[21,] 11535.2772 -7011.9359
[22,] 15168.7172 11535.2772
[23,] -5508.8789 15168.7172
[24,] -5097.7908 -5508.8789
[25,] -5902.5240 -5097.7908
[26,] 11414.7707 -5902.5240
[27,] -29270.5298 11414.7707
[28,] 13609.8071 -29270.5298
[29,] -13320.9282 13609.8071
[30,] -5568.4120 -13320.9282
[31,] -17062.2455 -5568.4120
[32,] 41624.8094 -17062.2455
[33,] 22827.8294 41624.8094
[34,] -21934.2309 22827.8294
[35,] 1450.7761 -21934.2309
[36,] -2456.5418 1450.7761
[37,] -3618.6670 -2456.5418
[38,] 11758.0673 -3618.6670
[39,] 2857.9326 11758.0673
[40,] -3575.1675 2857.9326
[41,] 3144.5060 -3575.1675
[42,] 48133.9134 3144.5060
[43,] 16052.1012 48133.9134
[44,] 22156.1946 16052.1012
[45,] -4284.9537 22156.1946
[46,] -15942.1379 -4284.9537
[47,] 3233.0606 -15942.1379
[48,] 5801.9707 3233.0606
[49,] -845.0411 5801.9707
[50,] 1886.6700 -845.0411
[51,] -7946.9923 1886.6700
[52,] -2057.5071 -7946.9923
[53,] -13219.7321 -2057.5071
[54,] -26113.1366 -13219.7321
[55,] -13549.6038 -26113.1366
[56,] -5734.5486 -13549.6038
[57,] -2528.7880 -5734.5486
[58,] -13162.8028 -2528.7880
[59,] 19864.8543 -13162.8028
[60,] -8708.6341 19864.8543
[61,] -3323.4976 -8708.6341
[62,] 23106.2905 -3323.4976
[63,] -18381.8640 23106.2905
[64,] -13674.1426 -18381.8640
[65,] -10367.1466 -13674.1426
[66,] -4741.3137 -10367.1466
[67,] -19969.7893 -4741.3137
[68,] 18902.6231 -19969.7893
[69,] -10360.9087 18902.6231
[70,] -16176.8137 -10360.9087
[71,] 15709.5470 -16176.8137
[72,] 8891.3493 15709.5470
[73,] -11391.3111 8891.3493
[74,] 38887.1113 -11391.3111
[75,] -14910.3066 38887.1113
[76,] -17819.7505 -14910.3066
[77,] 8760.4750 -17819.7505
[78,] -3648.8789 8760.4750
[79,] 5986.5893 -3648.8789
[80,] 3933.4103 5986.5893
[81,] -7814.1651 3933.4103
[82,] -17164.6913 -7814.1651
[83,] -11056.2860 -17164.6913
[84,] -5698.5161 -11056.2860
[85,] 4535.0568 -5698.5161
[86,] 101.6085 4535.0568
[87,] -10428.7540 101.6085
[88,] 10299.3257 -10428.7540
[89,] -163.3535 10299.3257
[90,] 14233.2875 -163.3535
[91,] 21137.9446 14233.2875
[92,] -7953.3105 21137.9446
[93,] 21076.2121 -7953.3105
[94,] 17331.4138 21076.2121
[95,] -12411.5200 17331.4138
[96,] 18379.3185 -12411.5200
[97,] -3661.6742 18379.3185
[98,] 7289.3138 -3661.6742
[99,] -16231.4245 7289.3138
[100,] -5542.7427 -16231.4245
[101,] -1125.1553 -5542.7427
[102,] 148.2532 -1125.1553
[103,] -14745.6683 148.2532
[104,] -8775.2358 -14745.6683
[105,] -6267.8809 -8775.2358
[106,] -17425.8482 -6267.8809
[107,] -10523.2582 -17425.8482
[108,] -1209.3164 -10523.2582
[109,] 60147.0812 -1209.3164
[110,] 12962.1590 60147.0812
[111,] -13619.8152 12962.1590
[112,] -5995.7093 -13619.8152
[113,] 3730.2570 -5995.7093
[114,] -1432.0575 3730.2570
[115,] -1464.3938 -1432.0575
[116,] -20097.1284 -1464.3938
[117,] 8141.9618 -20097.1284
[118,] -8985.9345 8141.9618
[119,] 2711.9830 -8985.9345
[120,] -302.0964 2711.9830
[121,] -14720.2695 -302.0964
[122,] -7048.9595 -14720.2695
[123,] 4593.8353 -7048.9595
[124,] 21311.6741 4593.8353
[125,] -3153.7395 21311.6741
[126,] -17475.8513 -3153.7395
[127,] -11738.6079 -17475.8513
[128,] 2625.2294 -11738.6079
[129,] -3337.5775 2625.2294
[130,] -2023.1008 -3337.5775
[131,] 60208.2983 -2023.1008
[132,] -2719.7186 60208.2983
[133,] 15078.2424 -2719.7186
[134,] -2753.3147 15078.2424
[135,] -2935.4407 -2753.3147
[136,] -2229.6258 -2935.4407
[137,] -5217.8732 -2229.6258
[138,] 19328.3357 -5217.8732
[139,] -2347.0369 19328.3357
[140,] -3328.9768 -2347.0369
[141,] -10944.1470 -3328.9768
[142,] -6562.2767 -10944.1470
[143,] -14205.1694 -6562.2767
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -22012.8465 -3798.3109
2 3151.7677 -22012.8465
3 -10568.6447 3151.7677
4 -3583.9377 -10568.6447
5 28904.3815 -3583.9377
6 -13436.0588 28904.3815
7 -24594.6351 -13436.0588
8 -12004.6301 -24594.6351
9 -10492.7726 -12004.6301
10 11949.6042 -10492.7726
11 -7621.5964 11949.6042
12 -9724.3876 -7621.5964
13 -3293.3438 -9724.3876
14 -7027.4973 -3293.3438
15 18999.1384 -7027.4973
16 23956.3985 18999.1384
17 5866.8437 23956.3985
18 -2082.5023 5866.8437
19 37368.6601 -2082.5023
20 -7011.9359 37368.6601
21 11535.2772 -7011.9359
22 15168.7172 11535.2772
23 -5508.8789 15168.7172
24 -5097.7908 -5508.8789
25 -5902.5240 -5097.7908
26 11414.7707 -5902.5240
27 -29270.5298 11414.7707
28 13609.8071 -29270.5298
29 -13320.9282 13609.8071
30 -5568.4120 -13320.9282
31 -17062.2455 -5568.4120
32 41624.8094 -17062.2455
33 22827.8294 41624.8094
34 -21934.2309 22827.8294
35 1450.7761 -21934.2309
36 -2456.5418 1450.7761
37 -3618.6670 -2456.5418
38 11758.0673 -3618.6670
39 2857.9326 11758.0673
40 -3575.1675 2857.9326
41 3144.5060 -3575.1675
42 48133.9134 3144.5060
43 16052.1012 48133.9134
44 22156.1946 16052.1012
45 -4284.9537 22156.1946
46 -15942.1379 -4284.9537
47 3233.0606 -15942.1379
48 5801.9707 3233.0606
49 -845.0411 5801.9707
50 1886.6700 -845.0411
51 -7946.9923 1886.6700
52 -2057.5071 -7946.9923
53 -13219.7321 -2057.5071
54 -26113.1366 -13219.7321
55 -13549.6038 -26113.1366
56 -5734.5486 -13549.6038
57 -2528.7880 -5734.5486
58 -13162.8028 -2528.7880
59 19864.8543 -13162.8028
60 -8708.6341 19864.8543
61 -3323.4976 -8708.6341
62 23106.2905 -3323.4976
63 -18381.8640 23106.2905
64 -13674.1426 -18381.8640
65 -10367.1466 -13674.1426
66 -4741.3137 -10367.1466
67 -19969.7893 -4741.3137
68 18902.6231 -19969.7893
69 -10360.9087 18902.6231
70 -16176.8137 -10360.9087
71 15709.5470 -16176.8137
72 8891.3493 15709.5470
73 -11391.3111 8891.3493
74 38887.1113 -11391.3111
75 -14910.3066 38887.1113
76 -17819.7505 -14910.3066
77 8760.4750 -17819.7505
78 -3648.8789 8760.4750
79 5986.5893 -3648.8789
80 3933.4103 5986.5893
81 -7814.1651 3933.4103
82 -17164.6913 -7814.1651
83 -11056.2860 -17164.6913
84 -5698.5161 -11056.2860
85 4535.0568 -5698.5161
86 101.6085 4535.0568
87 -10428.7540 101.6085
88 10299.3257 -10428.7540
89 -163.3535 10299.3257
90 14233.2875 -163.3535
91 21137.9446 14233.2875
92 -7953.3105 21137.9446
93 21076.2121 -7953.3105
94 17331.4138 21076.2121
95 -12411.5200 17331.4138
96 18379.3185 -12411.5200
97 -3661.6742 18379.3185
98 7289.3138 -3661.6742
99 -16231.4245 7289.3138
100 -5542.7427 -16231.4245
101 -1125.1553 -5542.7427
102 148.2532 -1125.1553
103 -14745.6683 148.2532
104 -8775.2358 -14745.6683
105 -6267.8809 -8775.2358
106 -17425.8482 -6267.8809
107 -10523.2582 -17425.8482
108 -1209.3164 -10523.2582
109 60147.0812 -1209.3164
110 12962.1590 60147.0812
111 -13619.8152 12962.1590
112 -5995.7093 -13619.8152
113 3730.2570 -5995.7093
114 -1432.0575 3730.2570
115 -1464.3938 -1432.0575
116 -20097.1284 -1464.3938
117 8141.9618 -20097.1284
118 -8985.9345 8141.9618
119 2711.9830 -8985.9345
120 -302.0964 2711.9830
121 -14720.2695 -302.0964
122 -7048.9595 -14720.2695
123 4593.8353 -7048.9595
124 21311.6741 4593.8353
125 -3153.7395 21311.6741
126 -17475.8513 -3153.7395
127 -11738.6079 -17475.8513
128 2625.2294 -11738.6079
129 -3337.5775 2625.2294
130 -2023.1008 -3337.5775
131 60208.2983 -2023.1008
132 -2719.7186 60208.2983
133 15078.2424 -2719.7186
134 -2753.3147 15078.2424
135 -2935.4407 -2753.3147
136 -2229.6258 -2935.4407
137 -5217.8732 -2229.6258
138 19328.3357 -5217.8732
139 -2347.0369 19328.3357
140 -3328.9768 -2347.0369
141 -10944.1470 -3328.9768
142 -6562.2767 -10944.1470
143 -14205.1694 -6562.2767
> 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/www/rcomp/tmp/7nx1p1324507210.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/www/rcomp/tmp/81pvv1324507210.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/www/rcomp/tmp/9plit1324507210.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/www/rcomp/tmp/10621w1324507210.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/www/rcomp/tmp/113jcq1324507210.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/www/rcomp/tmp/123j3e1324507210.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/www/rcomp/tmp/131r7m1324507210.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/www/rcomp/tmp/14cubz1324507210.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/www/rcomp/tmp/15rdps1324507210.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/www/rcomp/tmp/162kor1324507210.tab")
+ }
>
> try(system("convert tmp/1t0qn1324507210.ps tmp/1t0qn1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/23kj71324507210.ps tmp/23kj71324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/3p1ig1324507210.ps tmp/3p1ig1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/4mk7c1324507210.ps tmp/4mk7c1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/5aiot1324507210.ps tmp/5aiot1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/6klmo1324507210.ps tmp/6klmo1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/7nx1p1324507210.ps tmp/7nx1p1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/81pvv1324507210.ps tmp/81pvv1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/9plit1324507210.ps tmp/9plit1324507210.png",intern=TRUE))
character(0)
> try(system("convert tmp/10621w1324507210.ps tmp/10621w1324507210.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.550 0.340 4.862