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(1818
+ ,279055
+ ,73
+ ,1433
+ ,212408
+ ,75
+ ,2059
+ ,233939
+ ,83
+ ,2733
+ ,222117
+ ,106
+ ,1399
+ ,189911
+ ,56
+ ,631
+ ,70849
+ ,28
+ ,5460
+ ,605767
+ ,135
+ ,381
+ ,33186
+ ,19
+ ,2150
+ ,227332
+ ,62
+ ,2042
+ ,267925
+ ,49
+ ,2536
+ ,371987
+ ,122
+ ,2429
+ ,276291
+ ,132
+ ,2100
+ ,212638
+ ,87
+ ,3020
+ ,368577
+ ,85
+ ,2265
+ ,269455
+ ,88
+ ,5139
+ ,398124
+ ,191
+ ,2363
+ ,335567
+ ,77
+ ,3564
+ ,432711
+ ,173
+ ,1516
+ ,185822
+ ,59
+ ,2398
+ ,267365
+ ,89
+ ,2546
+ ,279428
+ ,73
+ ,3253
+ ,527853
+ ,112
+ ,1705
+ ,220142
+ ,49
+ ,1787
+ ,200004
+ ,58
+ ,3792
+ ,257139
+ ,133
+ ,3108
+ ,270941
+ ,138
+ ,3230
+ ,324969
+ ,134
+ ,2348
+ ,329962
+ ,92
+ ,1780
+ ,190867
+ ,60
+ ,3218
+ ,393860
+ ,79
+ ,2692
+ ,327660
+ ,89
+ ,2187
+ ,269239
+ ,83
+ ,2577
+ ,396136
+ ,106
+ ,1293
+ ,130446
+ ,49
+ ,3567
+ ,430118
+ ,104
+ ,2764
+ ,273950
+ ,56
+ ,3755
+ ,428077
+ ,128
+ ,2075
+ ,254312
+ ,93
+ ,995
+ ,120351
+ ,35
+ ,3750
+ ,395658
+ ,212
+ ,3413
+ ,345875
+ ,86
+ ,2053
+ ,216827
+ ,82
+ ,1984
+ ,224524
+ ,83
+ ,1825
+ ,182485
+ ,69
+ ,2783
+ ,168492
+ ,86
+ ,5572
+ ,459455
+ ,157
+ ,918
+ ,78800
+ ,42
+ ,2685
+ ,255072
+ ,85
+ ,4145
+ ,368086
+ ,123
+ ,2841
+ ,230299
+ ,70
+ ,2175
+ ,244782
+ ,81
+ ,496
+ ,24188
+ ,24
+ ,2699
+ ,400109
+ ,334
+ ,744
+ ,65029
+ ,17
+ ,1161
+ ,101097
+ ,64
+ ,3333
+ ,309810
+ ,67
+ ,2970
+ ,375638
+ ,91
+ ,3969
+ ,367127
+ ,205
+ ,2919
+ ,387748
+ ,156
+ ,2399
+ ,280106
+ ,90
+ ,4121
+ ,400971
+ ,153
+ ,3323
+ ,322755
+ ,123
+ ,3132
+ ,291391
+ ,124
+ ,2868
+ ,295075
+ ,93
+ ,1778
+ ,280018
+ ,81
+ ,2109
+ ,267432
+ ,71
+ ,2148
+ ,217181
+ ,141
+ ,3009
+ ,258166
+ ,159
+ ,2562
+ ,264771
+ ,88
+ ,1737
+ ,182961
+ ,73
+ ,2680
+ ,256967
+ ,74
+ ,893
+ ,73566
+ ,32
+ ,2389
+ ,272362
+ ,93
+ ,2197
+ ,229056
+ ,62
+ ,2227
+ ,229851
+ ,70
+ ,2370
+ ,371391
+ ,91
+ ,3226
+ ,398210
+ ,104
+ ,1978
+ ,220419
+ ,111
+ ,2516
+ ,231884
+ ,72
+ ,2147
+ ,219381
+ ,73
+ ,2150
+ ,206169
+ ,54
+ ,4229
+ ,483074
+ ,132
+ ,1380
+ ,146100
+ ,72
+ ,2449
+ ,295224
+ ,109
+ ,870
+ ,80953
+ ,25
+ ,2700
+ ,217384
+ ,63
+ ,1574
+ ,179344
+ ,62
+ ,4046
+ ,415550
+ ,222
+ ,3259
+ ,389059
+ ,129
+ ,3098
+ ,180679
+ ,106
+ ,2615
+ ,299505
+ ,104
+ ,2404
+ ,292260
+ ,84
+ ,1932
+ ,199481
+ ,68
+ ,3147
+ ,282361
+ ,78
+ ,2598
+ ,329281
+ ,89
+ ,2108
+ ,234577
+ ,48
+ ,2193
+ ,297995
+ ,67
+ ,2478
+ ,342490
+ ,90
+ ,4198
+ ,416463
+ ,163
+ ,4165
+ ,429565
+ ,120
+ ,2842
+ ,297080
+ ,142
+ ,2562
+ ,331792
+ ,71
+ ,2449
+ ,229772
+ ,202
+ ,602
+ ,43287
+ ,14
+ ,2579
+ ,238089
+ ,87
+ ,2591
+ ,263322
+ ,160
+ ,2957
+ ,302082
+ ,61
+ ,2786
+ ,321797
+ ,95
+ ,1477
+ ,193926
+ ,96
+ ,3350
+ ,175138
+ ,105
+ ,2107
+ ,354041
+ ,78
+ ,2332
+ ,303273
+ ,91
+ ,400
+ ,23668
+ ,13
+ ,2233
+ ,196743
+ ,79
+ ,530
+ ,61857
+ ,25
+ ,2033
+ ,217543
+ ,54
+ ,3246
+ ,440711
+ ,128
+ ,387
+ ,21054
+ ,16
+ ,2137
+ ,252805
+ ,52
+ ,492
+ ,31961
+ ,22
+ ,3838
+ ,360436
+ ,125
+ ,2193
+ ,251948
+ ,77
+ ,1796
+ ,187320
+ ,97
+ ,1907
+ ,180842
+ ,58
+ ,568
+ ,38214
+ ,34
+ ,2602
+ ,280392
+ ,56
+ ,2819
+ ,358276
+ ,84
+ ,1464
+ ,211775
+ ,67
+ ,3946
+ ,447335
+ ,90
+ ,2554
+ ,348017
+ ,99
+ ,3506
+ ,441946
+ ,133
+ ,1552
+ ,215177
+ ,43
+ ,1389
+ ,130177
+ ,47
+ ,3101
+ ,318037
+ ,365
+ ,4541
+ ,466139
+ ,198
+ ,1872
+ ,162279
+ ,62
+ ,4403
+ ,416643
+ ,140
+ ,2113
+ ,178322
+ ,86
+ ,2046
+ ,292443
+ ,54
+ ,2564
+ ,283913
+ ,100
+ ,2145
+ ,251070
+ ,128
+ ,4112
+ ,387072
+ ,125
+ ,2340
+ ,246963
+ ,93
+ ,2035
+ ,173260
+ ,63
+ ,3241
+ ,346748
+ ,108
+ ,1991
+ ,178402
+ ,60
+ ,2864
+ ,277892
+ ,97
+ ,2748
+ ,314070
+ ,112
+ ,2
+ ,1
+ ,0
+ ,207
+ ,14688
+ ,10
+ ,5
+ ,98
+ ,1
+ ,8
+ ,455
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2449
+ ,291847
+ ,95
+ ,3490
+ ,415421
+ ,168
+ ,0
+ ,0
+ ,0
+ ,4
+ ,203
+ ,4
+ ,151
+ ,7199
+ ,5
+ ,475
+ ,46660
+ ,21
+ ,141
+ ,17547
+ ,5
+ ,1145
+ ,121550
+ ,46
+ ,29
+ ,969
+ ,2
+ ,2080
+ ,242774
+ ,75)
+ ,dim=c(3
+ ,164)
+ ,dimnames=list(c('A'
+ ,'B'
+ ,'C')
+ ,1:164))
> y <- array(NA,dim=c(3,164),dimnames=list(c('A','B','C'),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
A B C
1 1818 279055 73
2 1433 212408 75
3 2059 233939 83
4 2733 222117 106
5 1399 189911 56
6 631 70849 28
7 5460 605767 135
8 381 33186 19
9 2150 227332 62
10 2042 267925 49
11 2536 371987 122
12 2429 276291 132
13 2100 212638 87
14 3020 368577 85
15 2265 269455 88
16 5139 398124 191
17 2363 335567 77
18 3564 432711 173
19 1516 185822 59
20 2398 267365 89
21 2546 279428 73
22 3253 527853 112
23 1705 220142 49
24 1787 200004 58
25 3792 257139 133
26 3108 270941 138
27 3230 324969 134
28 2348 329962 92
29 1780 190867 60
30 3218 393860 79
31 2692 327660 89
32 2187 269239 83
33 2577 396136 106
34 1293 130446 49
35 3567 430118 104
36 2764 273950 56
37 3755 428077 128
38 2075 254312 93
39 995 120351 35
40 3750 395658 212
41 3413 345875 86
42 2053 216827 82
43 1984 224524 83
44 1825 182485 69
45 2783 168492 86
46 5572 459455 157
47 918 78800 42
48 2685 255072 85
49 4145 368086 123
50 2841 230299 70
51 2175 244782 81
52 496 24188 24
53 2699 400109 334
54 744 65029 17
55 1161 101097 64
56 3333 309810 67
57 2970 375638 91
58 3969 367127 205
59 2919 387748 156
60 2399 280106 90
61 4121 400971 153
62 3323 322755 123
63 3132 291391 124
64 2868 295075 93
65 1778 280018 81
66 2109 267432 71
67 2148 217181 141
68 3009 258166 159
69 2562 264771 88
70 1737 182961 73
71 2680 256967 74
72 893 73566 32
73 2389 272362 93
74 2197 229056 62
75 2227 229851 70
76 2370 371391 91
77 3226 398210 104
78 1978 220419 111
79 2516 231884 72
80 2147 219381 73
81 2150 206169 54
82 4229 483074 132
83 1380 146100 72
84 2449 295224 109
85 870 80953 25
86 2700 217384 63
87 1574 179344 62
88 4046 415550 222
89 3259 389059 129
90 3098 180679 106
91 2615 299505 104
92 2404 292260 84
93 1932 199481 68
94 3147 282361 78
95 2598 329281 89
96 2108 234577 48
97 2193 297995 67
98 2478 342490 90
99 4198 416463 163
100 4165 429565 120
101 2842 297080 142
102 2562 331792 71
103 2449 229772 202
104 602 43287 14
105 2579 238089 87
106 2591 263322 160
107 2957 302082 61
108 2786 321797 95
109 1477 193926 96
110 3350 175138 105
111 2107 354041 78
112 2332 303273 91
113 400 23668 13
114 2233 196743 79
115 530 61857 25
116 2033 217543 54
117 3246 440711 128
118 387 21054 16
119 2137 252805 52
120 492 31961 22
121 3838 360436 125
122 2193 251948 77
123 1796 187320 97
124 1907 180842 58
125 568 38214 34
126 2602 280392 56
127 2819 358276 84
128 1464 211775 67
129 3946 447335 90
130 2554 348017 99
131 3506 441946 133
132 1552 215177 43
133 1389 130177 47
134 3101 318037 365
135 4541 466139 198
136 1872 162279 62
137 4403 416643 140
138 2113 178322 86
139 2046 292443 54
140 2564 283913 100
141 2145 251070 128
142 4112 387072 125
143 2340 246963 93
144 2035 173260 63
145 3241 346748 108
146 1991 178402 60
147 2864 277892 97
148 2748 314070 112
149 2 1 0
150 207 14688 10
151 5 98 1
152 8 455 2
153 0 0 0
154 0 0 0
155 2449 291847 95
156 3490 415421 168
157 0 0 0
158 4 203 4
159 151 7199 5
160 475 46660 21
161 141 17547 5
162 1145 121550 46
163 29 969 2
164 2080 242774 75
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) B C
189.4798 0.0071 3.9130
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1638.4 -199.1 -64.8 211.4 1506.1
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.895e+02 7.818e+01 2.423 0.0165 *
B 7.100e-03 3.964e-04 17.914 < 2e-16 ***
C 3.913e+00 9.195e-01 4.256 3.53e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 448.8 on 161 degrees of freedom
Multiple R-squared: 0.8494, Adjusted R-squared: 0.8475
F-statistic: 454.1 on 2 and 161 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.1600513 3.201027e-01 8.399487e-01
[2,] 0.4821567 9.643134e-01 5.178433e-01
[3,] 0.4780941 9.561882e-01 5.219059e-01
[4,] 0.4067964 8.135927e-01 5.932036e-01
[5,] 0.2965195 5.930389e-01 7.034805e-01
[6,] 0.5877376 8.245249e-01 4.122624e-01
[7,] 0.4954662 9.909324e-01 5.045338e-01
[8,] 0.4223471 8.446942e-01 5.776529e-01
[9,] 0.3322127 6.644254e-01 6.677873e-01
[10,] 0.2542699 5.085397e-01 7.457301e-01
[11,] 0.5804219 8.391561e-01 4.195781e-01
[12,] 0.5361610 9.276779e-01 4.638390e-01
[13,] 0.6729385 6.541230e-01 3.270615e-01
[14,] 0.6040573 7.918855e-01 3.959427e-01
[15,] 0.5324347 9.351306e-01 4.675653e-01
[16,] 0.4898904 9.797808e-01 5.101096e-01
[17,] 0.6694889 6.610222e-01 3.305111e-01
[18,] 0.6127839 7.744321e-01 3.872161e-01
[19,] 0.5566893 8.866213e-01 4.433107e-01
[20,] 0.7658997 4.682006e-01 2.341003e-01
[21,] 0.7248570 5.502859e-01 2.751430e-01
[22,] 0.6732434 6.535132e-01 3.267566e-01
[23,] 0.6626562 6.746876e-01 3.373438e-01
[24,] 0.6125260 7.749481e-01 3.874740e-01
[25,] 0.5983796 8.032408e-01 4.016204e-01
[26,] 0.5428730 9.142539e-01 4.571270e-01
[27,] 0.4920922 9.841843e-01 5.079078e-01
[28,] 0.5812719 8.374561e-01 4.187281e-01
[29,] 0.5269860 9.460280e-01 4.730140e-01
[30,] 0.4893662 9.787325e-01 5.106338e-01
[31,] 0.5894988 8.210023e-01 4.105012e-01
[32,] 0.5370748 9.258504e-01 4.629252e-01
[33,] 0.5099580 9.800840e-01 4.900420e-01
[34,] 0.4587174 9.174348e-01 5.412826e-01
[35,] 0.5189443 9.621114e-01 4.810557e-01
[36,] 0.5652606 8.694788e-01 4.347394e-01
[37,] 0.5129961 9.740078e-01 4.870039e-01
[38,] 0.4644280 9.288559e-01 5.355720e-01
[39,] 0.4155506 8.311012e-01 5.844494e-01
[40,] 0.6161068 7.677864e-01 3.838932e-01
[41,] 0.9275900 1.448199e-01 7.240997e-02
[42,] 0.9089752 1.820496e-01 9.102480e-02
[43,] 0.9012105 1.975790e-01 9.878948e-02
[44,] 0.9407705 1.184591e-01 5.922953e-02
[45,] 0.9644024 7.119512e-02 3.559756e-02
[46,] 0.9542237 9.155268e-02 4.577634e-02
[47,] 0.9417223 1.165555e-01 5.827773e-02
[48,] 0.9998498 3.003457e-04 1.501728e-04
[49,] 0.9997661 4.678297e-04 2.339148e-04
[50,] 0.9996401 7.198254e-04 3.599127e-04
[51,] 0.9997810 4.380430e-04 2.190215e-04
[52,] 0.9997010 5.980995e-04 2.990497e-04
[53,] 0.9996584 6.832350e-04 3.416175e-04
[54,] 0.9997667 4.666757e-04 2.333379e-04
[55,] 0.9996555 6.889963e-04 3.444982e-04
[56,] 0.9996765 6.470577e-04 3.235288e-04
[57,] 0.9996215 7.569572e-04 3.784786e-04
[58,] 0.9995759 8.482137e-04 4.241069e-04
[59,] 0.9994203 1.159358e-03 5.796790e-04
[60,] 0.9996895 6.209416e-04 3.104708e-04
[61,] 0.9995899 8.201617e-04 4.100808e-04
[62,] 0.9994078 1.184402e-03 5.922009e-04
[63,] 0.9993199 1.360292e-03 6.801460e-04
[64,] 0.9990370 1.926003e-03 9.630016e-04
[65,] 0.9985996 2.800769e-03 1.400384e-03
[66,] 0.9984344 3.131258e-03 1.565629e-03
[67,] 0.9977646 4.470807e-03 2.235403e-03
[68,] 0.9968807 6.238573e-03 3.119287e-03
[69,] 0.9957591 8.481769e-03 4.240885e-03
[70,] 0.9942747 1.145069e-02 5.725344e-03
[71,] 0.9973713 5.257340e-03 2.628670e-03
[72,] 0.9965473 6.905497e-03 3.452748e-03
[73,] 0.9955263 8.947377e-03 4.473689e-03
[74,] 0.9951966 9.606876e-03 4.803438e-03
[75,] 0.9934888 1.302244e-02 6.511220e-03
[76,] 0.9921354 1.572925e-02 7.864626e-03
[77,] 0.9894736 2.105273e-02 1.052637e-02
[78,] 0.9862200 2.756005e-02 1.378002e-02
[79,] 0.9834230 3.315408e-02 1.657704e-02
[80,] 0.9781469 4.370623e-02 2.185311e-02
[81,] 0.9862054 2.758914e-02 1.379457e-02
[82,] 0.9820963 3.580733e-02 1.790366e-02
[83,] 0.9764614 4.707725e-02 2.353863e-02
[84,] 0.9709143 5.817134e-02 2.908567e-02
[85,] 0.9962593 7.481307e-03 3.740653e-03
[86,] 0.9948483 1.030337e-02 5.151684e-03
[87,] 0.9932764 1.344715e-02 6.723577e-03
[88,] 0.9908324 1.833526e-02 9.167630e-03
[89,] 0.9939019 1.219617e-02 6.098086e-03
[90,] 0.9926014 1.479716e-02 7.398578e-03
[91,] 0.9899095 2.018106e-02 1.009053e-02
[92,] 0.9891532 2.169364e-02 1.084682e-02
[93,] 0.9904200 1.916001e-02 9.580005e-03
[94,] 0.9901871 1.962574e-02 9.812870e-03
[95,] 0.9904877 1.902460e-02 9.512301e-03
[96,] 0.9870140 2.597208e-02 1.298604e-02
[97,] 0.9843856 3.122886e-02 1.561443e-02
[98,] 0.9796348 4.073032e-02 2.036516e-02
[99,] 0.9732398 5.352035e-02 2.676018e-02
[100,] 0.9713560 5.728793e-02 2.864397e-02
[101,] 0.9627164 7.456711e-02 3.728355e-02
[102,] 0.9605096 7.898076e-02 3.949038e-02
[103,] 0.9490283 1.019433e-01 5.097167e-02
[104,] 0.9493558 1.012883e-01 5.064417e-02
[105,] 0.9995072 9.856856e-04 4.928428e-04
[106,] 0.9999539 9.221189e-05 4.610595e-05
[107,] 0.9999534 9.310781e-05 4.655391e-05
[108,] 0.9999227 1.546385e-04 7.731927e-05
[109,] 0.9999244 1.511826e-04 7.559128e-05
[110,] 0.9998804 2.392053e-04 1.196027e-04
[111,] 0.9998038 3.923017e-04 1.961509e-04
[112,] 0.9999325 1.350184e-04 6.750920e-05
[113,] 0.9998889 2.221638e-04 1.110819e-04
[114,] 0.9998175 3.649645e-04 1.824823e-04
[115,] 0.9997081 5.838296e-04 2.919148e-04
[116,] 0.9998623 2.754062e-04 1.377031e-04
[117,] 0.9997680 4.640997e-04 2.320498e-04
[118,] 0.9996090 7.819662e-04 3.909831e-04
[119,] 0.9994748 1.050414e-03 5.252071e-04
[120,] 0.9991799 1.640202e-03 8.201009e-04
[121,] 0.9987565 2.487032e-03 1.243516e-03
[122,] 0.9986033 2.793445e-03 1.396723e-03
[123,] 0.9989708 2.058363e-03 1.029182e-03
[124,] 0.9983432 3.313529e-03 1.656765e-03
[125,] 0.9992716 1.456711e-03 7.283557e-04
[126,] 0.9996679 6.641553e-04 3.320777e-04
[127,] 0.9997822 4.355224e-04 2.177612e-04
[128,] 0.9996279 7.441579e-04 3.720789e-04
[129,] 0.9996501 6.997258e-04 3.498629e-04
[130,] 0.9993724 1.255110e-03 6.275552e-04
[131,] 0.9992720 1.456047e-03 7.280235e-04
[132,] 0.9997703 4.593869e-04 2.296934e-04
[133,] 0.9998064 3.872912e-04 1.936456e-04
[134,] 0.9999947 1.055617e-05 5.278087e-06
[135,] 0.9999881 2.379488e-05 1.189744e-05
[136,] 0.9999738 5.232561e-05 2.616280e-05
[137,] 0.9999951 9.866822e-06 4.933411e-06
[138,] 0.9999880 2.395155e-05 1.197577e-05
[139,] 0.9999988 2.417631e-06 1.208816e-06
[140,] 0.9999963 7.486686e-06 3.743343e-06
[141,] 0.9999996 8.851927e-07 4.425963e-07
[142,] 1.0000000 5.916316e-12 2.958158e-12
[143,] 1.0000000 1.724687e-11 8.623433e-12
[144,] 1.0000000 1.509948e-10 7.549742e-11
[145,] 1.0000000 8.129504e-10 4.064752e-10
[146,] 1.0000000 7.434689e-09 3.717344e-09
[147,] 1.0000000 6.437206e-08 3.218603e-08
[148,] 0.9999997 5.010694e-07 2.505347e-07
[149,] 0.9999982 3.601988e-06 1.800994e-06
[150,] 0.9999864 2.718208e-05 1.359104e-05
[151,] 0.9999949 1.022664e-05 5.113320e-06
[152,] 0.9999236 1.528015e-04 7.640074e-05
[153,] 0.9996478 7.044108e-04 3.522054e-04
> postscript(file="/var/wessaorg/rcomp/tmp/1hcm91324655342.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/2bs451324655342.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/3vjae1324655342.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/4p34u1324655342.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/5q1ap1324655342.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
-638.5374002 -558.1417104 -116.3249515 551.6169549 -358.0563376
6 7 8 9 10
-171.1017745 441.0633702 -118.4615415 103.7607653 -241.5974481
11 12 13 14 15
-772.1312203 -238.7795121 60.2690560 -119.1373646 -182.0685364
16 17 18 19 20
1375.2873062 -510.4483987 -374.8607257 -223.7617532 -38.1416694
21 22 23 24 25
86.8141430 -1122.7152188 -239.3180642 -49.5469027 1256.2947264
26 27 28 29 30
454.7296681 208.7602050 -544.3457141 0.5036149 -77.1792229
31 32 33 34 35
-172.2615123 -238.9697886 -839.9910878 -14.4387637 -83.4515481
36 37 38 39 40
410.2314396 25.1281358 -284.1119287 -185.9778608 -78.3762971
41 42 43 44 45
431.1433660 3.0904523 -124.4744942 69.8022352 1060.6372226
46 47 48 49 50
1505.8538161 4.6606237 351.7958432 860.6545079 742.3897269
51 52 53 54 55
-69.4887861 40.8629834 -1638.3676608 26.2657973 3.2563008
56 57 58 59 60
681.5672415 -242.7515009 370.5968748 -634.0833330 -131.5211361
61 62 63 64 65
485.7668434 360.5236612 388.3082325 219.4536380 -716.6791963
66 67 68 69 70
-257.1831921 -135.2907701 364.2642979 148.1898323 -37.2296105
71 72 73 74 75
376.3836723 55.9543378 -98.2745154 138.5196407 131.5707152
76 77 78 79 80
-812.5960158 -197.8913367 -210.8915885 398.3095378 114.1730816
81 82 83 84 85
285.3310517 92.9742741 -128.5880059 -263.2125073 7.8946129
86 87 88 89 90
720.4827352 -131.5042647 37.2520279 -197.7406758 1210.8441719
91 92 93 94 95
-108.0443496 -189.3415760 60.0365030 647.4235531 -277.7712936
96 97 98 99 100
65.1003800 -374.5412925 -495.4737569 413.6370177 455.8668017
101 102 103 104 105
-12.5202642 -261.1662435 -162.3858587 50.3821700 358.5562585
106 107 108 109 110
-94.2584807 383.9173582 -60.1098165 -465.0849819 1506.1006122
111 112 113 114 115
-901.5345750 -366.9295849 -8.4016724 337.4343282 -196.5157608
116 117 118 119 120
87.5708711 -573.5785745 -14.5802080 -50.9781272 -10.5025608
121 122 123 124 125
600.1467005 -86.7183524 -103.0926167 206.5113514 -25.8576261
126 127 128 129 130
202.4905319 -243.0829235 -491.3430530 228.0826752 -493.9348828
131 132 133 134 135
-341.9126506 -333.5864089 91.2972722 -774.9253187 266.9611386
136 137 138 139 140
287.6644080 707.3582047 320.8400909 -431.2506105 -32.6825504
141 142 143 144 145
-328.0477657 685.0199050 33.0690602 368.7816811 166.8584479
146 147 148 149 150
300.0103541 321.8081146 -109.7660628 -187.4868764 -125.9008637
151 152 153 154 155
-189.0886286 -192.5364901 -189.4797760 -189.4797760 -184.4522280
156 157 158 159 160
-306.5294014 -189.4797760 -202.5732070 -109.1607589 -127.9586276
161 162 163 164
-192.6359083 -87.5343904 -175.1861061 -126.7530736
> postscript(file="/var/wessaorg/rcomp/tmp/63ltu1324655342.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 -638.5374002 NA
1 -558.1417104 -638.5374002
2 -116.3249515 -558.1417104
3 551.6169549 -116.3249515
4 -358.0563376 551.6169549
5 -171.1017745 -358.0563376
6 441.0633702 -171.1017745
7 -118.4615415 441.0633702
8 103.7607653 -118.4615415
9 -241.5974481 103.7607653
10 -772.1312203 -241.5974481
11 -238.7795121 -772.1312203
12 60.2690560 -238.7795121
13 -119.1373646 60.2690560
14 -182.0685364 -119.1373646
15 1375.2873062 -182.0685364
16 -510.4483987 1375.2873062
17 -374.8607257 -510.4483987
18 -223.7617532 -374.8607257
19 -38.1416694 -223.7617532
20 86.8141430 -38.1416694
21 -1122.7152188 86.8141430
22 -239.3180642 -1122.7152188
23 -49.5469027 -239.3180642
24 1256.2947264 -49.5469027
25 454.7296681 1256.2947264
26 208.7602050 454.7296681
27 -544.3457141 208.7602050
28 0.5036149 -544.3457141
29 -77.1792229 0.5036149
30 -172.2615123 -77.1792229
31 -238.9697886 -172.2615123
32 -839.9910878 -238.9697886
33 -14.4387637 -839.9910878
34 -83.4515481 -14.4387637
35 410.2314396 -83.4515481
36 25.1281358 410.2314396
37 -284.1119287 25.1281358
38 -185.9778608 -284.1119287
39 -78.3762971 -185.9778608
40 431.1433660 -78.3762971
41 3.0904523 431.1433660
42 -124.4744942 3.0904523
43 69.8022352 -124.4744942
44 1060.6372226 69.8022352
45 1505.8538161 1060.6372226
46 4.6606237 1505.8538161
47 351.7958432 4.6606237
48 860.6545079 351.7958432
49 742.3897269 860.6545079
50 -69.4887861 742.3897269
51 40.8629834 -69.4887861
52 -1638.3676608 40.8629834
53 26.2657973 -1638.3676608
54 3.2563008 26.2657973
55 681.5672415 3.2563008
56 -242.7515009 681.5672415
57 370.5968748 -242.7515009
58 -634.0833330 370.5968748
59 -131.5211361 -634.0833330
60 485.7668434 -131.5211361
61 360.5236612 485.7668434
62 388.3082325 360.5236612
63 219.4536380 388.3082325
64 -716.6791963 219.4536380
65 -257.1831921 -716.6791963
66 -135.2907701 -257.1831921
67 364.2642979 -135.2907701
68 148.1898323 364.2642979
69 -37.2296105 148.1898323
70 376.3836723 -37.2296105
71 55.9543378 376.3836723
72 -98.2745154 55.9543378
73 138.5196407 -98.2745154
74 131.5707152 138.5196407
75 -812.5960158 131.5707152
76 -197.8913367 -812.5960158
77 -210.8915885 -197.8913367
78 398.3095378 -210.8915885
79 114.1730816 398.3095378
80 285.3310517 114.1730816
81 92.9742741 285.3310517
82 -128.5880059 92.9742741
83 -263.2125073 -128.5880059
84 7.8946129 -263.2125073
85 720.4827352 7.8946129
86 -131.5042647 720.4827352
87 37.2520279 -131.5042647
88 -197.7406758 37.2520279
89 1210.8441719 -197.7406758
90 -108.0443496 1210.8441719
91 -189.3415760 -108.0443496
92 60.0365030 -189.3415760
93 647.4235531 60.0365030
94 -277.7712936 647.4235531
95 65.1003800 -277.7712936
96 -374.5412925 65.1003800
97 -495.4737569 -374.5412925
98 413.6370177 -495.4737569
99 455.8668017 413.6370177
100 -12.5202642 455.8668017
101 -261.1662435 -12.5202642
102 -162.3858587 -261.1662435
103 50.3821700 -162.3858587
104 358.5562585 50.3821700
105 -94.2584807 358.5562585
106 383.9173582 -94.2584807
107 -60.1098165 383.9173582
108 -465.0849819 -60.1098165
109 1506.1006122 -465.0849819
110 -901.5345750 1506.1006122
111 -366.9295849 -901.5345750
112 -8.4016724 -366.9295849
113 337.4343282 -8.4016724
114 -196.5157608 337.4343282
115 87.5708711 -196.5157608
116 -573.5785745 87.5708711
117 -14.5802080 -573.5785745
118 -50.9781272 -14.5802080
119 -10.5025608 -50.9781272
120 600.1467005 -10.5025608
121 -86.7183524 600.1467005
122 -103.0926167 -86.7183524
123 206.5113514 -103.0926167
124 -25.8576261 206.5113514
125 202.4905319 -25.8576261
126 -243.0829235 202.4905319
127 -491.3430530 -243.0829235
128 228.0826752 -491.3430530
129 -493.9348828 228.0826752
130 -341.9126506 -493.9348828
131 -333.5864089 -341.9126506
132 91.2972722 -333.5864089
133 -774.9253187 91.2972722
134 266.9611386 -774.9253187
135 287.6644080 266.9611386
136 707.3582047 287.6644080
137 320.8400909 707.3582047
138 -431.2506105 320.8400909
139 -32.6825504 -431.2506105
140 -328.0477657 -32.6825504
141 685.0199050 -328.0477657
142 33.0690602 685.0199050
143 368.7816811 33.0690602
144 166.8584479 368.7816811
145 300.0103541 166.8584479
146 321.8081146 300.0103541
147 -109.7660628 321.8081146
148 -187.4868764 -109.7660628
149 -125.9008637 -187.4868764
150 -189.0886286 -125.9008637
151 -192.5364901 -189.0886286
152 -189.4797760 -192.5364901
153 -189.4797760 -189.4797760
154 -184.4522280 -189.4797760
155 -306.5294014 -184.4522280
156 -189.4797760 -306.5294014
157 -202.5732070 -189.4797760
158 -109.1607589 -202.5732070
159 -127.9586276 -109.1607589
160 -192.6359083 -127.9586276
161 -87.5343904 -192.6359083
162 -175.1861061 -87.5343904
163 -126.7530736 -175.1861061
164 NA -126.7530736
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -558.1417104 -638.5374002
[2,] -116.3249515 -558.1417104
[3,] 551.6169549 -116.3249515
[4,] -358.0563376 551.6169549
[5,] -171.1017745 -358.0563376
[6,] 441.0633702 -171.1017745
[7,] -118.4615415 441.0633702
[8,] 103.7607653 -118.4615415
[9,] -241.5974481 103.7607653
[10,] -772.1312203 -241.5974481
[11,] -238.7795121 -772.1312203
[12,] 60.2690560 -238.7795121
[13,] -119.1373646 60.2690560
[14,] -182.0685364 -119.1373646
[15,] 1375.2873062 -182.0685364
[16,] -510.4483987 1375.2873062
[17,] -374.8607257 -510.4483987
[18,] -223.7617532 -374.8607257
[19,] -38.1416694 -223.7617532
[20,] 86.8141430 -38.1416694
[21,] -1122.7152188 86.8141430
[22,] -239.3180642 -1122.7152188
[23,] -49.5469027 -239.3180642
[24,] 1256.2947264 -49.5469027
[25,] 454.7296681 1256.2947264
[26,] 208.7602050 454.7296681
[27,] -544.3457141 208.7602050
[28,] 0.5036149 -544.3457141
[29,] -77.1792229 0.5036149
[30,] -172.2615123 -77.1792229
[31,] -238.9697886 -172.2615123
[32,] -839.9910878 -238.9697886
[33,] -14.4387637 -839.9910878
[34,] -83.4515481 -14.4387637
[35,] 410.2314396 -83.4515481
[36,] 25.1281358 410.2314396
[37,] -284.1119287 25.1281358
[38,] -185.9778608 -284.1119287
[39,] -78.3762971 -185.9778608
[40,] 431.1433660 -78.3762971
[41,] 3.0904523 431.1433660
[42,] -124.4744942 3.0904523
[43,] 69.8022352 -124.4744942
[44,] 1060.6372226 69.8022352
[45,] 1505.8538161 1060.6372226
[46,] 4.6606237 1505.8538161
[47,] 351.7958432 4.6606237
[48,] 860.6545079 351.7958432
[49,] 742.3897269 860.6545079
[50,] -69.4887861 742.3897269
[51,] 40.8629834 -69.4887861
[52,] -1638.3676608 40.8629834
[53,] 26.2657973 -1638.3676608
[54,] 3.2563008 26.2657973
[55,] 681.5672415 3.2563008
[56,] -242.7515009 681.5672415
[57,] 370.5968748 -242.7515009
[58,] -634.0833330 370.5968748
[59,] -131.5211361 -634.0833330
[60,] 485.7668434 -131.5211361
[61,] 360.5236612 485.7668434
[62,] 388.3082325 360.5236612
[63,] 219.4536380 388.3082325
[64,] -716.6791963 219.4536380
[65,] -257.1831921 -716.6791963
[66,] -135.2907701 -257.1831921
[67,] 364.2642979 -135.2907701
[68,] 148.1898323 364.2642979
[69,] -37.2296105 148.1898323
[70,] 376.3836723 -37.2296105
[71,] 55.9543378 376.3836723
[72,] -98.2745154 55.9543378
[73,] 138.5196407 -98.2745154
[74,] 131.5707152 138.5196407
[75,] -812.5960158 131.5707152
[76,] -197.8913367 -812.5960158
[77,] -210.8915885 -197.8913367
[78,] 398.3095378 -210.8915885
[79,] 114.1730816 398.3095378
[80,] 285.3310517 114.1730816
[81,] 92.9742741 285.3310517
[82,] -128.5880059 92.9742741
[83,] -263.2125073 -128.5880059
[84,] 7.8946129 -263.2125073
[85,] 720.4827352 7.8946129
[86,] -131.5042647 720.4827352
[87,] 37.2520279 -131.5042647
[88,] -197.7406758 37.2520279
[89,] 1210.8441719 -197.7406758
[90,] -108.0443496 1210.8441719
[91,] -189.3415760 -108.0443496
[92,] 60.0365030 -189.3415760
[93,] 647.4235531 60.0365030
[94,] -277.7712936 647.4235531
[95,] 65.1003800 -277.7712936
[96,] -374.5412925 65.1003800
[97,] -495.4737569 -374.5412925
[98,] 413.6370177 -495.4737569
[99,] 455.8668017 413.6370177
[100,] -12.5202642 455.8668017
[101,] -261.1662435 -12.5202642
[102,] -162.3858587 -261.1662435
[103,] 50.3821700 -162.3858587
[104,] 358.5562585 50.3821700
[105,] -94.2584807 358.5562585
[106,] 383.9173582 -94.2584807
[107,] -60.1098165 383.9173582
[108,] -465.0849819 -60.1098165
[109,] 1506.1006122 -465.0849819
[110,] -901.5345750 1506.1006122
[111,] -366.9295849 -901.5345750
[112,] -8.4016724 -366.9295849
[113,] 337.4343282 -8.4016724
[114,] -196.5157608 337.4343282
[115,] 87.5708711 -196.5157608
[116,] -573.5785745 87.5708711
[117,] -14.5802080 -573.5785745
[118,] -50.9781272 -14.5802080
[119,] -10.5025608 -50.9781272
[120,] 600.1467005 -10.5025608
[121,] -86.7183524 600.1467005
[122,] -103.0926167 -86.7183524
[123,] 206.5113514 -103.0926167
[124,] -25.8576261 206.5113514
[125,] 202.4905319 -25.8576261
[126,] -243.0829235 202.4905319
[127,] -491.3430530 -243.0829235
[128,] 228.0826752 -491.3430530
[129,] -493.9348828 228.0826752
[130,] -341.9126506 -493.9348828
[131,] -333.5864089 -341.9126506
[132,] 91.2972722 -333.5864089
[133,] -774.9253187 91.2972722
[134,] 266.9611386 -774.9253187
[135,] 287.6644080 266.9611386
[136,] 707.3582047 287.6644080
[137,] 320.8400909 707.3582047
[138,] -431.2506105 320.8400909
[139,] -32.6825504 -431.2506105
[140,] -328.0477657 -32.6825504
[141,] 685.0199050 -328.0477657
[142,] 33.0690602 685.0199050
[143,] 368.7816811 33.0690602
[144,] 166.8584479 368.7816811
[145,] 300.0103541 166.8584479
[146,] 321.8081146 300.0103541
[147,] -109.7660628 321.8081146
[148,] -187.4868764 -109.7660628
[149,] -125.9008637 -187.4868764
[150,] -189.0886286 -125.9008637
[151,] -192.5364901 -189.0886286
[152,] -189.4797760 -192.5364901
[153,] -189.4797760 -189.4797760
[154,] -184.4522280 -189.4797760
[155,] -306.5294014 -184.4522280
[156,] -189.4797760 -306.5294014
[157,] -202.5732070 -189.4797760
[158,] -109.1607589 -202.5732070
[159,] -127.9586276 -109.1607589
[160,] -192.6359083 -127.9586276
[161,] -87.5343904 -192.6359083
[162,] -175.1861061 -87.5343904
[163,] -126.7530736 -175.1861061
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -558.1417104 -638.5374002
2 -116.3249515 -558.1417104
3 551.6169549 -116.3249515
4 -358.0563376 551.6169549
5 -171.1017745 -358.0563376
6 441.0633702 -171.1017745
7 -118.4615415 441.0633702
8 103.7607653 -118.4615415
9 -241.5974481 103.7607653
10 -772.1312203 -241.5974481
11 -238.7795121 -772.1312203
12 60.2690560 -238.7795121
13 -119.1373646 60.2690560
14 -182.0685364 -119.1373646
15 1375.2873062 -182.0685364
16 -510.4483987 1375.2873062
17 -374.8607257 -510.4483987
18 -223.7617532 -374.8607257
19 -38.1416694 -223.7617532
20 86.8141430 -38.1416694
21 -1122.7152188 86.8141430
22 -239.3180642 -1122.7152188
23 -49.5469027 -239.3180642
24 1256.2947264 -49.5469027
25 454.7296681 1256.2947264
26 208.7602050 454.7296681
27 -544.3457141 208.7602050
28 0.5036149 -544.3457141
29 -77.1792229 0.5036149
30 -172.2615123 -77.1792229
31 -238.9697886 -172.2615123
32 -839.9910878 -238.9697886
33 -14.4387637 -839.9910878
34 -83.4515481 -14.4387637
35 410.2314396 -83.4515481
36 25.1281358 410.2314396
37 -284.1119287 25.1281358
38 -185.9778608 -284.1119287
39 -78.3762971 -185.9778608
40 431.1433660 -78.3762971
41 3.0904523 431.1433660
42 -124.4744942 3.0904523
43 69.8022352 -124.4744942
44 1060.6372226 69.8022352
45 1505.8538161 1060.6372226
46 4.6606237 1505.8538161
47 351.7958432 4.6606237
48 860.6545079 351.7958432
49 742.3897269 860.6545079
50 -69.4887861 742.3897269
51 40.8629834 -69.4887861
52 -1638.3676608 40.8629834
53 26.2657973 -1638.3676608
54 3.2563008 26.2657973
55 681.5672415 3.2563008
56 -242.7515009 681.5672415
57 370.5968748 -242.7515009
58 -634.0833330 370.5968748
59 -131.5211361 -634.0833330
60 485.7668434 -131.5211361
61 360.5236612 485.7668434
62 388.3082325 360.5236612
63 219.4536380 388.3082325
64 -716.6791963 219.4536380
65 -257.1831921 -716.6791963
66 -135.2907701 -257.1831921
67 364.2642979 -135.2907701
68 148.1898323 364.2642979
69 -37.2296105 148.1898323
70 376.3836723 -37.2296105
71 55.9543378 376.3836723
72 -98.2745154 55.9543378
73 138.5196407 -98.2745154
74 131.5707152 138.5196407
75 -812.5960158 131.5707152
76 -197.8913367 -812.5960158
77 -210.8915885 -197.8913367
78 398.3095378 -210.8915885
79 114.1730816 398.3095378
80 285.3310517 114.1730816
81 92.9742741 285.3310517
82 -128.5880059 92.9742741
83 -263.2125073 -128.5880059
84 7.8946129 -263.2125073
85 720.4827352 7.8946129
86 -131.5042647 720.4827352
87 37.2520279 -131.5042647
88 -197.7406758 37.2520279
89 1210.8441719 -197.7406758
90 -108.0443496 1210.8441719
91 -189.3415760 -108.0443496
92 60.0365030 -189.3415760
93 647.4235531 60.0365030
94 -277.7712936 647.4235531
95 65.1003800 -277.7712936
96 -374.5412925 65.1003800
97 -495.4737569 -374.5412925
98 413.6370177 -495.4737569
99 455.8668017 413.6370177
100 -12.5202642 455.8668017
101 -261.1662435 -12.5202642
102 -162.3858587 -261.1662435
103 50.3821700 -162.3858587
104 358.5562585 50.3821700
105 -94.2584807 358.5562585
106 383.9173582 -94.2584807
107 -60.1098165 383.9173582
108 -465.0849819 -60.1098165
109 1506.1006122 -465.0849819
110 -901.5345750 1506.1006122
111 -366.9295849 -901.5345750
112 -8.4016724 -366.9295849
113 337.4343282 -8.4016724
114 -196.5157608 337.4343282
115 87.5708711 -196.5157608
116 -573.5785745 87.5708711
117 -14.5802080 -573.5785745
118 -50.9781272 -14.5802080
119 -10.5025608 -50.9781272
120 600.1467005 -10.5025608
121 -86.7183524 600.1467005
122 -103.0926167 -86.7183524
123 206.5113514 -103.0926167
124 -25.8576261 206.5113514
125 202.4905319 -25.8576261
126 -243.0829235 202.4905319
127 -491.3430530 -243.0829235
128 228.0826752 -491.3430530
129 -493.9348828 228.0826752
130 -341.9126506 -493.9348828
131 -333.5864089 -341.9126506
132 91.2972722 -333.5864089
133 -774.9253187 91.2972722
134 266.9611386 -774.9253187
135 287.6644080 266.9611386
136 707.3582047 287.6644080
137 320.8400909 707.3582047
138 -431.2506105 320.8400909
139 -32.6825504 -431.2506105
140 -328.0477657 -32.6825504
141 685.0199050 -328.0477657
142 33.0690602 685.0199050
143 368.7816811 33.0690602
144 166.8584479 368.7816811
145 300.0103541 166.8584479
146 321.8081146 300.0103541
147 -109.7660628 321.8081146
148 -187.4868764 -109.7660628
149 -125.9008637 -187.4868764
150 -189.0886286 -125.9008637
151 -192.5364901 -189.0886286
152 -189.4797760 -192.5364901
153 -189.4797760 -189.4797760
154 -184.4522280 -189.4797760
155 -306.5294014 -184.4522280
156 -189.4797760 -306.5294014
157 -202.5732070 -189.4797760
158 -109.1607589 -202.5732070
159 -127.9586276 -109.1607589
160 -192.6359083 -127.9586276
161 -87.5343904 -192.6359083
162 -175.1861061 -87.5343904
163 -126.7530736 -175.1861061
> 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/7p7z31324655342.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/8l9v31324655342.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/9micx1324655342.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/10bg261324655342.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/110dlq1324655342.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/12gpk71324655342.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/13qvwu1324655342.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/14hpo61324655342.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/15xoai1324655342.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/16x6lj1324655342.tab")
+ }
>
> try(system("convert tmp/1hcm91324655342.ps tmp/1hcm91324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/2bs451324655342.ps tmp/2bs451324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/3vjae1324655342.ps tmp/3vjae1324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/4p34u1324655342.ps tmp/4p34u1324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/5q1ap1324655342.ps tmp/5q1ap1324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/63ltu1324655342.ps tmp/63ltu1324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/7p7z31324655342.ps tmp/7p7z31324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/8l9v31324655342.ps tmp/8l9v31324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/9micx1324655342.ps tmp/9micx1324655342.png",intern=TRUE))
character(0)
> try(system("convert tmp/10bg261324655342.ps tmp/10bg261324655342.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.801 0.717 5.525