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(170650
+ ,1173
+ ,26
+ ,86621
+ ,669
+ ,20
+ ,127843
+ ,1154
+ ,27
+ ,152526
+ ,1948
+ ,25
+ ,92389
+ ,722
+ ,17
+ ,38778
+ ,336
+ ,16
+ ,316392
+ ,2727
+ ,20
+ ,32750
+ ,345
+ ,18
+ ,123444
+ ,1416
+ ,19
+ ,137034
+ ,1208
+ ,22
+ ,176816
+ ,1432
+ ,30
+ ,143205
+ ,1246
+ ,40
+ ,113286
+ ,1205
+ ,26
+ ,195452
+ ,1732
+ ,36
+ ,144513
+ ,1214
+ ,31
+ ,263581
+ ,3222
+ ,41
+ ,183271
+ ,1385
+ ,24
+ ,210763
+ ,2011
+ ,27
+ ,113853
+ ,884
+ ,19
+ ,159968
+ ,1631
+ ,30
+ ,174585
+ ,1460
+ ,31
+ ,294675
+ ,1950
+ ,26
+ ,96213
+ ,860
+ ,15
+ ,116390
+ ,1165
+ ,33
+ ,146342
+ ,2115
+ ,28
+ ,152647
+ ,1940
+ ,27
+ ,166661
+ ,1858
+ ,21
+ ,175505
+ ,1347
+ ,27
+ ,112485
+ ,1093
+ ,21
+ ,198790
+ ,1650
+ ,30
+ ,191822
+ ,1551
+ ,30
+ ,140267
+ ,1273
+ ,33
+ ,221991
+ ,1478
+ ,35
+ ,75339
+ ,670
+ ,26
+ ,247985
+ ,2040
+ ,27
+ ,167351
+ ,1562
+ ,25
+ ,266609
+ ,2079
+ ,30
+ ,122024
+ ,1113
+ ,20
+ ,80964
+ ,686
+ ,8
+ ,215183
+ ,2066
+ ,24
+ ,225469
+ ,2251
+ ,25
+ ,125382
+ ,1107
+ ,28
+ ,141437
+ ,1245
+ ,23
+ ,81106
+ ,1021
+ ,21
+ ,93125
+ ,1735
+ ,21
+ ,318668
+ ,3681
+ ,26
+ ,78800
+ ,918
+ ,26
+ ,161048
+ ,1582
+ ,30
+ ,236367
+ ,2900
+ ,34
+ ,131108
+ ,1497
+ ,30
+ ,131096
+ ,1116
+ ,18
+ ,24188
+ ,496
+ ,4
+ ,267003
+ ,1778
+ ,31
+ ,65029
+ ,744
+ ,18
+ ,100147
+ ,1104
+ ,14
+ ,178549
+ ,1703
+ ,21
+ ,186965
+ ,1871
+ ,37
+ ,197266
+ ,2460
+ ,24
+ ,217300
+ ,1705
+ ,29
+ ,149594
+ ,1334
+ ,24
+ ,263413
+ ,2647
+ ,31
+ ,209228
+ ,2218
+ ,21
+ ,145699
+ ,1635
+ ,31
+ ,187197
+ ,1741
+ ,26
+ ,150752
+ ,991
+ ,24
+ ,131218
+ ,1195
+ ,18
+ ,118697
+ ,1283
+ ,21
+ ,147913
+ ,1992
+ ,29
+ ,155015
+ ,1522
+ ,24
+ ,96487
+ ,1071
+ ,21
+ ,128780
+ ,1441
+ ,30
+ ,71972
+ ,852
+ ,20
+ ,140266
+ ,1425
+ ,30
+ ,152455
+ ,1246
+ ,24
+ ,110655
+ ,1100
+ ,26
+ ,204822
+ ,1400
+ ,27
+ ,216052
+ ,1556
+ ,24
+ ,113421
+ ,1015
+ ,23
+ ,103660
+ ,1002
+ ,26
+ ,128390
+ ,1190
+ ,25
+ ,105502
+ ,1244
+ ,18
+ ,299359
+ ,2657
+ ,30
+ ,141493
+ ,1232
+ ,25
+ ,148356
+ ,1344
+ ,27
+ ,80953
+ ,870
+ ,8
+ ,109237
+ ,1474
+ ,21
+ ,102104
+ ,881
+ ,26
+ ,233139
+ ,2489
+ ,24
+ ,176507
+ ,1444
+ ,30
+ ,118217
+ ,1995
+ ,27
+ ,142694
+ ,1258
+ ,24
+ ,152193
+ ,1357
+ ,25
+ ,126500
+ ,1329
+ ,21
+ ,174710
+ ,2041
+ ,24
+ ,187772
+ ,1454
+ ,24
+ ,140903
+ ,1171
+ ,24
+ ,155350
+ ,1219
+ ,24
+ ,202077
+ ,1522
+ ,24
+ ,213875
+ ,2314
+ ,40
+ ,252952
+ ,2289
+ ,22
+ ,166981
+ ,1371
+ ,31
+ ,190790
+ ,1639
+ ,26
+ ,106351
+ ,1000
+ ,20
+ ,43287
+ ,602
+ ,19
+ ,127493
+ ,1380
+ ,15
+ ,132143
+ ,1208
+ ,22
+ ,157469
+ ,1490
+ ,25
+ ,197727
+ ,1801
+ ,28
+ ,88077
+ ,728
+ ,23
+ ,94968
+ ,1152
+ ,25
+ ,191753
+ ,1277
+ ,26
+ ,153332
+ ,1401
+ ,32
+ ,22938
+ ,391
+ ,1
+ ,125927
+ ,1264
+ ,24
+ ,61857
+ ,530
+ ,11
+ ,103749
+ ,1123
+ ,31
+ ,269909
+ ,2055
+ ,26
+ ,21054
+ ,387
+ ,0
+ ,174409
+ ,1486
+ ,19
+ ,31414
+ ,449
+ ,8
+ ,200405
+ ,2212
+ ,27
+ ,139456
+ ,1148
+ ,31
+ ,78001
+ ,814
+ ,24
+ ,82724
+ ,1015
+ ,20
+ ,38214
+ ,568
+ ,8
+ ,91390
+ ,936
+ ,22
+ ,197612
+ ,1586
+ ,33
+ ,137161
+ ,871
+ ,33
+ ,251103
+ ,2276
+ ,31
+ ,209835
+ ,1638
+ ,33
+ ,269470
+ ,2238
+ ,35
+ ,139215
+ ,838
+ ,21
+ ,77796
+ ,841
+ ,24
+ ,197114
+ ,1904
+ ,25
+ ,291962
+ ,3054
+ ,31
+ ,56727
+ ,655
+ ,22
+ ,254843
+ ,2617
+ ,27
+ ,105908
+ ,1314
+ ,24
+ ,170155
+ ,1154
+ ,27
+ ,136745
+ ,1497
+ ,26
+ ,86706
+ ,754
+ ,16
+ ,251448
+ ,2832
+ ,23
+ ,152366
+ ,1281
+ ,24
+ ,173260
+ ,2035
+ ,21
+ ,212582
+ ,1894
+ ,30
+ ,87850
+ ,1268
+ ,37
+ ,148636
+ ,1714
+ ,24
+ ,185455
+ ,1568
+ ,29
+ ,0
+ ,0
+ ,0
+ ,14688
+ ,207
+ ,0
+ ,98
+ ,5
+ ,0
+ ,455
+ ,8
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,137891
+ ,1302
+ ,20
+ ,201052
+ ,1831
+ ,31
+ ,0
+ ,0
+ ,0
+ ,203
+ ,4
+ ,0
+ ,7199
+ ,151
+ ,0
+ ,46660
+ ,474
+ ,5
+ ,17547
+ ,141
+ ,1
+ ,73567
+ ,705
+ ,23
+ ,969
+ ,29
+ ,0
+ ,106662
+ ,1033
+ ,16)
+ ,dim=c(3
+ ,164)
+ ,dimnames=list(c('totaltime'
+ ,'numberofpageviews'
+ ,'compendiumviews')
+ ,1:164))
> y <- array(NA,dim=c(3,164),dimnames=list(c('totaltime','numberofpageviews','compendiumviews'),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
totaltime numberofpageviews compendiumviews
1 170650 1173 26
2 86621 669 20
3 127843 1154 27
4 152526 1948 25
5 92389 722 17
6 38778 336 16
7 316392 2727 20
8 32750 345 18
9 123444 1416 19
10 137034 1208 22
11 176816 1432 30
12 143205 1246 40
13 113286 1205 26
14 195452 1732 36
15 144513 1214 31
16 263581 3222 41
17 183271 1385 24
18 210763 2011 27
19 113853 884 19
20 159968 1631 30
21 174585 1460 31
22 294675 1950 26
23 96213 860 15
24 116390 1165 33
25 146342 2115 28
26 152647 1940 27
27 166661 1858 21
28 175505 1347 27
29 112485 1093 21
30 198790 1650 30
31 191822 1551 30
32 140267 1273 33
33 221991 1478 35
34 75339 670 26
35 247985 2040 27
36 167351 1562 25
37 266609 2079 30
38 122024 1113 20
39 80964 686 8
40 215183 2066 24
41 225469 2251 25
42 125382 1107 28
43 141437 1245 23
44 81106 1021 21
45 93125 1735 21
46 318668 3681 26
47 78800 918 26
48 161048 1582 30
49 236367 2900 34
50 131108 1497 30
51 131096 1116 18
52 24188 496 4
53 267003 1778 31
54 65029 744 18
55 100147 1104 14
56 178549 1703 21
57 186965 1871 37
58 197266 2460 24
59 217300 1705 29
60 149594 1334 24
61 263413 2647 31
62 209228 2218 21
63 145699 1635 31
64 187197 1741 26
65 150752 991 24
66 131218 1195 18
67 118697 1283 21
68 147913 1992 29
69 155015 1522 24
70 96487 1071 21
71 128780 1441 30
72 71972 852 20
73 140266 1425 30
74 152455 1246 24
75 110655 1100 26
76 204822 1400 27
77 216052 1556 24
78 113421 1015 23
79 103660 1002 26
80 128390 1190 25
81 105502 1244 18
82 299359 2657 30
83 141493 1232 25
84 148356 1344 27
85 80953 870 8
86 109237 1474 21
87 102104 881 26
88 233139 2489 24
89 176507 1444 30
90 118217 1995 27
91 142694 1258 24
92 152193 1357 25
93 126500 1329 21
94 174710 2041 24
95 187772 1454 24
96 140903 1171 24
97 155350 1219 24
98 202077 1522 24
99 213875 2314 40
100 252952 2289 22
101 166981 1371 31
102 190790 1639 26
103 106351 1000 20
104 43287 602 19
105 127493 1380 15
106 132143 1208 22
107 157469 1490 25
108 197727 1801 28
109 88077 728 23
110 94968 1152 25
111 191753 1277 26
112 153332 1401 32
113 22938 391 1
114 125927 1264 24
115 61857 530 11
116 103749 1123 31
117 269909 2055 26
118 21054 387 0
119 174409 1486 19
120 31414 449 8
121 200405 2212 27
122 139456 1148 31
123 78001 814 24
124 82724 1015 20
125 38214 568 8
126 91390 936 22
127 197612 1586 33
128 137161 871 33
129 251103 2276 31
130 209835 1638 33
131 269470 2238 35
132 139215 838 21
133 77796 841 24
134 197114 1904 25
135 291962 3054 31
136 56727 655 22
137 254843 2617 27
138 105908 1314 24
139 170155 1154 27
140 136745 1497 26
141 86706 754 16
142 251448 2832 23
143 152366 1281 24
144 173260 2035 21
145 212582 1894 30
146 87850 1268 37
147 148636 1714 24
148 185455 1568 29
149 0 0 0
150 14688 207 0
151 98 5 0
152 455 8 0
153 0 0 0
154 0 0 0
155 137891 1302 20
156 201052 1831 31
157 0 0 0
158 203 4 0
159 7199 151 0
160 46660 474 5
161 17547 141 1
162 73567 705 23
163 969 29 0
164 106662 1033 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) numberofpageviews compendiumviews
-3207.61 83.84 1384.00
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-83212 -17613 1386 12536 98403
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3207.613 6018.592 -0.533 0.595
numberofpageviews 83.844 4.417 18.980 < 2e-16 ***
compendiumviews 1384.000 331.184 4.179 4.79e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 28220 on 161 degrees of freedom
Multiple R-squared: 0.8486, Adjusted R-squared: 0.8467
F-statistic: 451.2 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.4990026 9.980052e-01 5.009974e-01
[2,] 0.8708386 2.583228e-01 1.291614e-01
[3,] 0.8092895 3.814210e-01 1.907105e-01
[4,] 0.8021954 3.956092e-01 1.978046e-01
[5,] 0.7175848 5.648304e-01 2.824152e-01
[6,] 0.6452346 7.095307e-01 3.547654e-01
[7,] 0.5574994 8.850011e-01 4.425006e-01
[8,] 0.5138845 9.722310e-01 4.861155e-01
[9,] 0.4213358 8.426717e-01 5.786642e-01
[10,] 0.3390843 6.781686e-01 6.609157e-01
[11,] 0.6422757 7.154485e-01 3.577243e-01
[12,] 0.6754088 6.491824e-01 3.245912e-01
[13,] 0.6059898 7.880203e-01 3.940102e-01
[14,] 0.5380990 9.238021e-01 4.619010e-01
[15,] 0.4749490 9.498981e-01 5.250510e-01
[16,] 0.4327400 8.654800e-01 5.672600e-01
[17,] 0.9132448 1.735103e-01 8.675517e-02
[18,] 0.8887512 2.224977e-01 1.112488e-01
[19,] 0.8652380 2.695240e-01 1.347620e-01
[20,] 0.9650908 6.981837e-02 3.490919e-02
[21,] 0.9768024 4.639522e-02 2.319761e-02
[22,] 0.9721504 5.569927e-02 2.784963e-02
[23,] 0.9715199 5.696024e-02 2.848012e-02
[24,] 0.9619177 7.616460e-02 3.808230e-02
[25,] 0.9581978 8.360449e-02 4.180225e-02
[26,] 0.9546412 9.071770e-02 4.535885e-02
[27,] 0.9400193 1.199614e-01 5.998070e-02
[28,] 0.9719081 5.618389e-02 2.809194e-02
[29,] 0.9648703 7.025932e-02 3.512966e-02
[30,] 0.9724772 5.504553e-02 2.752277e-02
[31,] 0.9629321 7.413581e-02 3.706790e-02
[32,] 0.9796386 4.072270e-02 2.036135e-02
[33,] 0.9724522 5.509554e-02 2.754777e-02
[34,] 0.9641975 7.160508e-02 3.580254e-02
[35,] 0.9537264 9.254719e-02 4.627360e-02
[36,] 0.9404701 1.190597e-01 5.952986e-02
[37,] 0.9240944 1.518112e-01 7.590560e-02
[38,] 0.9050423 1.899154e-01 9.495768e-02
[39,] 0.9127275 1.745451e-01 8.727254e-02
[40,] 0.9860616 2.787675e-02 1.393838e-02
[41,] 0.9844337 3.113261e-02 1.556630e-02
[42,] 0.9851938 2.961244e-02 1.480622e-02
[43,] 0.9806175 3.876492e-02 1.938246e-02
[44,] 0.9884644 2.307120e-02 1.153560e-02
[45,] 0.9890615 2.187710e-02 1.093855e-02
[46,] 0.9860297 2.794060e-02 1.397030e-02
[47,] 0.9849272 3.014555e-02 1.507278e-02
[48,] 0.9981423 3.715350e-03 1.857675e-03
[49,] 0.9977352 4.529595e-03 2.264798e-03
[50,] 0.9968617 6.276559e-03 3.138280e-03
[51,] 0.9957197 8.560529e-03 4.280265e-03
[52,] 0.9946820 1.063597e-02 5.317987e-03
[53,] 0.9959362 8.127611e-03 4.063806e-03
[54,] 0.9967844 6.431230e-03 3.215615e-03
[55,] 0.9955682 8.863665e-03 4.431832e-03
[56,] 0.9938611 1.227781e-02 6.138905e-03
[57,] 0.9916127 1.677458e-02 8.387292e-03
[58,] 0.9920203 1.595945e-02 7.979723e-03
[59,] 0.9894087 2.118258e-02 1.059129e-02
[60,] 0.9914630 1.707393e-02 8.536964e-03
[61,] 0.9887254 2.254927e-02 1.127463e-02
[62,] 0.9860856 2.782888e-02 1.391444e-02
[63,] 0.9943039 1.139220e-02 5.696102e-03
[64,] 0.9922022 1.559567e-02 7.797834e-03
[65,] 0.9908381 1.832386e-02 9.161931e-03
[66,] 0.9912225 1.755497e-02 8.777484e-03
[67,] 0.9904784 1.904320e-02 9.521601e-03
[68,] 0.9885529 2.289412e-02 1.144706e-02
[69,] 0.9863089 2.738219e-02 1.369109e-02
[70,] 0.9830938 3.381247e-02 1.690623e-02
[71,] 0.9920428 1.591436e-02 7.957178e-03
[72,] 0.9968804 6.239215e-03 3.119608e-03
[73,] 0.9956255 8.748985e-03 4.374492e-03
[74,] 0.9943357 1.132857e-02 5.664286e-03
[75,] 0.9922403 1.551944e-02 7.759720e-03
[76,] 0.9911619 1.767618e-02 8.838091e-03
[77,] 0.9930868 1.382648e-02 6.913239e-03
[78,] 0.9907300 1.854010e-02 9.270048e-03
[79,] 0.9874890 2.502207e-02 1.251103e-02
[80,] 0.9832954 3.340918e-02 1.670459e-02
[81,] 0.9879919 2.401624e-02 1.200812e-02
[82,] 0.9840297 3.194059e-02 1.597029e-02
[83,] 0.9793247 4.135065e-02 2.067532e-02
[84,] 0.9755115 4.897694e-02 2.448847e-02
[85,] 0.9984955 3.008902e-03 1.504451e-03
[86,] 0.9978656 4.268807e-03 2.134404e-03
[87,] 0.9969973 6.005315e-03 3.002657e-03
[88,] 0.9960309 7.938272e-03 3.969136e-03
[89,] 0.9964266 7.146887e-03 3.573444e-03
[90,] 0.9971428 5.714374e-03 2.857187e-03
[91,] 0.9962244 7.551105e-03 3.775552e-03
[92,] 0.9958487 8.302633e-03 4.151316e-03
[93,] 0.9976810 4.637959e-03 2.318980e-03
[94,] 0.9982015 3.597051e-03 1.798525e-03
[95,] 0.9983298 3.340316e-03 1.670158e-03
[96,] 0.9977602 4.479685e-03 2.239842e-03
[97,] 0.9973348 5.330368e-03 2.665184e-03
[98,] 0.9961579 7.684141e-03 3.842071e-03
[99,] 0.9964278 7.144480e-03 3.572240e-03
[100,] 0.9950364 9.927254e-03 4.963627e-03
[101,] 0.9929960 1.400797e-02 7.003987e-03
[102,] 0.9901934 1.961330e-02 9.806649e-03
[103,] 0.9869990 2.600200e-02 1.300100e-02
[104,] 0.9822360 3.552807e-02 1.776404e-02
[105,] 0.9849347 3.013051e-02 1.506526e-02
[106,] 0.9943175 1.136509e-02 5.682543e-03
[107,] 0.9919547 1.609065e-02 8.045323e-03
[108,] 0.9890648 2.187036e-02 1.093518e-02
[109,] 0.9854610 2.907796e-02 1.453898e-02
[110,] 0.9802808 3.943830e-02 1.971915e-02
[111,] 0.9816043 3.679134e-02 1.839567e-02
[112,] 0.9969775 6.045034e-03 3.022517e-03
[113,] 0.9956449 8.710217e-03 4.355109e-03
[114,] 0.9958541 8.291789e-03 4.145895e-03
[115,] 0.9944778 1.104447e-02 5.522235e-03
[116,] 0.9934855 1.302908e-02 6.514539e-03
[117,] 0.9905445 1.891091e-02 9.455456e-03
[118,] 0.9890622 2.187551e-02 1.093775e-02
[119,] 0.9896546 2.069086e-02 1.034543e-02
[120,] 0.9874626 2.507483e-02 1.253741e-02
[121,] 0.9842675 3.146504e-02 1.573252e-02
[122,] 0.9821398 3.572041e-02 1.786021e-02
[123,] 0.9807114 3.857719e-02 1.928860e-02
[124,] 0.9780788 4.384241e-02 2.192120e-02
[125,] 0.9833459 3.330826e-02 1.665413e-02
[126,] 0.9922974 1.540521e-02 7.702606e-03
[127,] 0.9983747 3.250612e-03 1.625306e-03
[128,] 0.9977254 4.549298e-03 2.274649e-03
[129,] 0.9966164 6.767164e-03 3.383582e-03
[130,] 0.9944683 1.106342e-02 5.531711e-03
[131,] 0.9932955 1.340909e-02 6.704547e-03
[132,] 0.9897384 2.052318e-02 1.026159e-02
[133,] 0.9918350 1.633009e-02 8.165044e-03
[134,] 0.9987443 2.511403e-03 1.255701e-03
[135,] 0.9981243 3.751337e-03 1.875669e-03
[136,] 0.9969134 6.173269e-03 3.086635e-03
[137,] 0.9967384 6.523105e-03 3.261553e-03
[138,] 0.9971483 5.703321e-03 2.851660e-03
[139,] 0.9995500 8.999222e-04 4.499611e-04
[140,] 0.9994133 1.173417e-03 5.867083e-04
[141,] 0.9999956 8.801243e-06 4.400621e-06
[142,] 1.0000000 7.092740e-09 3.546370e-09
[143,] 1.0000000 2.005258e-10 1.002629e-10
[144,] 1.0000000 1.510833e-09 7.554165e-10
[145,] 1.0000000 4.401366e-09 2.200683e-09
[146,] 1.0000000 3.678122e-08 1.839061e-08
[147,] 0.9999999 2.906440e-07 1.453220e-07
[148,] 0.9999990 2.056096e-06 1.028048e-06
[149,] 0.9999933 1.347515e-05 6.737577e-06
[150,] 0.9999520 9.604315e-05 4.802157e-05
[151,] 0.9998952 2.095393e-04 1.047697e-04
[152,] 0.9992023 1.595479e-03 7.977393e-04
[153,] 0.9944659 1.106823e-02 5.534113e-03
> postscript(file="/var/wessaorg/rcomp/tmp/1qrk21321984029.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/2u1f51321984029.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/3vy5h1321984029.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/4og6t1321984029.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/5xx131321984029.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
39524.6444 6057.0009 -3073.3206 -42194.4239 11533.2716 -8329.9599
7 8 9 10 11 12
63277.1326 -17880.5559 -18367.4365 8510.1065 18439.0582 -13416.9672
13 14 15 16 17 18
-20522.3623 3617.8693 3030.0411 -60100.6309 37138.7253 7992.4063
19 20 21 22 23 24
16646.5498 -15093.8897 12476.4271 98402.8880 6554.8056 -23752.6052
25 26 27 28 29 30
-66532.3657 -44170.6726 -14977.4669 28406.7953 -5012.8380 22135.0750
31 32 33 34 35 36
23467.6270 -8930.7528 52837.2352 -13612.8441 42782.9314 4994.3444
37 38 39 40 41 42
53985.0165 4233.2830 15582.6557 11952.9890 5343.8564 -2977.6547
43 44 45 46 47 48
8426.8798 -30355.0729 -78200.6599 -22738.0056 -30945.1460 -9905.5357
49 50 51 52 53 54
-50628.8748 -32718.7992 15821.7515 -19726.9913 78232.0481 -19055.2957
55 56 57 58 59 60
-8585.1203 9906.3468 -17907.4412 -38998.5309 37417.6575 7737.7673
61 62 63 64 65 66
1781.6474 -2594.2922 -31082.2657 8448.2755 37654.2453 9320.0787
67 68 69 70 71 72
-14731.1903 -56032.5589 -2603.8971 -19166.2709 -30351.5375 -23935.4436
73 74 75 76 77 78
-17524.0341 17977.0357 -14349.7466 53280.0654 55582.4083 -305.0095
79 80 81 82 83 84
-13128.0386 -2776.7028 -20504.2753 38273.2080 6804.8509 1509.3271
85 86 87 88 89 90
144.3672 -40205.3865 -4538.9195 -5557.0058 17123.9307 -83212.0904
91 92 93 94 95 96
7209.9082 7024.3560 -10785.0124 -26423.9120 35854.4921 12713.3326
97 98 99 100 101 102
23135.8226 44458.1029 -32292.3157 33792.7865 12334.5395 20593.3593
103 104 105 106 107 108
-1965.3496 -30275.4536 -5764.0533 3619.1065 1149.1094 11179.6375
109 110 111 112 113 114
-1585.7932 -33012.6323 51907.8726 -5213.7794 -8021.3750 -10060.1556
115 116 117 118 119 120
5403.3129 -30104.1586 64833.2722 -8185.9990 26728.4863 -14096.3259
121 122 123 124 125 126
-19218.2296 3506.7424 -20256.3739 -26850.0090 -17273.7571 -14328.3366
127 128 129 130 131 132
22171.0879 21668.5188 20577.7563 30034.2020 36594.8261 43097.3716
133 134 135 136 137 138
-22725.1608 6082.7103 -3793.8440 -25431.1840 1262.9669 -34271.3536
139 140 141 142 143 144
39238.6794 -21545.7985 4551.2651 -14622.4836 14953.4971 -23218.8477
145 146 147 148 149 150
15469.1490 -66464.5337 -25080.9373 17059.2799 3207.6132 539.9137
151 152 153 154 155 156
2886.3934 2991.8616 3207.6132 3207.6132 4253.7747 7837.3182
157 158 159 160 161 162
3207.6132 3075.2374 -2253.8246 3205.5756 7548.6148 -14167.3822
163 164
1745.1384 1114.8004
> postscript(file="/var/wessaorg/rcomp/tmp/6oomk1321984029.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 39524.6444 NA
1 6057.0009 39524.6444
2 -3073.3206 6057.0009
3 -42194.4239 -3073.3206
4 11533.2716 -42194.4239
5 -8329.9599 11533.2716
6 63277.1326 -8329.9599
7 -17880.5559 63277.1326
8 -18367.4365 -17880.5559
9 8510.1065 -18367.4365
10 18439.0582 8510.1065
11 -13416.9672 18439.0582
12 -20522.3623 -13416.9672
13 3617.8693 -20522.3623
14 3030.0411 3617.8693
15 -60100.6309 3030.0411
16 37138.7253 -60100.6309
17 7992.4063 37138.7253
18 16646.5498 7992.4063
19 -15093.8897 16646.5498
20 12476.4271 -15093.8897
21 98402.8880 12476.4271
22 6554.8056 98402.8880
23 -23752.6052 6554.8056
24 -66532.3657 -23752.6052
25 -44170.6726 -66532.3657
26 -14977.4669 -44170.6726
27 28406.7953 -14977.4669
28 -5012.8380 28406.7953
29 22135.0750 -5012.8380
30 23467.6270 22135.0750
31 -8930.7528 23467.6270
32 52837.2352 -8930.7528
33 -13612.8441 52837.2352
34 42782.9314 -13612.8441
35 4994.3444 42782.9314
36 53985.0165 4994.3444
37 4233.2830 53985.0165
38 15582.6557 4233.2830
39 11952.9890 15582.6557
40 5343.8564 11952.9890
41 -2977.6547 5343.8564
42 8426.8798 -2977.6547
43 -30355.0729 8426.8798
44 -78200.6599 -30355.0729
45 -22738.0056 -78200.6599
46 -30945.1460 -22738.0056
47 -9905.5357 -30945.1460
48 -50628.8748 -9905.5357
49 -32718.7992 -50628.8748
50 15821.7515 -32718.7992
51 -19726.9913 15821.7515
52 78232.0481 -19726.9913
53 -19055.2957 78232.0481
54 -8585.1203 -19055.2957
55 9906.3468 -8585.1203
56 -17907.4412 9906.3468
57 -38998.5309 -17907.4412
58 37417.6575 -38998.5309
59 7737.7673 37417.6575
60 1781.6474 7737.7673
61 -2594.2922 1781.6474
62 -31082.2657 -2594.2922
63 8448.2755 -31082.2657
64 37654.2453 8448.2755
65 9320.0787 37654.2453
66 -14731.1903 9320.0787
67 -56032.5589 -14731.1903
68 -2603.8971 -56032.5589
69 -19166.2709 -2603.8971
70 -30351.5375 -19166.2709
71 -23935.4436 -30351.5375
72 -17524.0341 -23935.4436
73 17977.0357 -17524.0341
74 -14349.7466 17977.0357
75 53280.0654 -14349.7466
76 55582.4083 53280.0654
77 -305.0095 55582.4083
78 -13128.0386 -305.0095
79 -2776.7028 -13128.0386
80 -20504.2753 -2776.7028
81 38273.2080 -20504.2753
82 6804.8509 38273.2080
83 1509.3271 6804.8509
84 144.3672 1509.3271
85 -40205.3865 144.3672
86 -4538.9195 -40205.3865
87 -5557.0058 -4538.9195
88 17123.9307 -5557.0058
89 -83212.0904 17123.9307
90 7209.9082 -83212.0904
91 7024.3560 7209.9082
92 -10785.0124 7024.3560
93 -26423.9120 -10785.0124
94 35854.4921 -26423.9120
95 12713.3326 35854.4921
96 23135.8226 12713.3326
97 44458.1029 23135.8226
98 -32292.3157 44458.1029
99 33792.7865 -32292.3157
100 12334.5395 33792.7865
101 20593.3593 12334.5395
102 -1965.3496 20593.3593
103 -30275.4536 -1965.3496
104 -5764.0533 -30275.4536
105 3619.1065 -5764.0533
106 1149.1094 3619.1065
107 11179.6375 1149.1094
108 -1585.7932 11179.6375
109 -33012.6323 -1585.7932
110 51907.8726 -33012.6323
111 -5213.7794 51907.8726
112 -8021.3750 -5213.7794
113 -10060.1556 -8021.3750
114 5403.3129 -10060.1556
115 -30104.1586 5403.3129
116 64833.2722 -30104.1586
117 -8185.9990 64833.2722
118 26728.4863 -8185.9990
119 -14096.3259 26728.4863
120 -19218.2296 -14096.3259
121 3506.7424 -19218.2296
122 -20256.3739 3506.7424
123 -26850.0090 -20256.3739
124 -17273.7571 -26850.0090
125 -14328.3366 -17273.7571
126 22171.0879 -14328.3366
127 21668.5188 22171.0879
128 20577.7563 21668.5188
129 30034.2020 20577.7563
130 36594.8261 30034.2020
131 43097.3716 36594.8261
132 -22725.1608 43097.3716
133 6082.7103 -22725.1608
134 -3793.8440 6082.7103
135 -25431.1840 -3793.8440
136 1262.9669 -25431.1840
137 -34271.3536 1262.9669
138 39238.6794 -34271.3536
139 -21545.7985 39238.6794
140 4551.2651 -21545.7985
141 -14622.4836 4551.2651
142 14953.4971 -14622.4836
143 -23218.8477 14953.4971
144 15469.1490 -23218.8477
145 -66464.5337 15469.1490
146 -25080.9373 -66464.5337
147 17059.2799 -25080.9373
148 3207.6132 17059.2799
149 539.9137 3207.6132
150 2886.3934 539.9137
151 2991.8616 2886.3934
152 3207.6132 2991.8616
153 3207.6132 3207.6132
154 4253.7747 3207.6132
155 7837.3182 4253.7747
156 3207.6132 7837.3182
157 3075.2374 3207.6132
158 -2253.8246 3075.2374
159 3205.5756 -2253.8246
160 7548.6148 3205.5756
161 -14167.3822 7548.6148
162 1745.1384 -14167.3822
163 1114.8004 1745.1384
164 NA 1114.8004
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 6057.0009 39524.6444
[2,] -3073.3206 6057.0009
[3,] -42194.4239 -3073.3206
[4,] 11533.2716 -42194.4239
[5,] -8329.9599 11533.2716
[6,] 63277.1326 -8329.9599
[7,] -17880.5559 63277.1326
[8,] -18367.4365 -17880.5559
[9,] 8510.1065 -18367.4365
[10,] 18439.0582 8510.1065
[11,] -13416.9672 18439.0582
[12,] -20522.3623 -13416.9672
[13,] 3617.8693 -20522.3623
[14,] 3030.0411 3617.8693
[15,] -60100.6309 3030.0411
[16,] 37138.7253 -60100.6309
[17,] 7992.4063 37138.7253
[18,] 16646.5498 7992.4063
[19,] -15093.8897 16646.5498
[20,] 12476.4271 -15093.8897
[21,] 98402.8880 12476.4271
[22,] 6554.8056 98402.8880
[23,] -23752.6052 6554.8056
[24,] -66532.3657 -23752.6052
[25,] -44170.6726 -66532.3657
[26,] -14977.4669 -44170.6726
[27,] 28406.7953 -14977.4669
[28,] -5012.8380 28406.7953
[29,] 22135.0750 -5012.8380
[30,] 23467.6270 22135.0750
[31,] -8930.7528 23467.6270
[32,] 52837.2352 -8930.7528
[33,] -13612.8441 52837.2352
[34,] 42782.9314 -13612.8441
[35,] 4994.3444 42782.9314
[36,] 53985.0165 4994.3444
[37,] 4233.2830 53985.0165
[38,] 15582.6557 4233.2830
[39,] 11952.9890 15582.6557
[40,] 5343.8564 11952.9890
[41,] -2977.6547 5343.8564
[42,] 8426.8798 -2977.6547
[43,] -30355.0729 8426.8798
[44,] -78200.6599 -30355.0729
[45,] -22738.0056 -78200.6599
[46,] -30945.1460 -22738.0056
[47,] -9905.5357 -30945.1460
[48,] -50628.8748 -9905.5357
[49,] -32718.7992 -50628.8748
[50,] 15821.7515 -32718.7992
[51,] -19726.9913 15821.7515
[52,] 78232.0481 -19726.9913
[53,] -19055.2957 78232.0481
[54,] -8585.1203 -19055.2957
[55,] 9906.3468 -8585.1203
[56,] -17907.4412 9906.3468
[57,] -38998.5309 -17907.4412
[58,] 37417.6575 -38998.5309
[59,] 7737.7673 37417.6575
[60,] 1781.6474 7737.7673
[61,] -2594.2922 1781.6474
[62,] -31082.2657 -2594.2922
[63,] 8448.2755 -31082.2657
[64,] 37654.2453 8448.2755
[65,] 9320.0787 37654.2453
[66,] -14731.1903 9320.0787
[67,] -56032.5589 -14731.1903
[68,] -2603.8971 -56032.5589
[69,] -19166.2709 -2603.8971
[70,] -30351.5375 -19166.2709
[71,] -23935.4436 -30351.5375
[72,] -17524.0341 -23935.4436
[73,] 17977.0357 -17524.0341
[74,] -14349.7466 17977.0357
[75,] 53280.0654 -14349.7466
[76,] 55582.4083 53280.0654
[77,] -305.0095 55582.4083
[78,] -13128.0386 -305.0095
[79,] -2776.7028 -13128.0386
[80,] -20504.2753 -2776.7028
[81,] 38273.2080 -20504.2753
[82,] 6804.8509 38273.2080
[83,] 1509.3271 6804.8509
[84,] 144.3672 1509.3271
[85,] -40205.3865 144.3672
[86,] -4538.9195 -40205.3865
[87,] -5557.0058 -4538.9195
[88,] 17123.9307 -5557.0058
[89,] -83212.0904 17123.9307
[90,] 7209.9082 -83212.0904
[91,] 7024.3560 7209.9082
[92,] -10785.0124 7024.3560
[93,] -26423.9120 -10785.0124
[94,] 35854.4921 -26423.9120
[95,] 12713.3326 35854.4921
[96,] 23135.8226 12713.3326
[97,] 44458.1029 23135.8226
[98,] -32292.3157 44458.1029
[99,] 33792.7865 -32292.3157
[100,] 12334.5395 33792.7865
[101,] 20593.3593 12334.5395
[102,] -1965.3496 20593.3593
[103,] -30275.4536 -1965.3496
[104,] -5764.0533 -30275.4536
[105,] 3619.1065 -5764.0533
[106,] 1149.1094 3619.1065
[107,] 11179.6375 1149.1094
[108,] -1585.7932 11179.6375
[109,] -33012.6323 -1585.7932
[110,] 51907.8726 -33012.6323
[111,] -5213.7794 51907.8726
[112,] -8021.3750 -5213.7794
[113,] -10060.1556 -8021.3750
[114,] 5403.3129 -10060.1556
[115,] -30104.1586 5403.3129
[116,] 64833.2722 -30104.1586
[117,] -8185.9990 64833.2722
[118,] 26728.4863 -8185.9990
[119,] -14096.3259 26728.4863
[120,] -19218.2296 -14096.3259
[121,] 3506.7424 -19218.2296
[122,] -20256.3739 3506.7424
[123,] -26850.0090 -20256.3739
[124,] -17273.7571 -26850.0090
[125,] -14328.3366 -17273.7571
[126,] 22171.0879 -14328.3366
[127,] 21668.5188 22171.0879
[128,] 20577.7563 21668.5188
[129,] 30034.2020 20577.7563
[130,] 36594.8261 30034.2020
[131,] 43097.3716 36594.8261
[132,] -22725.1608 43097.3716
[133,] 6082.7103 -22725.1608
[134,] -3793.8440 6082.7103
[135,] -25431.1840 -3793.8440
[136,] 1262.9669 -25431.1840
[137,] -34271.3536 1262.9669
[138,] 39238.6794 -34271.3536
[139,] -21545.7985 39238.6794
[140,] 4551.2651 -21545.7985
[141,] -14622.4836 4551.2651
[142,] 14953.4971 -14622.4836
[143,] -23218.8477 14953.4971
[144,] 15469.1490 -23218.8477
[145,] -66464.5337 15469.1490
[146,] -25080.9373 -66464.5337
[147,] 17059.2799 -25080.9373
[148,] 3207.6132 17059.2799
[149,] 539.9137 3207.6132
[150,] 2886.3934 539.9137
[151,] 2991.8616 2886.3934
[152,] 3207.6132 2991.8616
[153,] 3207.6132 3207.6132
[154,] 4253.7747 3207.6132
[155,] 7837.3182 4253.7747
[156,] 3207.6132 7837.3182
[157,] 3075.2374 3207.6132
[158,] -2253.8246 3075.2374
[159,] 3205.5756 -2253.8246
[160,] 7548.6148 3205.5756
[161,] -14167.3822 7548.6148
[162,] 1745.1384 -14167.3822
[163,] 1114.8004 1745.1384
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 6057.0009 39524.6444
2 -3073.3206 6057.0009
3 -42194.4239 -3073.3206
4 11533.2716 -42194.4239
5 -8329.9599 11533.2716
6 63277.1326 -8329.9599
7 -17880.5559 63277.1326
8 -18367.4365 -17880.5559
9 8510.1065 -18367.4365
10 18439.0582 8510.1065
11 -13416.9672 18439.0582
12 -20522.3623 -13416.9672
13 3617.8693 -20522.3623
14 3030.0411 3617.8693
15 -60100.6309 3030.0411
16 37138.7253 -60100.6309
17 7992.4063 37138.7253
18 16646.5498 7992.4063
19 -15093.8897 16646.5498
20 12476.4271 -15093.8897
21 98402.8880 12476.4271
22 6554.8056 98402.8880
23 -23752.6052 6554.8056
24 -66532.3657 -23752.6052
25 -44170.6726 -66532.3657
26 -14977.4669 -44170.6726
27 28406.7953 -14977.4669
28 -5012.8380 28406.7953
29 22135.0750 -5012.8380
30 23467.6270 22135.0750
31 -8930.7528 23467.6270
32 52837.2352 -8930.7528
33 -13612.8441 52837.2352
34 42782.9314 -13612.8441
35 4994.3444 42782.9314
36 53985.0165 4994.3444
37 4233.2830 53985.0165
38 15582.6557 4233.2830
39 11952.9890 15582.6557
40 5343.8564 11952.9890
41 -2977.6547 5343.8564
42 8426.8798 -2977.6547
43 -30355.0729 8426.8798
44 -78200.6599 -30355.0729
45 -22738.0056 -78200.6599
46 -30945.1460 -22738.0056
47 -9905.5357 -30945.1460
48 -50628.8748 -9905.5357
49 -32718.7992 -50628.8748
50 15821.7515 -32718.7992
51 -19726.9913 15821.7515
52 78232.0481 -19726.9913
53 -19055.2957 78232.0481
54 -8585.1203 -19055.2957
55 9906.3468 -8585.1203
56 -17907.4412 9906.3468
57 -38998.5309 -17907.4412
58 37417.6575 -38998.5309
59 7737.7673 37417.6575
60 1781.6474 7737.7673
61 -2594.2922 1781.6474
62 -31082.2657 -2594.2922
63 8448.2755 -31082.2657
64 37654.2453 8448.2755
65 9320.0787 37654.2453
66 -14731.1903 9320.0787
67 -56032.5589 -14731.1903
68 -2603.8971 -56032.5589
69 -19166.2709 -2603.8971
70 -30351.5375 -19166.2709
71 -23935.4436 -30351.5375
72 -17524.0341 -23935.4436
73 17977.0357 -17524.0341
74 -14349.7466 17977.0357
75 53280.0654 -14349.7466
76 55582.4083 53280.0654
77 -305.0095 55582.4083
78 -13128.0386 -305.0095
79 -2776.7028 -13128.0386
80 -20504.2753 -2776.7028
81 38273.2080 -20504.2753
82 6804.8509 38273.2080
83 1509.3271 6804.8509
84 144.3672 1509.3271
85 -40205.3865 144.3672
86 -4538.9195 -40205.3865
87 -5557.0058 -4538.9195
88 17123.9307 -5557.0058
89 -83212.0904 17123.9307
90 7209.9082 -83212.0904
91 7024.3560 7209.9082
92 -10785.0124 7024.3560
93 -26423.9120 -10785.0124
94 35854.4921 -26423.9120
95 12713.3326 35854.4921
96 23135.8226 12713.3326
97 44458.1029 23135.8226
98 -32292.3157 44458.1029
99 33792.7865 -32292.3157
100 12334.5395 33792.7865
101 20593.3593 12334.5395
102 -1965.3496 20593.3593
103 -30275.4536 -1965.3496
104 -5764.0533 -30275.4536
105 3619.1065 -5764.0533
106 1149.1094 3619.1065
107 11179.6375 1149.1094
108 -1585.7932 11179.6375
109 -33012.6323 -1585.7932
110 51907.8726 -33012.6323
111 -5213.7794 51907.8726
112 -8021.3750 -5213.7794
113 -10060.1556 -8021.3750
114 5403.3129 -10060.1556
115 -30104.1586 5403.3129
116 64833.2722 -30104.1586
117 -8185.9990 64833.2722
118 26728.4863 -8185.9990
119 -14096.3259 26728.4863
120 -19218.2296 -14096.3259
121 3506.7424 -19218.2296
122 -20256.3739 3506.7424
123 -26850.0090 -20256.3739
124 -17273.7571 -26850.0090
125 -14328.3366 -17273.7571
126 22171.0879 -14328.3366
127 21668.5188 22171.0879
128 20577.7563 21668.5188
129 30034.2020 20577.7563
130 36594.8261 30034.2020
131 43097.3716 36594.8261
132 -22725.1608 43097.3716
133 6082.7103 -22725.1608
134 -3793.8440 6082.7103
135 -25431.1840 -3793.8440
136 1262.9669 -25431.1840
137 -34271.3536 1262.9669
138 39238.6794 -34271.3536
139 -21545.7985 39238.6794
140 4551.2651 -21545.7985
141 -14622.4836 4551.2651
142 14953.4971 -14622.4836
143 -23218.8477 14953.4971
144 15469.1490 -23218.8477
145 -66464.5337 15469.1490
146 -25080.9373 -66464.5337
147 17059.2799 -25080.9373
148 3207.6132 17059.2799
149 539.9137 3207.6132
150 2886.3934 539.9137
151 2991.8616 2886.3934
152 3207.6132 2991.8616
153 3207.6132 3207.6132
154 4253.7747 3207.6132
155 7837.3182 4253.7747
156 3207.6132 7837.3182
157 3075.2374 3207.6132
158 -2253.8246 3075.2374
159 3205.5756 -2253.8246
160 7548.6148 3205.5756
161 -14167.3822 7548.6148
162 1745.1384 -14167.3822
163 1114.8004 1745.1384
> 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/7vbf51321984029.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/8pecf1321984029.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/95xhz1321984029.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/10yx5t1321984029.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/11wabk1321984029.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/12rhdp1321984029.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/13ffs41321984029.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/143epz1321984029.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/15q45g1321984029.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/16jhvo1321984029.tab")
+ }
>
> try(system("convert tmp/1qrk21321984029.ps tmp/1qrk21321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/2u1f51321984029.ps tmp/2u1f51321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/3vy5h1321984029.ps tmp/3vy5h1321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/4og6t1321984029.ps tmp/4og6t1321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/5xx131321984029.ps tmp/5xx131321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/6oomk1321984029.ps tmp/6oomk1321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/7vbf51321984029.ps tmp/7vbf51321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/8pecf1321984029.ps tmp/8pecf1321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/95xhz1321984029.ps tmp/95xhz1321984029.png",intern=TRUE))
character(0)
> try(system("convert tmp/10yx5t1321984029.ps tmp/10yx5t1321984029.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.653 0.519 5.223