R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(0
+ ,0
+ ,264530
+ ,165119
+ ,0
+ ,0
+ ,135248
+ ,107269
+ ,0
+ ,0
+ ,207253
+ ,93497
+ ,0
+ ,0
+ ,202898
+ ,100269
+ ,0
+ ,0
+ ,145249
+ ,91627
+ ,0
+ ,0
+ ,65295
+ ,47552
+ ,0
+ ,0
+ ,439387
+ ,233933
+ ,0
+ ,0
+ ,33186
+ ,6853
+ ,0
+ ,0
+ ,183696
+ ,104380
+ ,0
+ ,0
+ ,190673
+ ,98431
+ ,0
+ ,0
+ ,287239
+ ,156949
+ ,0
+ ,0
+ ,205260
+ ,81817
+ ,0
+ ,0
+ ,141987
+ ,59238
+ ,0
+ ,0
+ ,322679
+ ,101138
+ ,0
+ ,0
+ ,199717
+ ,107158
+ ,0
+ ,0
+ ,349227
+ ,155499
+ ,0
+ ,0
+ ,276709
+ ,156274
+ ,0
+ ,0
+ ,273576
+ ,121777
+ ,0
+ ,0
+ ,157448
+ ,105037
+ ,0
+ ,0
+ ,242782
+ ,118661
+ ,0
+ ,0
+ ,256814
+ ,131187
+ ,0
+ ,0
+ ,405874
+ ,145026
+ ,0
+ ,0
+ ,161189
+ ,107016
+ ,0
+ ,0
+ ,156189
+ ,87242
+ ,0
+ ,0
+ ,200181
+ ,91699
+ ,0
+ ,0
+ ,192645
+ ,110087
+ ,0
+ ,0
+ ,249893
+ ,145447
+ ,0
+ ,0
+ ,241171
+ ,143307
+ ,0
+ ,0
+ ,143182
+ ,61678
+ ,0
+ ,0
+ ,285266
+ ,210080
+ ,0
+ ,0
+ ,243048
+ ,165005
+ ,0
+ ,0
+ ,176062
+ ,97806
+ ,0
+ ,0
+ ,305210
+ ,184471
+ ,0
+ ,0
+ ,87995
+ ,27786
+ ,0
+ ,0
+ ,343613
+ ,184458
+ ,0
+ ,0
+ ,264159
+ ,98765
+ ,0
+ ,0
+ ,394976
+ ,178441
+ ,0
+ ,0
+ ,192718
+ ,100619
+ ,0
+ ,0
+ ,114673
+ ,58391
+ ,0
+ ,0
+ ,310108
+ ,151672
+ ,0
+ ,0
+ ,292891
+ ,124437
+ ,0
+ ,0
+ ,157518
+ ,79929
+ ,0
+ ,0
+ ,180362
+ ,123064
+ ,0
+ ,0
+ ,146175
+ ,50466
+ ,0
+ ,0
+ ,140319
+ ,100991
+ ,0
+ ,0
+ ,405267
+ ,79367
+ ,0
+ ,0
+ ,78800
+ ,56968
+ ,0
+ ,0
+ ,201970
+ ,106257
+ ,0
+ ,0
+ ,305322
+ ,178412
+ ,0
+ ,0
+ ,164733
+ ,98520
+ ,0
+ ,1
+ ,199186
+ ,153670
+ ,0
+ ,1
+ ,24188
+ ,15049
+ ,0
+ ,1
+ ,346142
+ ,174478
+ ,0
+ ,1
+ ,65029
+ ,25109
+ ,0
+ ,1
+ ,101097
+ ,45824
+ ,0
+ ,1
+ ,255082
+ ,116772
+ ,0
+ ,1
+ ,287314
+ ,189150
+ ,1
+ ,1
+ ,308944
+ ,194404
+ ,1
+ ,1
+ ,280943
+ ,185881
+ ,1
+ ,1
+ ,225816
+ ,67508
+ ,1
+ ,1
+ ,348943
+ ,188597
+ ,1
+ ,1
+ ,283283
+ ,203618
+ ,1
+ ,1
+ ,199642
+ ,87232
+ ,1
+ ,1
+ ,232791
+ ,110875
+ ,1
+ ,1
+ ,212262
+ ,144756
+ ,1
+ ,1
+ ,201345
+ ,129825
+ ,1
+ ,1
+ ,180424
+ ,92189
+ ,1
+ ,1
+ ,204450
+ ,121158
+ ,1
+ ,1
+ ,197813
+ ,96219
+ ,1
+ ,1
+ ,138731
+ ,84128
+ ,1
+ ,1
+ ,216153
+ ,97960
+ ,1
+ ,1
+ ,73566
+ ,23824
+ ,1
+ ,1
+ ,219392
+ ,103515
+ ,1
+ ,1
+ ,181728
+ ,91313
+ ,1
+ ,1
+ ,150006
+ ,85407
+ ,1
+ ,1
+ ,325723
+ ,95871
+ ,1
+ ,1
+ ,265348
+ ,143846
+ ,1
+ ,1
+ ,202410
+ ,155387
+ ,1
+ ,1
+ ,173420
+ ,74429
+ ,1
+ ,1
+ ,162366
+ ,74004
+ ,1
+ ,1
+ ,136341
+ ,71987
+ ,1
+ ,1
+ ,390163
+ ,150629
+ ,1
+ ,1
+ ,145905
+ ,68580
+ ,1
+ ,1
+ ,238921
+ ,119855
+ ,1
+ ,1
+ ,80953
+ ,55792
+ ,1
+ ,1
+ ,133301
+ ,25157
+ ,1
+ ,1
+ ,138630
+ ,90895
+ ,1
+ ,1
+ ,334082
+ ,117510
+ ,1
+ ,1
+ ,277542
+ ,144774
+ ,1
+ ,1
+ ,170849
+ ,77529
+ ,1
+ ,1
+ ,236398
+ ,103123
+ ,1
+ ,1
+ ,207178
+ ,104669
+ ,1
+ ,1
+ ,157125
+ ,82414
+ ,1
+ ,1
+ ,242395
+ ,82390
+ ,1
+ ,1
+ ,273632
+ ,128446
+ ,1
+ ,1
+ ,178489
+ ,111542
+ ,1
+ ,1
+ ,207720
+ ,136048
+ ,1
+ ,1
+ ,268066
+ ,197257
+ ,1
+ ,1
+ ,349934
+ ,162079
+ ,1
+ ,1
+ ,368833
+ ,206286
+ ,1
+ ,1
+ ,247804
+ ,109858
+ ,1
+ ,1
+ ,265849
+ ,182125
+ ,1
+ ,1
+ ,174311
+ ,74168
+ ,1
+ ,1
+ ,43287
+ ,19630
+ ,1
+ ,1
+ ,176724
+ ,88634
+ ,1
+ ,1
+ ,189021
+ ,128321
+ ,1
+ ,1
+ ,237531
+ ,118936
+ ,1
+ ,1
+ ,279589
+ ,127044
+ ,1
+ ,1
+ ,106655
+ ,178377
+ ,1
+ ,1
+ ,135798
+ ,69581
+ ,1
+ ,1
+ ,290495
+ ,168019
+ ,1
+ ,1
+ ,266805
+ ,113598
+ ,1
+ ,1
+ ,23623
+ ,5841
+ ,1
+ ,1
+ ,174970
+ ,93116
+ ,1
+ ,1
+ ,61857
+ ,24610
+ ,1
+ ,1
+ ,147760
+ ,60611
+ ,1
+ ,1
+ ,358662
+ ,226620
+ ,1
+ ,1
+ ,21054
+ ,6622
+ ,1
+ ,1
+ ,230091
+ ,121996
+ ,1
+ ,1
+ ,31414
+ ,13155
+ ,1
+ ,1
+ ,284519
+ ,154158
+ ,1
+ ,1
+ ,209481
+ ,78489
+ ,1
+ ,1
+ ,161691
+ ,22007
+ ,1
+ ,1
+ ,137093
+ ,72530
+ ,1
+ ,1
+ ,38214
+ ,13983
+ ,1
+ ,1
+ ,166059
+ ,73397
+ ,1
+ ,1
+ ,319346
+ ,143878
+ ,1
+ ,1
+ ,186273
+ ,119956
+ ,1
+ ,1
+ ,374212
+ ,181558
+ ,1
+ ,1
+ ,275578
+ ,208236
+ ,1
+ ,1
+ ,368863
+ ,237085
+ ,1
+ ,1
+ ,179928
+ ,110297
+ ,1
+ ,1
+ ,94381
+ ,61394
+ ,1
+ ,1
+ ,251253
+ ,81420
+ ,1
+ ,1
+ ,382564
+ ,191154
+ ,1
+ ,1
+ ,118033
+ ,11798
+ ,1
+ ,1
+ ,370878
+ ,135724
+ ,1
+ ,1
+ ,147989
+ ,68614
+ ,1
+ ,1
+ ,236370
+ ,139926
+ ,1
+ ,1
+ ,193220
+ ,105203
+ ,1
+ ,1
+ ,189020
+ ,80338
+ ,1
+ ,1
+ ,341992
+ ,121376
+ ,1
+ ,1
+ ,224936
+ ,124922
+ ,1
+ ,1
+ ,173260
+ ,10901
+ ,1
+ ,1
+ ,286161
+ ,135471
+ ,1
+ ,1
+ ,130908
+ ,66395
+ ,1
+ ,1
+ ,209639
+ ,134041
+ ,1
+ ,1
+ ,262412
+ ,153554
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,14688
+ ,7953
+ ,1
+ ,1
+ ,98
+ ,0
+ ,1
+ ,1
+ ,455
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,195822
+ ,98922
+ ,1
+ ,1
+ ,347930
+ ,165395
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,203
+ ,0
+ ,1
+ ,1
+ ,7199
+ ,4245
+ ,1
+ ,1
+ ,46660
+ ,21509
+ ,1
+ ,1
+ ,17547
+ ,7670
+ ,1
+ ,1
+ ,107465
+ ,15167
+ ,1
+ ,1
+ ,969
+ ,0
+ ,1
+ ,1
+ ,179994
+ ,63891)
+ ,dim=c(4
+ ,164)
+ ,dimnames=list(c('Pop'
+ ,'Gender'
+ ,'Time_RFC_sec'
+ ,'Compendium_writing_time_sec')
+ ,1:164))
> y <- array(NA,dim=c(4,164),dimnames=list(c('Pop','Gender','Time_RFC_sec','Compendium_writing_time_sec'),1:164))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par20 = ''
> par19 = ''
> par18 = ''
> par17 = ''
> par16 = ''
> par15 = ''
> par14 = ''
> par13 = ''
> par12 = ''
> par11 = ''
> par10 = ''
> par9 = ''
> par8 = ''
> par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '3'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Time_RFC_sec Pop Gender Compendium_writing_time_sec
1 264530 0 0 165119
2 135248 0 0 107269
3 207253 0 0 93497
4 202898 0 0 100269
5 145249 0 0 91627
6 65295 0 0 47552
7 439387 0 0 233933
8 33186 0 0 6853
9 183696 0 0 104380
10 190673 0 0 98431
11 287239 0 0 156949
12 205260 0 0 81817
13 141987 0 0 59238
14 322679 0 0 101138
15 199717 0 0 107158
16 349227 0 0 155499
17 276709 0 0 156274
18 273576 0 0 121777
19 157448 0 0 105037
20 242782 0 0 118661
21 256814 0 0 131187
22 405874 0 0 145026
23 161189 0 0 107016
24 156189 0 0 87242
25 200181 0 0 91699
26 192645 0 0 110087
27 249893 0 0 145447
28 241171 0 0 143307
29 143182 0 0 61678
30 285266 0 0 210080
31 243048 0 0 165005
32 176062 0 0 97806
33 305210 0 0 184471
34 87995 0 0 27786
35 343613 0 0 184458
36 264159 0 0 98765
37 394976 0 0 178441
38 192718 0 0 100619
39 114673 0 0 58391
40 310108 0 0 151672
41 292891 0 0 124437
42 157518 0 0 79929
43 180362 0 0 123064
44 146175 0 0 50466
45 140319 0 0 100991
46 405267 0 0 79367
47 78800 0 0 56968
48 201970 0 0 106257
49 305322 0 0 178412
50 164733 0 0 98520
51 199186 0 1 153670
52 24188 0 1 15049
53 346142 0 1 174478
54 65029 0 1 25109
55 101097 0 1 45824
56 255082 0 1 116772
57 287314 0 1 189150
58 308944 1 1 194404
59 280943 1 1 185881
60 225816 1 1 67508
61 348943 1 1 188597
62 283283 1 1 203618
63 199642 1 1 87232
64 232791 1 1 110875
65 212262 1 1 144756
66 201345 1 1 129825
67 180424 1 1 92189
68 204450 1 1 121158
69 197813 1 1 96219
70 138731 1 1 84128
71 216153 1 1 97960
72 73566 1 1 23824
73 219392 1 1 103515
74 181728 1 1 91313
75 150006 1 1 85407
76 325723 1 1 95871
77 265348 1 1 143846
78 202410 1 1 155387
79 173420 1 1 74429
80 162366 1 1 74004
81 136341 1 1 71987
82 390163 1 1 150629
83 145905 1 1 68580
84 238921 1 1 119855
85 80953 1 1 55792
86 133301 1 1 25157
87 138630 1 1 90895
88 334082 1 1 117510
89 277542 1 1 144774
90 170849 1 1 77529
91 236398 1 1 103123
92 207178 1 1 104669
93 157125 1 1 82414
94 242395 1 1 82390
95 273632 1 1 128446
96 178489 1 1 111542
97 207720 1 1 136048
98 268066 1 1 197257
99 349934 1 1 162079
100 368833 1 1 206286
101 247804 1 1 109858
102 265849 1 1 182125
103 174311 1 1 74168
104 43287 1 1 19630
105 176724 1 1 88634
106 189021 1 1 128321
107 237531 1 1 118936
108 279589 1 1 127044
109 106655 1 1 178377
110 135798 1 1 69581
111 290495 1 1 168019
112 266805 1 1 113598
113 23623 1 1 5841
114 174970 1 1 93116
115 61857 1 1 24610
116 147760 1 1 60611
117 358662 1 1 226620
118 21054 1 1 6622
119 230091 1 1 121996
120 31414 1 1 13155
121 284519 1 1 154158
122 209481 1 1 78489
123 161691 1 1 22007
124 137093 1 1 72530
125 38214 1 1 13983
126 166059 1 1 73397
127 319346 1 1 143878
128 186273 1 1 119956
129 374212 1 1 181558
130 275578 1 1 208236
131 368863 1 1 237085
132 179928 1 1 110297
133 94381 1 1 61394
134 251253 1 1 81420
135 382564 1 1 191154
136 118033 1 1 11798
137 370878 1 1 135724
138 147989 1 1 68614
139 236370 1 1 139926
140 193220 1 1 105203
141 189020 1 1 80338
142 341992 1 1 121376
143 224936 1 1 124922
144 173260 1 1 10901
145 286161 1 1 135471
146 130908 1 1 66395
147 209639 1 1 134041
148 262412 1 1 153554
149 1 1 1 0
150 14688 1 1 7953
151 98 1 1 0
152 455 1 1 0
153 0 1 1 0
154 0 1 1 0
155 195822 1 1 98922
156 347930 1 1 165395
157 0 1 1 0
158 203 1 1 0
159 7199 1 1 4245
160 46660 1 1 21509
161 17547 1 1 7670
162 107465 1 1 15167
163 969 1 1 0
164 179994 1 1 63891
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Pop
48827.344 17275.676
Gender Compendium_writing_time_sec
-23157.096 1.525
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-208382 -34430 -8652 23555 235376
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.883e+04 1.111e+04 4.394 2.02e-05 ***
Pop 1.728e+04 2.054e+04 0.841 0.402
Gender -2.316e+04 2.125e+04 -1.090 0.278
Compendium_writing_time_sec 1.525e+00 7.249e-02 21.043 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 52630 on 160 degrees of freedom
Multiple R-squared: 0.7408, Adjusted R-squared: 0.736
F-statistic: 152.4 on 3 and 160 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.5245297 0.950940629 0.475470315
[2,] 0.4061374 0.812274871 0.593862565
[3,] 0.2668683 0.533736517 0.733131741
[4,] 0.1748654 0.349730781 0.825134610
[5,] 0.1041179 0.208235779 0.895882110
[6,] 0.1389171 0.277834161 0.861082919
[7,] 0.1018670 0.203733913 0.898133043
[8,] 0.5705283 0.858943360 0.429471680
[9,] 0.4803202 0.960640465 0.519679768
[10,] 0.4914322 0.982864371 0.508567814
[11,] 0.4177232 0.835446307 0.582276847
[12,] 0.3775597 0.755119361 0.622440319
[13,] 0.3714623 0.742924611 0.628537695
[14,] 0.3035967 0.607193306 0.696403347
[15,] 0.2399123 0.479824592 0.760087704
[16,] 0.5730181 0.853963847 0.426981923
[17,] 0.5693222 0.861355663 0.430677831
[18,] 0.5101862 0.979627564 0.489813782
[19,] 0.4483580 0.896715992 0.551642004
[20,] 0.3974810 0.794962047 0.602518977
[21,] 0.3570596 0.714119156 0.642940422
[22,] 0.3233149 0.646629841 0.676685079
[23,] 0.2720398 0.544079642 0.727960179
[24,] 0.4185221 0.837044283 0.581477858
[25,] 0.4315139 0.863027776 0.568486112
[26,] 0.3803223 0.760644612 0.619677694
[27,] 0.3373028 0.674605692 0.662697154
[28,] 0.2863150 0.572630016 0.713684992
[29,] 0.2423758 0.484751600 0.757624200
[30,] 0.2753071 0.550614207 0.724692897
[31,] 0.3201637 0.640327396 0.679836302
[32,] 0.2726710 0.545342041 0.727328980
[33,] 0.2341690 0.468338011 0.765830995
[34,] 0.2046619 0.409323752 0.795338124
[35,] 0.2078775 0.415754920 0.792122540
[36,] 0.1723458 0.344691569 0.827654216
[37,] 0.1804445 0.360888993 0.819555504
[38,] 0.1552654 0.310530888 0.844734556
[39,] 0.1730973 0.346194580 0.826902710
[40,] 0.9261856 0.147628849 0.073814425
[41,] 0.9230414 0.153917236 0.076958618
[42,] 0.9043043 0.191391483 0.095695742
[43,] 0.8840177 0.231964555 0.115982278
[44,] 0.8650237 0.269952680 0.134976340
[45,] 0.8515267 0.296946635 0.148473318
[46,] 0.8325415 0.334917064 0.167458532
[47,] 0.8467220 0.306556092 0.153278046
[48,] 0.8181186 0.363762832 0.181881416
[49,] 0.7862422 0.427515533 0.213757766
[50,] 0.7827518 0.434496471 0.217248236
[51,] 0.7551694 0.489661121 0.244830560
[52,] 0.7208317 0.558336569 0.279168285
[53,] 0.6922017 0.615596638 0.307798319
[54,] 0.7632906 0.473418855 0.236709428
[55,] 0.7291298 0.541740406 0.270870203
[56,] 0.7530563 0.493887416 0.246943708
[57,] 0.7234387 0.553122581 0.276561290
[58,] 0.6890137 0.621972670 0.310986335
[59,] 0.6838681 0.632263830 0.316131915
[60,] 0.6612388 0.677522384 0.338761192
[61,] 0.6181509 0.763698100 0.381849050
[62,] 0.5795465 0.840907021 0.420453510
[63,] 0.5366049 0.926790105 0.463395053
[64,] 0.5042021 0.991595777 0.495797889
[65,] 0.4710698 0.942139663 0.528930169
[66,] 0.4258212 0.851642470 0.574178765
[67,] 0.3888382 0.777676330 0.611161835
[68,] 0.3458455 0.691691062 0.654154469
[69,] 0.3109353 0.621870644 0.689064678
[70,] 0.5596182 0.880763573 0.440381786
[71,] 0.5145172 0.970965598 0.485482799
[72,] 0.5630099 0.873980202 0.436990101
[73,] 0.5221342 0.955731697 0.477865849
[74,] 0.4772747 0.954549368 0.522725316
[75,] 0.4367465 0.873493084 0.563253458
[76,] 0.6101120 0.779775999 0.389887999
[77,] 0.5661688 0.867662342 0.433831171
[78,] 0.5233942 0.953211549 0.476605775
[79,] 0.5156154 0.968769131 0.484384566
[80,] 0.5107776 0.978444746 0.489222373
[81,] 0.4961032 0.992206333 0.503896833
[82,] 0.6443400 0.711319910 0.355659955
[83,] 0.6035208 0.792958372 0.396479186
[84,] 0.5601934 0.879613263 0.439806631
[85,] 0.5344121 0.931175772 0.465587886
[86,] 0.4891419 0.978283857 0.510858071
[87,] 0.4465598 0.893119563 0.553440219
[88,] 0.4854667 0.970933366 0.514533317
[89,] 0.4585209 0.917041806 0.541479097
[90,] 0.4335251 0.867050110 0.566474945
[91,] 0.4180179 0.836035725 0.581982138
[92,] 0.4647343 0.929468583 0.535265708
[93,] 0.4755341 0.951068277 0.524465861
[94,] 0.4314090 0.862818089 0.568590956
[95,] 0.4075266 0.815053229 0.592473385
[96,] 0.4105424 0.821084802 0.589457599
[97,] 0.3706905 0.741381037 0.629309481
[98,] 0.3421112 0.684222395 0.657888802
[99,] 0.3000609 0.600121871 0.699939064
[100,] 0.2949270 0.589854044 0.705072978
[101,] 0.2572758 0.514551568 0.742724216
[102,] 0.2427681 0.485536281 0.757231860
[103,] 0.8722584 0.255483268 0.127741634
[104,] 0.8468296 0.306340712 0.153170356
[105,] 0.8198303 0.360339425 0.180169712
[106,] 0.8138647 0.372270565 0.186135282
[107,] 0.7880850 0.423830086 0.211915043
[108,] 0.7519022 0.496195564 0.248097782
[109,] 0.7150020 0.569996069 0.284998034
[110,] 0.6729016 0.654196715 0.327098358
[111,] 0.6625513 0.674897352 0.337448676
[112,] 0.6288067 0.742386572 0.371193286
[113,] 0.5797538 0.840492421 0.420246210
[114,] 0.5432841 0.913431792 0.456715896
[115,] 0.4925285 0.985056901 0.507471550
[116,] 0.4768837 0.953767489 0.523116256
[117,] 0.5776514 0.844697274 0.422348637
[118,] 0.5295146 0.940970845 0.470485422
[119,] 0.4839893 0.967978558 0.516010721
[120,] 0.4318279 0.863655713 0.568172143
[121,] 0.4247622 0.849524347 0.575237827
[122,] 0.4080752 0.816150349 0.591924826
[123,] 0.3900434 0.780086856 0.609956572
[124,] 0.5552159 0.889568190 0.444784095
[125,] 0.6318862 0.736227550 0.368113775
[126,] 0.6243026 0.751394790 0.375697395
[127,] 0.6116941 0.776611748 0.388305874
[128,] 0.6785713 0.642857326 0.321428663
[129,] 0.6309145 0.738170967 0.369085483
[130,] 0.6889729 0.622054230 0.311027115
[131,] 0.8401481 0.319703886 0.159851943
[132,] 0.7956068 0.408786440 0.204393220
[133,] 0.7785288 0.442942300 0.221471150
[134,] 0.7349528 0.530094458 0.265047229
[135,] 0.6822804 0.635439183 0.317719592
[136,] 0.8563654 0.287269264 0.143634632
[137,] 0.8153686 0.369262867 0.184631434
[138,] 0.9966490 0.006702089 0.003351044
[139,] 0.9951446 0.009710750 0.004855375
[140,] 0.9907756 0.018448748 0.009224374
[141,] 0.9944333 0.011133346 0.005566673
[142,] 0.9977865 0.004426986 0.002213493
[143,] 0.9953123 0.009375456 0.004687728
[144,] 0.9905306 0.018938878 0.009469439
[145,] 0.9811783 0.037643473 0.018821736
[146,] 0.9638874 0.072225226 0.036112613
[147,] 0.9339240 0.132151947 0.066075973
[148,] 0.8847762 0.230447548 0.115223774
[149,] 0.8258637 0.348272652 0.174136326
[150,] 0.8291104 0.341779270 0.170889635
[151,] 0.6889763 0.622047317 0.311023659
> postscript(file="/var/fisher/rcomp/tmp/12sjj1354889340.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/fisher/rcomp/tmp/263k41354889340.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/fisher/rcomp/tmp/3nqb81354889340.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/fisher/rcomp/tmp/4xlce1354889340.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/fisher/rcomp/tmp/55fpf1354889340.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 164
Frequency = 1
1 2 3 4 5 6
-36165.0380 -77204.3396 15808.0665 1123.2557 -43343.4902 -56066.7740
7 8 9 10 11 12
33725.0985 -26094.7095 -24349.5435 -8298.1129 -993.7589 31631.3969
13 14 15 16 17 18
2799.7433 119578.7085 -12566.0235 63206.0287 -10494.1337 38993.5814
19 20 21 22 23 24
-51599.7121 12952.6367 7877.8426 135828.2366 -50877.4208 -25714.7394
25 26 27 28 29 30
11478.6831 -24105.8344 -20794.9445 -26252.6510 272.8387 -84011.2328
31 32 33 34 35 36
-57473.1458 -21955.7561 -25004.0130 -3216.2956 13418.8168 64678.4133
37 38 39 40 41 42
73959.9727 -9590.6241 -23222.2676 29924.6226 54251.0952 -13230.7031
43 44 45 46 47 48
-56183.5708 20368.2956 -62557.0620 235375.5553 -56924.6651 -8938.6644
49 50 51 52 53 54
-15649.7916 -34373.8708 -60887.9723 -24437.5523 54328.1129 1058.2179
55 56 57 58 59 60
5528.1626 51291.1580 -26880.1268 -30540.1013 -45540.3663 79895.3466
61 62 63 64 65 66
18316.7267 -70255.8674 23634.9337 20719.5929 -51490.4938 -39632.1830
67 68 69 70 71 72
-3144.3291 -23306.7946 8097.4267 -32541.3154 23781.7562 -5720.3571
73 74 75 76 77 78
18547.3217 -504.1043 -23217.2646 136538.2558 2983.5936 -77558.7104
79 80 81 82 83 84
16942.2556 6536.5382 -16411.7890 117452.0037 -1650.8508 13151.7635
85 86 87 88 89 90
-47096.4096 51981.3236 -42964.4993 111889.7579 13762.0495 9642.6062
91 92 93 94 95 96
36151.2670 4573.0438 -11532.8299 73773.7790 34758.3033 -34599.8294
97 98 99 100 101 102
-42749.5652 -75769.9840 59757.5085 11224.4434 37283.8949 -54905.0737
103 104 105 106 107 108
18231.3773 -29601.9522 -1421.6361 -49662.0254 13163.5792 42853.8731
109 110 111 112 113 114
-208381.9841 -13284.7470 -8742.1938 50580.0083 -28232.6148 -10012.3478
115 116 117 118 119 120
-18628.2986 12359.8287 -29963.4457 -31992.9293 1055.9447 -31598.1765
121 122 123 124 125 126
6424.9703 46810.2503 85176.2415 -16488.0653 -26061.1835 11155.4382
127 128 129 130 131 132
56932.7817 -39650.2990 54322.8115 -85005.0296 -35725.4507 -31261.7428
133 134 135 136 137 138
-42213.5366 84111.3886 48037.3537 57090.7516 120902.6549 381.2865
139 140 141 142 143 144
-20014.9530 -10199.5042 23528.8398 113902.6745 -8562.2902 113686.0092
145 146 147 148 149 150
36571.5737 -13314.9157 -37769.1461 -14760.7058 -42944.9242 -40389.1978
151 152 153 154 155 156
-42847.9242 -42490.9242 -42945.9242 -42945.9242 1983.3496 52695.3791
157 158 159 160 161 162
-42945.9242 -42742.9242 -42222.1230 -29095.1238 -37098.5179 41383.7775
163 164
-41976.9242 39590.6126
> postscript(file="/var/fisher/rcomp/tmp/61nmw1354889340.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 -36165.0380 NA
1 -77204.3396 -36165.0380
2 15808.0665 -77204.3396
3 1123.2557 15808.0665
4 -43343.4902 1123.2557
5 -56066.7740 -43343.4902
6 33725.0985 -56066.7740
7 -26094.7095 33725.0985
8 -24349.5435 -26094.7095
9 -8298.1129 -24349.5435
10 -993.7589 -8298.1129
11 31631.3969 -993.7589
12 2799.7433 31631.3969
13 119578.7085 2799.7433
14 -12566.0235 119578.7085
15 63206.0287 -12566.0235
16 -10494.1337 63206.0287
17 38993.5814 -10494.1337
18 -51599.7121 38993.5814
19 12952.6367 -51599.7121
20 7877.8426 12952.6367
21 135828.2366 7877.8426
22 -50877.4208 135828.2366
23 -25714.7394 -50877.4208
24 11478.6831 -25714.7394
25 -24105.8344 11478.6831
26 -20794.9445 -24105.8344
27 -26252.6510 -20794.9445
28 272.8387 -26252.6510
29 -84011.2328 272.8387
30 -57473.1458 -84011.2328
31 -21955.7561 -57473.1458
32 -25004.0130 -21955.7561
33 -3216.2956 -25004.0130
34 13418.8168 -3216.2956
35 64678.4133 13418.8168
36 73959.9727 64678.4133
37 -9590.6241 73959.9727
38 -23222.2676 -9590.6241
39 29924.6226 -23222.2676
40 54251.0952 29924.6226
41 -13230.7031 54251.0952
42 -56183.5708 -13230.7031
43 20368.2956 -56183.5708
44 -62557.0620 20368.2956
45 235375.5553 -62557.0620
46 -56924.6651 235375.5553
47 -8938.6644 -56924.6651
48 -15649.7916 -8938.6644
49 -34373.8708 -15649.7916
50 -60887.9723 -34373.8708
51 -24437.5523 -60887.9723
52 54328.1129 -24437.5523
53 1058.2179 54328.1129
54 5528.1626 1058.2179
55 51291.1580 5528.1626
56 -26880.1268 51291.1580
57 -30540.1013 -26880.1268
58 -45540.3663 -30540.1013
59 79895.3466 -45540.3663
60 18316.7267 79895.3466
61 -70255.8674 18316.7267
62 23634.9337 -70255.8674
63 20719.5929 23634.9337
64 -51490.4938 20719.5929
65 -39632.1830 -51490.4938
66 -3144.3291 -39632.1830
67 -23306.7946 -3144.3291
68 8097.4267 -23306.7946
69 -32541.3154 8097.4267
70 23781.7562 -32541.3154
71 -5720.3571 23781.7562
72 18547.3217 -5720.3571
73 -504.1043 18547.3217
74 -23217.2646 -504.1043
75 136538.2558 -23217.2646
76 2983.5936 136538.2558
77 -77558.7104 2983.5936
78 16942.2556 -77558.7104
79 6536.5382 16942.2556
80 -16411.7890 6536.5382
81 117452.0037 -16411.7890
82 -1650.8508 117452.0037
83 13151.7635 -1650.8508
84 -47096.4096 13151.7635
85 51981.3236 -47096.4096
86 -42964.4993 51981.3236
87 111889.7579 -42964.4993
88 13762.0495 111889.7579
89 9642.6062 13762.0495
90 36151.2670 9642.6062
91 4573.0438 36151.2670
92 -11532.8299 4573.0438
93 73773.7790 -11532.8299
94 34758.3033 73773.7790
95 -34599.8294 34758.3033
96 -42749.5652 -34599.8294
97 -75769.9840 -42749.5652
98 59757.5085 -75769.9840
99 11224.4434 59757.5085
100 37283.8949 11224.4434
101 -54905.0737 37283.8949
102 18231.3773 -54905.0737
103 -29601.9522 18231.3773
104 -1421.6361 -29601.9522
105 -49662.0254 -1421.6361
106 13163.5792 -49662.0254
107 42853.8731 13163.5792
108 -208381.9841 42853.8731
109 -13284.7470 -208381.9841
110 -8742.1938 -13284.7470
111 50580.0083 -8742.1938
112 -28232.6148 50580.0083
113 -10012.3478 -28232.6148
114 -18628.2986 -10012.3478
115 12359.8287 -18628.2986
116 -29963.4457 12359.8287
117 -31992.9293 -29963.4457
118 1055.9447 -31992.9293
119 -31598.1765 1055.9447
120 6424.9703 -31598.1765
121 46810.2503 6424.9703
122 85176.2415 46810.2503
123 -16488.0653 85176.2415
124 -26061.1835 -16488.0653
125 11155.4382 -26061.1835
126 56932.7817 11155.4382
127 -39650.2990 56932.7817
128 54322.8115 -39650.2990
129 -85005.0296 54322.8115
130 -35725.4507 -85005.0296
131 -31261.7428 -35725.4507
132 -42213.5366 -31261.7428
133 84111.3886 -42213.5366
134 48037.3537 84111.3886
135 57090.7516 48037.3537
136 120902.6549 57090.7516
137 381.2865 120902.6549
138 -20014.9530 381.2865
139 -10199.5042 -20014.9530
140 23528.8398 -10199.5042
141 113902.6745 23528.8398
142 -8562.2902 113902.6745
143 113686.0092 -8562.2902
144 36571.5737 113686.0092
145 -13314.9157 36571.5737
146 -37769.1461 -13314.9157
147 -14760.7058 -37769.1461
148 -42944.9242 -14760.7058
149 -40389.1978 -42944.9242
150 -42847.9242 -40389.1978
151 -42490.9242 -42847.9242
152 -42945.9242 -42490.9242
153 -42945.9242 -42945.9242
154 1983.3496 -42945.9242
155 52695.3791 1983.3496
156 -42945.9242 52695.3791
157 -42742.9242 -42945.9242
158 -42222.1230 -42742.9242
159 -29095.1238 -42222.1230
160 -37098.5179 -29095.1238
161 41383.7775 -37098.5179
162 -41976.9242 41383.7775
163 39590.6126 -41976.9242
164 NA 39590.6126
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -77204.3396 -36165.0380
[2,] 15808.0665 -77204.3396
[3,] 1123.2557 15808.0665
[4,] -43343.4902 1123.2557
[5,] -56066.7740 -43343.4902
[6,] 33725.0985 -56066.7740
[7,] -26094.7095 33725.0985
[8,] -24349.5435 -26094.7095
[9,] -8298.1129 -24349.5435
[10,] -993.7589 -8298.1129
[11,] 31631.3969 -993.7589
[12,] 2799.7433 31631.3969
[13,] 119578.7085 2799.7433
[14,] -12566.0235 119578.7085
[15,] 63206.0287 -12566.0235
[16,] -10494.1337 63206.0287
[17,] 38993.5814 -10494.1337
[18,] -51599.7121 38993.5814
[19,] 12952.6367 -51599.7121
[20,] 7877.8426 12952.6367
[21,] 135828.2366 7877.8426
[22,] -50877.4208 135828.2366
[23,] -25714.7394 -50877.4208
[24,] 11478.6831 -25714.7394
[25,] -24105.8344 11478.6831
[26,] -20794.9445 -24105.8344
[27,] -26252.6510 -20794.9445
[28,] 272.8387 -26252.6510
[29,] -84011.2328 272.8387
[30,] -57473.1458 -84011.2328
[31,] -21955.7561 -57473.1458
[32,] -25004.0130 -21955.7561
[33,] -3216.2956 -25004.0130
[34,] 13418.8168 -3216.2956
[35,] 64678.4133 13418.8168
[36,] 73959.9727 64678.4133
[37,] -9590.6241 73959.9727
[38,] -23222.2676 -9590.6241
[39,] 29924.6226 -23222.2676
[40,] 54251.0952 29924.6226
[41,] -13230.7031 54251.0952
[42,] -56183.5708 -13230.7031
[43,] 20368.2956 -56183.5708
[44,] -62557.0620 20368.2956
[45,] 235375.5553 -62557.0620
[46,] -56924.6651 235375.5553
[47,] -8938.6644 -56924.6651
[48,] -15649.7916 -8938.6644
[49,] -34373.8708 -15649.7916
[50,] -60887.9723 -34373.8708
[51,] -24437.5523 -60887.9723
[52,] 54328.1129 -24437.5523
[53,] 1058.2179 54328.1129
[54,] 5528.1626 1058.2179
[55,] 51291.1580 5528.1626
[56,] -26880.1268 51291.1580
[57,] -30540.1013 -26880.1268
[58,] -45540.3663 -30540.1013
[59,] 79895.3466 -45540.3663
[60,] 18316.7267 79895.3466
[61,] -70255.8674 18316.7267
[62,] 23634.9337 -70255.8674
[63,] 20719.5929 23634.9337
[64,] -51490.4938 20719.5929
[65,] -39632.1830 -51490.4938
[66,] -3144.3291 -39632.1830
[67,] -23306.7946 -3144.3291
[68,] 8097.4267 -23306.7946
[69,] -32541.3154 8097.4267
[70,] 23781.7562 -32541.3154
[71,] -5720.3571 23781.7562
[72,] 18547.3217 -5720.3571
[73,] -504.1043 18547.3217
[74,] -23217.2646 -504.1043
[75,] 136538.2558 -23217.2646
[76,] 2983.5936 136538.2558
[77,] -77558.7104 2983.5936
[78,] 16942.2556 -77558.7104
[79,] 6536.5382 16942.2556
[80,] -16411.7890 6536.5382
[81,] 117452.0037 -16411.7890
[82,] -1650.8508 117452.0037
[83,] 13151.7635 -1650.8508
[84,] -47096.4096 13151.7635
[85,] 51981.3236 -47096.4096
[86,] -42964.4993 51981.3236
[87,] 111889.7579 -42964.4993
[88,] 13762.0495 111889.7579
[89,] 9642.6062 13762.0495
[90,] 36151.2670 9642.6062
[91,] 4573.0438 36151.2670
[92,] -11532.8299 4573.0438
[93,] 73773.7790 -11532.8299
[94,] 34758.3033 73773.7790
[95,] -34599.8294 34758.3033
[96,] -42749.5652 -34599.8294
[97,] -75769.9840 -42749.5652
[98,] 59757.5085 -75769.9840
[99,] 11224.4434 59757.5085
[100,] 37283.8949 11224.4434
[101,] -54905.0737 37283.8949
[102,] 18231.3773 -54905.0737
[103,] -29601.9522 18231.3773
[104,] -1421.6361 -29601.9522
[105,] -49662.0254 -1421.6361
[106,] 13163.5792 -49662.0254
[107,] 42853.8731 13163.5792
[108,] -208381.9841 42853.8731
[109,] -13284.7470 -208381.9841
[110,] -8742.1938 -13284.7470
[111,] 50580.0083 -8742.1938
[112,] -28232.6148 50580.0083
[113,] -10012.3478 -28232.6148
[114,] -18628.2986 -10012.3478
[115,] 12359.8287 -18628.2986
[116,] -29963.4457 12359.8287
[117,] -31992.9293 -29963.4457
[118,] 1055.9447 -31992.9293
[119,] -31598.1765 1055.9447
[120,] 6424.9703 -31598.1765
[121,] 46810.2503 6424.9703
[122,] 85176.2415 46810.2503
[123,] -16488.0653 85176.2415
[124,] -26061.1835 -16488.0653
[125,] 11155.4382 -26061.1835
[126,] 56932.7817 11155.4382
[127,] -39650.2990 56932.7817
[128,] 54322.8115 -39650.2990
[129,] -85005.0296 54322.8115
[130,] -35725.4507 -85005.0296
[131,] -31261.7428 -35725.4507
[132,] -42213.5366 -31261.7428
[133,] 84111.3886 -42213.5366
[134,] 48037.3537 84111.3886
[135,] 57090.7516 48037.3537
[136,] 120902.6549 57090.7516
[137,] 381.2865 120902.6549
[138,] -20014.9530 381.2865
[139,] -10199.5042 -20014.9530
[140,] 23528.8398 -10199.5042
[141,] 113902.6745 23528.8398
[142,] -8562.2902 113902.6745
[143,] 113686.0092 -8562.2902
[144,] 36571.5737 113686.0092
[145,] -13314.9157 36571.5737
[146,] -37769.1461 -13314.9157
[147,] -14760.7058 -37769.1461
[148,] -42944.9242 -14760.7058
[149,] -40389.1978 -42944.9242
[150,] -42847.9242 -40389.1978
[151,] -42490.9242 -42847.9242
[152,] -42945.9242 -42490.9242
[153,] -42945.9242 -42945.9242
[154,] 1983.3496 -42945.9242
[155,] 52695.3791 1983.3496
[156,] -42945.9242 52695.3791
[157,] -42742.9242 -42945.9242
[158,] -42222.1230 -42742.9242
[159,] -29095.1238 -42222.1230
[160,] -37098.5179 -29095.1238
[161,] 41383.7775 -37098.5179
[162,] -41976.9242 41383.7775
[163,] 39590.6126 -41976.9242
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -77204.3396 -36165.0380
2 15808.0665 -77204.3396
3 1123.2557 15808.0665
4 -43343.4902 1123.2557
5 -56066.7740 -43343.4902
6 33725.0985 -56066.7740
7 -26094.7095 33725.0985
8 -24349.5435 -26094.7095
9 -8298.1129 -24349.5435
10 -993.7589 -8298.1129
11 31631.3969 -993.7589
12 2799.7433 31631.3969
13 119578.7085 2799.7433
14 -12566.0235 119578.7085
15 63206.0287 -12566.0235
16 -10494.1337 63206.0287
17 38993.5814 -10494.1337
18 -51599.7121 38993.5814
19 12952.6367 -51599.7121
20 7877.8426 12952.6367
21 135828.2366 7877.8426
22 -50877.4208 135828.2366
23 -25714.7394 -50877.4208
24 11478.6831 -25714.7394
25 -24105.8344 11478.6831
26 -20794.9445 -24105.8344
27 -26252.6510 -20794.9445
28 272.8387 -26252.6510
29 -84011.2328 272.8387
30 -57473.1458 -84011.2328
31 -21955.7561 -57473.1458
32 -25004.0130 -21955.7561
33 -3216.2956 -25004.0130
34 13418.8168 -3216.2956
35 64678.4133 13418.8168
36 73959.9727 64678.4133
37 -9590.6241 73959.9727
38 -23222.2676 -9590.6241
39 29924.6226 -23222.2676
40 54251.0952 29924.6226
41 -13230.7031 54251.0952
42 -56183.5708 -13230.7031
43 20368.2956 -56183.5708
44 -62557.0620 20368.2956
45 235375.5553 -62557.0620
46 -56924.6651 235375.5553
47 -8938.6644 -56924.6651
48 -15649.7916 -8938.6644
49 -34373.8708 -15649.7916
50 -60887.9723 -34373.8708
51 -24437.5523 -60887.9723
52 54328.1129 -24437.5523
53 1058.2179 54328.1129
54 5528.1626 1058.2179
55 51291.1580 5528.1626
56 -26880.1268 51291.1580
57 -30540.1013 -26880.1268
58 -45540.3663 -30540.1013
59 79895.3466 -45540.3663
60 18316.7267 79895.3466
61 -70255.8674 18316.7267
62 23634.9337 -70255.8674
63 20719.5929 23634.9337
64 -51490.4938 20719.5929
65 -39632.1830 -51490.4938
66 -3144.3291 -39632.1830
67 -23306.7946 -3144.3291
68 8097.4267 -23306.7946
69 -32541.3154 8097.4267
70 23781.7562 -32541.3154
71 -5720.3571 23781.7562
72 18547.3217 -5720.3571
73 -504.1043 18547.3217
74 -23217.2646 -504.1043
75 136538.2558 -23217.2646
76 2983.5936 136538.2558
77 -77558.7104 2983.5936
78 16942.2556 -77558.7104
79 6536.5382 16942.2556
80 -16411.7890 6536.5382
81 117452.0037 -16411.7890
82 -1650.8508 117452.0037
83 13151.7635 -1650.8508
84 -47096.4096 13151.7635
85 51981.3236 -47096.4096
86 -42964.4993 51981.3236
87 111889.7579 -42964.4993
88 13762.0495 111889.7579
89 9642.6062 13762.0495
90 36151.2670 9642.6062
91 4573.0438 36151.2670
92 -11532.8299 4573.0438
93 73773.7790 -11532.8299
94 34758.3033 73773.7790
95 -34599.8294 34758.3033
96 -42749.5652 -34599.8294
97 -75769.9840 -42749.5652
98 59757.5085 -75769.9840
99 11224.4434 59757.5085
100 37283.8949 11224.4434
101 -54905.0737 37283.8949
102 18231.3773 -54905.0737
103 -29601.9522 18231.3773
104 -1421.6361 -29601.9522
105 -49662.0254 -1421.6361
106 13163.5792 -49662.0254
107 42853.8731 13163.5792
108 -208381.9841 42853.8731
109 -13284.7470 -208381.9841
110 -8742.1938 -13284.7470
111 50580.0083 -8742.1938
112 -28232.6148 50580.0083
113 -10012.3478 -28232.6148
114 -18628.2986 -10012.3478
115 12359.8287 -18628.2986
116 -29963.4457 12359.8287
117 -31992.9293 -29963.4457
118 1055.9447 -31992.9293
119 -31598.1765 1055.9447
120 6424.9703 -31598.1765
121 46810.2503 6424.9703
122 85176.2415 46810.2503
123 -16488.0653 85176.2415
124 -26061.1835 -16488.0653
125 11155.4382 -26061.1835
126 56932.7817 11155.4382
127 -39650.2990 56932.7817
128 54322.8115 -39650.2990
129 -85005.0296 54322.8115
130 -35725.4507 -85005.0296
131 -31261.7428 -35725.4507
132 -42213.5366 -31261.7428
133 84111.3886 -42213.5366
134 48037.3537 84111.3886
135 57090.7516 48037.3537
136 120902.6549 57090.7516
137 381.2865 120902.6549
138 -20014.9530 381.2865
139 -10199.5042 -20014.9530
140 23528.8398 -10199.5042
141 113902.6745 23528.8398
142 -8562.2902 113902.6745
143 113686.0092 -8562.2902
144 36571.5737 113686.0092
145 -13314.9157 36571.5737
146 -37769.1461 -13314.9157
147 -14760.7058 -37769.1461
148 -42944.9242 -14760.7058
149 -40389.1978 -42944.9242
150 -42847.9242 -40389.1978
151 -42490.9242 -42847.9242
152 -42945.9242 -42490.9242
153 -42945.9242 -42945.9242
154 1983.3496 -42945.9242
155 52695.3791 1983.3496
156 -42945.9242 52695.3791
157 -42742.9242 -42945.9242
158 -42222.1230 -42742.9242
159 -29095.1238 -42222.1230
160 -37098.5179 -29095.1238
161 41383.7775 -37098.5179
162 -41976.9242 41383.7775
163 39590.6126 -41976.9242
> 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/fisher/rcomp/tmp/70ivr1354889340.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/fisher/rcomp/tmp/8vb4v1354889340.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/fisher/rcomp/tmp/9eng41354889340.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/fisher/rcomp/tmp/10yknv1354889340.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11mbp51354889340.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/fisher/rcomp/tmp/12pqbo1354889340.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/fisher/rcomp/tmp/13vjs71354889340.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/fisher/rcomp/tmp/14gx6i1354889340.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/fisher/rcomp/tmp/15yanc1354889340.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/fisher/rcomp/tmp/16vttn1354889340.tab")
+ }
>
> try(system("convert tmp/12sjj1354889340.ps tmp/12sjj1354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/263k41354889340.ps tmp/263k41354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/3nqb81354889340.ps tmp/3nqb81354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/4xlce1354889340.ps tmp/4xlce1354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/55fpf1354889340.ps tmp/55fpf1354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/61nmw1354889340.ps tmp/61nmw1354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/70ivr1354889340.ps tmp/70ivr1354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/8vb4v1354889340.ps tmp/8vb4v1354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/9eng41354889340.ps tmp/9eng41354889340.png",intern=TRUE))
character(0)
> try(system("convert tmp/10yknv1354889340.ps tmp/10yknv1354889340.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.296 1.559 9.854