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(95556
+ ,114468
+ ,128
+ ,54565
+ ,88594
+ ,89
+ ,63016
+ ,74151
+ ,68
+ ,79774
+ ,77921
+ ,108
+ ,31258
+ ,53212
+ ,51
+ ,52491
+ ,34956
+ ,33
+ ,91256
+ ,149703
+ ,119
+ ,22807
+ ,6853
+ ,5
+ ,77411
+ ,58907
+ ,63
+ ,48821
+ ,67067
+ ,66
+ ,52295
+ ,110563
+ ,98
+ ,63262
+ ,58126
+ ,71
+ ,50466
+ ,57113
+ ,55
+ ,62932
+ ,77993
+ ,116
+ ,38439
+ ,68091
+ ,71
+ ,70817
+ ,124676
+ ,120
+ ,105965
+ ,109522
+ ,122
+ ,73795
+ ,75865
+ ,74
+ ,82043
+ ,79746
+ ,111
+ ,74349
+ ,77844
+ ,103
+ ,82204
+ ,98681
+ ,98
+ ,55709
+ ,105531
+ ,100
+ ,37137
+ ,51428
+ ,42
+ ,70780
+ ,65703
+ ,100
+ ,55027
+ ,72562
+ ,105
+ ,56699
+ ,81728
+ ,77
+ ,65911
+ ,95580
+ ,83
+ ,56316
+ ,98278
+ ,98
+ ,26982
+ ,46629
+ ,46
+ ,54628
+ ,115189
+ ,95
+ ,96750
+ ,124865
+ ,91
+ ,53009
+ ,59392
+ ,91
+ ,64664
+ ,127818
+ ,94
+ ,36990
+ ,17821
+ ,15
+ ,85224
+ ,154076
+ ,137
+ ,37048
+ ,64881
+ ,56
+ ,59635
+ ,136506
+ ,78
+ ,42051
+ ,66524
+ ,68
+ ,26998
+ ,45988
+ ,34
+ ,63717
+ ,107445
+ ,94
+ ,55071
+ ,102772
+ ,82
+ ,40001
+ ,46657
+ ,63
+ ,54506
+ ,97563
+ ,58
+ ,35838
+ ,36663
+ ,43
+ ,50838
+ ,55369
+ ,36
+ ,86997
+ ,77921
+ ,64
+ ,33032
+ ,56968
+ ,21
+ ,61704
+ ,77519
+ ,104
+ ,117986
+ ,129805
+ ,124
+ ,56733
+ ,72761
+ ,101
+ ,55064
+ ,81278
+ ,85
+ ,5950
+ ,15049
+ ,7
+ ,84607
+ ,113935
+ ,124
+ ,32551
+ ,25109
+ ,21
+ ,31701
+ ,45824
+ ,35
+ ,71170
+ ,89644
+ ,95
+ ,101773
+ ,109011
+ ,102
+ ,101653
+ ,134245
+ ,212
+ ,81493
+ ,136692
+ ,141
+ ,55901
+ ,50741
+ ,54
+ ,109104
+ ,149510
+ ,117
+ ,114425
+ ,147888
+ ,145
+ ,36311
+ ,54987
+ ,50
+ ,70027
+ ,74467
+ ,80
+ ,73713
+ ,100033
+ ,87
+ ,40671
+ ,85505
+ ,78
+ ,89041
+ ,62426
+ ,86
+ ,57231
+ ,82932
+ ,82
+ ,68608
+ ,72002
+ ,119
+ ,59155
+ ,65469
+ ,75
+ ,55827
+ ,63572
+ ,70
+ ,22618
+ ,23824
+ ,25
+ ,58425
+ ,73831
+ ,66
+ ,65724
+ ,63551
+ ,89
+ ,56979
+ ,56756
+ ,99
+ ,72369
+ ,81399
+ ,98
+ ,79194
+ ,117881
+ ,104
+ ,202316
+ ,70711
+ ,48
+ ,44970
+ ,50495
+ ,81
+ ,49319
+ ,53845
+ ,64
+ ,36252
+ ,51390
+ ,44
+ ,75741
+ ,104953
+ ,104
+ ,38417
+ ,65983
+ ,36
+ ,64102
+ ,76839
+ ,120
+ ,56622
+ ,55792
+ ,58
+ ,15430
+ ,25155
+ ,27
+ ,72571
+ ,55291
+ ,84
+ ,67271
+ ,84279
+ ,56
+ ,43460
+ ,99692
+ ,46
+ ,99501
+ ,59633
+ ,119
+ ,28340
+ ,63249
+ ,57
+ ,76013
+ ,82928
+ ,139
+ ,37361
+ ,50000
+ ,51
+ ,48204
+ ,69455
+ ,85
+ ,76168
+ ,84068
+ ,91
+ ,85168
+ ,76195
+ ,79
+ ,125410
+ ,114634
+ ,142
+ ,123328
+ ,139357
+ ,149
+ ,83038
+ ,110044
+ ,96
+ ,120087
+ ,155118
+ ,198
+ ,91939
+ ,83061
+ ,61
+ ,103646
+ ,127122
+ ,145
+ ,29467
+ ,45653
+ ,26
+ ,43750
+ ,19630
+ ,49
+ ,34497
+ ,67229
+ ,68
+ ,66477
+ ,86060
+ ,145
+ ,71181
+ ,88003
+ ,82
+ ,74482
+ ,95815
+ ,102
+ ,174949
+ ,85499
+ ,52
+ ,46765
+ ,27220
+ ,56
+ ,90257
+ ,109882
+ ,80
+ ,51370
+ ,72579
+ ,99
+ ,1168
+ ,5841
+ ,11
+ ,51360
+ ,68369
+ ,87
+ ,25162
+ ,24610
+ ,28
+ ,21067
+ ,30995
+ ,67
+ ,58233
+ ,150662
+ ,150
+ ,855
+ ,6622
+ ,4
+ ,85903
+ ,93694
+ ,71
+ ,14116
+ ,13155
+ ,39
+ ,57637
+ ,111908
+ ,87
+ ,94137
+ ,57550
+ ,66
+ ,62147
+ ,16356
+ ,23
+ ,62832
+ ,40174
+ ,56
+ ,8773
+ ,13983
+ ,16
+ ,63785
+ ,52316
+ ,49
+ ,65196
+ ,99585
+ ,108
+ ,73087
+ ,86271
+ ,112
+ ,72631
+ ,131012
+ ,110
+ ,86281
+ ,130274
+ ,126
+ ,162365
+ ,159051
+ ,155
+ ,56530
+ ,76506
+ ,75
+ ,35606
+ ,49145
+ ,30
+ ,70111
+ ,66398
+ ,78
+ ,92046
+ ,127546
+ ,135
+ ,63989
+ ,6802
+ ,8
+ ,104911
+ ,99509
+ ,114
+ ,43448
+ ,43106
+ ,60
+ ,60029
+ ,108303
+ ,99
+ ,38650
+ ,64167
+ ,98
+ ,47261
+ ,8579
+ ,33
+ ,73586
+ ,97811
+ ,93
+ ,83042
+ ,84365
+ ,157
+ ,37238
+ ,10901
+ ,15
+ ,63958
+ ,91346
+ ,98
+ ,78956
+ ,33660
+ ,49
+ ,99518
+ ,93634
+ ,88
+ ,111436
+ ,109348
+ ,151
+ ,0
+ ,0
+ ,0
+ ,6023
+ ,7953
+ ,5
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,42564
+ ,63538
+ ,80
+ ,38885
+ ,108281
+ ,122
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1644
+ ,4245
+ ,6
+ ,6179
+ ,21509
+ ,13
+ ,3926
+ ,7670
+ ,3
+ ,23238
+ ,10641
+ ,18
+ ,0
+ ,0
+ ,0
+ ,49288
+ ,41243
+ ,48)
+ ,dim=c(3
+ ,164)
+ ,dimnames=list(c('Character'
+ ,'Seconds'
+ ,'Blogs')
+ ,1:164))
> y <- array(NA,dim=c(3,164),dimnames=list(c('Character','Seconds','Blogs'),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 = '2'
> 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
Seconds Character Blogs
1 114468 95556 128
2 88594 54565 89
3 74151 63016 68
4 77921 79774 108
5 53212 31258 51
6 34956 52491 33
7 149703 91256 119
8 6853 22807 5
9 58907 77411 63
10 67067 48821 66
11 110563 52295 98
12 58126 63262 71
13 57113 50466 55
14 77993 62932 116
15 68091 38439 71
16 124676 70817 120
17 109522 105965 122
18 75865 73795 74
19 79746 82043 111
20 77844 74349 103
21 98681 82204 98
22 105531 55709 100
23 51428 37137 42
24 65703 70780 100
25 72562 55027 105
26 81728 56699 77
27 95580 65911 83
28 98278 56316 98
29 46629 26982 46
30 115189 54628 95
31 124865 96750 91
32 59392 53009 91
33 127818 64664 94
34 17821 36990 15
35 154076 85224 137
36 64881 37048 56
37 136506 59635 78
38 66524 42051 68
39 45988 26998 34
40 107445 63717 94
41 102772 55071 82
42 46657 40001 63
43 97563 54506 58
44 36663 35838 43
45 55369 50838 36
46 77921 86997 64
47 56968 33032 21
48 77519 61704 104
49 129805 117986 124
50 72761 56733 101
51 81278 55064 85
52 15049 5950 7
53 113935 84607 124
54 25109 32551 21
55 45824 31701 35
56 89644 71170 95
57 109011 101773 102
58 134245 101653 212
59 136692 81493 141
60 50741 55901 54
61 149510 109104 117
62 147888 114425 145
63 54987 36311 50
64 74467 70027 80
65 100033 73713 87
66 85505 40671 78
67 62426 89041 86
68 82932 57231 82
69 72002 68608 119
70 65469 59155 75
71 63572 55827 70
72 23824 22618 25
73 73831 58425 66
74 63551 65724 89
75 56756 56979 99
76 81399 72369 98
77 117881 79194 104
78 70711 202316 48
79 50495 44970 81
80 53845 49319 64
81 51390 36252 44
82 104953 75741 104
83 65983 38417 36
84 76839 64102 120
85 55792 56622 58
86 25155 15430 27
87 55291 72571 84
88 84279 67271 56
89 99692 43460 46
90 59633 99501 119
91 63249 28340 57
92 82928 76013 139
93 50000 37361 51
94 69455 48204 85
95 84068 76168 91
96 76195 85168 79
97 114634 125410 142
98 139357 123328 149
99 110044 83038 96
100 155118 120087 198
101 83061 91939 61
102 127122 103646 145
103 45653 29467 26
104 19630 43750 49
105 67229 34497 68
106 86060 66477 145
107 88003 71181 82
108 95815 74482 102
109 85499 174949 52
110 27220 46765 56
111 109882 90257 80
112 72579 51370 99
113 5841 1168 11
114 68369 51360 87
115 24610 25162 28
116 30995 21067 67
117 150662 58233 150
118 6622 855 4
119 93694 85903 71
120 13155 14116 39
121 111908 57637 87
122 57550 94137 66
123 16356 62147 23
124 40174 62832 56
125 13983 8773 16
126 52316 63785 49
127 99585 65196 108
128 86271 73087 112
129 131012 72631 110
130 130274 86281 126
131 159051 162365 155
132 76506 56530 75
133 49145 35606 30
134 66398 70111 78
135 127546 92046 135
136 6802 63989 8
137 99509 104911 114
138 43106 43448 60
139 108303 60029 99
140 64167 38650 98
141 8579 47261 33
142 97811 73586 93
143 84365 83042 157
144 10901 37238 15
145 91346 63958 98
146 33660 78956 49
147 93634 99518 88
148 109348 111436 151
149 0 0 0
150 7953 6023 5
151 0 0 0
152 0 0 0
153 0 0 0
154 0 0 0
155 63538 42564 80
156 108281 38885 122
157 0 0 0
158 0 0 0
159 4245 1644 6
160 21509 6179 13
161 7670 3926 3
162 10641 23238 18
163 0 0 0
164 41243 49288 48
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Character Blogs
5911.6923 0.2742 653.6662
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-51352 -11692 -2177 10456 63254
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.912e+03 3.213e+03 1.840 0.0676 .
Character 2.742e-01 6.285e-02 4.363 2.28e-05 ***
Blogs 6.537e+02 4.917e+01 13.293 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 19080 on 161 degrees of freedom
Multiple R-squared: 0.7739, Adjusted R-squared: 0.7711
F-statistic: 275.5 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.2475046 4.950093e-01 7.524954e-01
[2,] 0.7569247 4.861506e-01 2.430753e-01
[3,] 0.6382928 7.234145e-01 3.617072e-01
[4,] 0.5259218 9.481565e-01 4.740782e-01
[5,] 0.4069627 8.139254e-01 5.930373e-01
[6,] 0.3499754 6.999507e-01 6.500246e-01
[7,] 0.2986939 5.973878e-01 7.013061e-01
[8,] 0.2166283 4.332567e-01 7.833717e-01
[9,] 0.4154416 8.308832e-01 5.845584e-01
[10,] 0.3302624 6.605248e-01 6.697376e-01
[11,] 0.2915065 5.830130e-01 7.084935e-01
[12,] 0.2317475 4.634951e-01 7.682525e-01
[13,] 0.1751953 3.503906e-01 8.248047e-01
[14,] 0.2217654 4.435308e-01 7.782346e-01
[15,] 0.2174708 4.349415e-01 7.825292e-01
[16,] 0.1744069 3.488137e-01 8.255931e-01
[17,] 0.1530857 3.061715e-01 8.469143e-01
[18,] 0.1200661 2.401322e-01 8.799339e-01
[19,] 0.1721241 3.442481e-01 8.278759e-01
[20,] 0.1942504 3.885007e-01 8.057496e-01
[21,] 0.1624097 3.248193e-01 8.375903e-01
[22,] 0.1600662 3.201324e-01 8.399338e-01
[23,] 0.1327129 2.654258e-01 8.672871e-01
[24,] 0.1012223 2.024445e-01 8.987777e-01
[25,] 0.1451238 2.902477e-01 8.548762e-01
[26,] 0.2614804 5.229607e-01 7.385196e-01
[27,] 0.2926066 5.852132e-01 7.073934e-01
[28,] 0.4836592 9.673183e-01 5.163408e-01
[29,] 0.4345076 8.690152e-01 5.654924e-01
[30,] 0.5070870 9.858259e-01 4.929130e-01
[31,] 0.4683135 9.366270e-01 5.316865e-01
[32,] 0.8645611 2.708779e-01 1.354389e-01
[33,] 0.8342885 3.314229e-01 1.657115e-01
[34,] 0.8067763 3.864475e-01 1.932237e-01
[35,] 0.8025722 3.948556e-01 1.974278e-01
[36,] 0.8213472 3.573056e-01 1.786528e-01
[37,] 0.8096884 3.806233e-01 1.903116e-01
[38,] 0.8853548 2.292905e-01 1.146452e-01
[39,] 0.8664162 2.671677e-01 1.335838e-01
[40,] 0.8466443 3.067114e-01 1.533557e-01
[41,] 0.8171294 3.657412e-01 1.828706e-01
[42,] 0.8456343 3.087313e-01 1.543657e-01
[43,] 0.8441699 3.116603e-01 1.558301e-01
[44,] 0.8188375 3.623250e-01 1.811625e-01
[45,] 0.8185188 3.629625e-01 1.814812e-01
[46,] 0.7869208 4.261583e-01 2.130792e-01
[47,] 0.7510593 4.978815e-01 2.489407e-01
[48,] 0.7146741 5.706518e-01 2.853259e-01
[49,] 0.6782789 6.434422e-01 3.217211e-01
[50,] 0.6404197 7.191607e-01 3.595803e-01
[51,] 0.5983298 8.033405e-01 4.016702e-01
[52,] 0.5584265 8.831470e-01 4.415735e-01
[53,] 0.6948829 6.102343e-01 3.051171e-01
[54,] 0.6843182 6.313636e-01 3.156818e-01
[55,] 0.6558121 6.883759e-01 3.441879e-01
[56,] 0.7446491 5.107017e-01 2.553509e-01
[57,] 0.7285237 5.429526e-01 2.714763e-01
[58,] 0.6934049 6.131903e-01 3.065951e-01
[59,] 0.6604207 6.791587e-01 3.395793e-01
[60,] 0.6471881 7.056238e-01 3.528119e-01
[61,] 0.6433125 7.133751e-01 3.566875e-01
[62,] 0.6998463 6.003073e-01 3.001537e-01
[63,] 0.6667691 6.664618e-01 3.332309e-01
[64,] 0.7334556 5.330888e-01 2.665444e-01
[65,] 0.7030041 5.939917e-01 2.969959e-01
[66,] 0.6677750 6.644499e-01 3.322250e-01
[67,] 0.6320774 7.358452e-01 3.679226e-01
[68,] 0.5983916 8.032168e-01 4.016084e-01
[69,] 0.6034252 7.931496e-01 3.965748e-01
[70,] 0.6618457 6.763086e-01 3.381543e-01
[71,] 0.6308003 7.383993e-01 3.691997e-01
[72,] 0.6478586 7.042828e-01 3.521414e-01
[73,] 0.6929255 6.141489e-01 3.070745e-01
[74,] 0.7036665 5.926670e-01 2.963335e-01
[75,] 0.6719050 6.561901e-01 3.280950e-01
[76,] 0.6366205 7.267589e-01 3.633795e-01
[77,] 0.6092061 7.815879e-01 3.907939e-01
[78,] 0.6468108 7.063784e-01 3.531892e-01
[79,] 0.6749379 6.501242e-01 3.250621e-01
[80,] 0.6367240 7.265519e-01 3.632760e-01
[81,] 0.5974717 8.050566e-01 4.025283e-01
[82,] 0.6299906 7.400188e-01 3.700094e-01
[83,] 0.6557063 6.885874e-01 3.442937e-01
[84,] 0.8813382 2.373237e-01 1.186618e-01
[85,] 0.9705722 5.885567e-02 2.942784e-02
[86,] 0.9674252 6.514965e-02 3.257482e-02
[87,] 0.9823691 3.526181e-02 1.763090e-02
[88,] 0.9771958 4.560839e-02 2.280420e-02
[89,] 0.9707131 5.857375e-02 2.928688e-02
[90,] 0.9622193 7.556144e-02 3.778072e-02
[91,] 0.9521845 9.563104e-02 4.781552e-02
[92,] 0.9504125 9.917501e-02 4.958751e-02
[93,] 0.9380161 1.239678e-01 6.198392e-02
[94,] 0.9411358 1.177284e-01 5.886420e-02
[95,] 0.9340159 1.319681e-01 6.598407e-02
[96,] 0.9284287 1.431425e-01 7.157125e-02
[97,] 0.9109890 1.780221e-01 8.901104e-02
[98,] 0.9108339 1.783323e-01 8.916613e-02
[99,] 0.9366298 1.267403e-01 6.337017e-02
[100,] 0.9251846 1.496309e-01 7.481544e-02
[101,] 0.9594135 8.117297e-02 4.058649e-02
[102,] 0.9520274 9.594517e-02 4.797258e-02
[103,] 0.9390808 1.218384e-01 6.091921e-02
[104,] 0.9269287 1.461425e-01 7.307126e-02
[105,] 0.9445888 1.108224e-01 5.541119e-02
[106,] 0.9676060 6.478803e-02 3.239401e-02
[107,] 0.9630433 7.391332e-02 3.695666e-02
[108,] 0.9539767 9.204667e-02 4.602334e-02
[109,] 0.9435812 1.128376e-01 5.641882e-02
[110,] 0.9295280 1.409439e-01 7.047197e-02
[111,] 0.9468942 1.062115e-01 5.310576e-02
[112,] 0.9602405 7.951893e-02 3.975946e-02
[113,] 0.9488046 1.023908e-01 5.119538e-02
[114,] 0.9595503 8.089949e-02 4.044975e-02
[115,] 0.9643572 7.128563e-02 3.564281e-02
[116,] 0.9870115 2.597698e-02 1.298849e-02
[117,] 0.9836283 3.274345e-02 1.637173e-02
[118,] 0.9816636 3.667271e-02 1.833635e-02
[119,] 0.9798296 4.034071e-02 2.017035e-02
[120,] 0.9721662 5.566762e-02 2.783381e-02
[121,] 0.9624387 7.512257e-02 3.756129e-02
[122,] 0.9510291 9.794181e-02 4.897091e-02
[123,] 0.9418598 1.162804e-01 5.814019e-02
[124,] 0.9797826 4.043484e-02 2.021742e-02
[125,] 0.9849144 3.017112e-02 1.508556e-02
[126,] 0.9875376 2.492478e-02 1.246239e-02
[127,] 0.9854629 2.907416e-02 1.453708e-02
[128,] 0.9892199 2.156028e-02 1.078014e-02
[129,] 0.9839541 3.209182e-02 1.604591e-02
[130,] 0.9852707 2.945855e-02 1.472928e-02
[131,] 0.9805697 3.886058e-02 1.943029e-02
[132,] 0.9726218 5.475644e-02 2.737822e-02
[133,] 0.9623532 7.529367e-02 3.764683e-02
[134,] 0.9871478 2.570440e-02 1.285220e-02
[135,] 0.9830104 3.397915e-02 1.698958e-02
[136,] 0.9894482 2.110366e-02 1.055183e-02
[137,] 0.9951460 9.707967e-03 4.853984e-03
[138,] 0.9999877 2.456115e-05 1.228058e-05
[139,] 0.9999695 6.098979e-05 3.049489e-05
[140,] 0.9999570 8.602775e-05 4.301388e-05
[141,] 0.9999440 1.119191e-04 5.595953e-05
[142,] 1.0000000 7.504355e-08 3.752177e-08
[143,] 1.0000000 6.565350e-08 3.282675e-08
[144,] 0.9999998 3.396026e-07 1.698013e-07
[145,] 0.9999993 1.368533e-06 6.842664e-07
[146,] 0.9999966 6.822834e-06 3.411417e-06
[147,] 0.9999838 3.241019e-05 1.620510e-05
[148,] 0.9999270 1.459173e-04 7.295866e-05
[149,] 0.9996908 6.184171e-04 3.092086e-04
[150,] 0.9992554 1.489174e-03 7.445870e-04
[151,] 0.9992043 1.591478e-03 7.957390e-04
[152,] 0.9957441 8.511795e-03 4.255898e-03
[153,] 0.9794007 4.119869e-02 2.059935e-02
> postscript(file="/var/wessaorg/rcomp/tmp/1fr031321971799.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/28c7t1321971799.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/30ecx1321971799.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/4c50r1321971799.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/5wt8x1321971799.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
-1318.0848 9542.2005 6508.6032 -20463.7313 5391.1892 -6921.7207
7 8 9 10 11 12
40979.1360 -8581.5765 -9414.7261 4624.7485 26250.7254 -11544.8581
13 14 15 16 17 18
1409.9549 -21002.3395 5227.5594 20903.6265 -5196.6340 1344.5912
19 20 21 22 23 24
-21221.9767 -15784.6574 6166.5319 18975.1434 7877.9383 -24985.9022
25 26 27 28 29 30
-17075.1572 9934.9706 17338.6900 12863.0132 3249.1634 32197.9261
31 32 33 34 35 36
32937.1250 -20540.4172 42728.3367 -8039.7606 35240.3494 12204.0183
37 38 39 40 41 42
63254.1407 4631.0094 10447.7702 22615.0403 28157.0994 -11405.4710
43 44 45 46 47 48
38791.0335 -7184.4924 11983.5966 6316.7593 28270.6772 -13295.5802
49 50 51 52 53 54
10482.4149 -14729.3429 4704.0204 2929.9262 3766.2154 -3456.4141
55 56 57 58 59 60
8340.3613 2116.4760 8515.2975 -38121.0786 16264.8676 -5798.8640
61 62 63 64 65 66
37198.8631 15814.9868 6434.1293 -2942.0762 17037.4178 17453.7960
67 68 69 70 71 72
-24119.4407 7724.7447 -30510.9148 -5690.2262 -3406.2300 -4632.0699
73 74 75 76 77 78
8754.9638 -18561.0248 -29494.4731 -8418.3344 22269.9918 -22059.4684
79 80 81 82 83 84
-20696.1532 -7426.4898 6775.3067 10288.9367 26003.9106 -25091.8633
85 86 87 88 89 90
-3560.2548 -2637.1774 -25430.4034 23313.7140 51793.2645 -51351.9589
91 92 93 94 95 96
12306.4193 -34688.9740 505.5128 -5237.7048 -2215.5021 -4712.6522
97 98 99 100 101 102
-18490.5223 2227.7782 18608.1496 -13152.0604 12062.4723 -1994.9985
103 104 105 106 107 108
14665.0057 -30309.2632 7407.6055 -32863.8349 8970.1203 2803.5352
109 110 111 112 113 114
-2381.0536 -28121.7553 26925.0828 -12133.2704 -7581.3311 -8496.5333
115 116 117 118 119 120
-6504.7309 -24489.7078 30730.6546 -2138.8309 17814.1124 -22120.8230
121 122 123 124 125 126
33321.0728 -17319.6347 -21633.1035 -19573.9422 -4793.2446 -3117.6277
127 128 129 130 131 132
5198.1147 -12894.5646 33278.8205 18338.8080 7294.3401 6066.6493
133 134 135 136 137 138
13858.7918 -9726.7798 8146.8281 -21887.2571 -9691.2570 -13940.7718
139 140 141 142 143 144
21216.1001 -16403.2929 -31864.4543 10928.2487 -46945.5871 -15027.7717
145 146 147 148 149 150
3835.2840 -25934.0971 2908.0321 -25827.3123 -5911.6923 -2878.7607
151 152 153 154 155 156
-5911.6923 -5911.6923 -5911.6923 -5911.6923 -6339.6696 11958.2717
157 158 159 160 161 162
-5911.6923 -5911.6923 -6039.5374 5405.1283 -1279.3506 -13409.4341
163 164
-5911.6923 -9561.3288
> postscript(file="/var/wessaorg/rcomp/tmp/681vh1321971799.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 -1318.0848 NA
1 9542.2005 -1318.0848
2 6508.6032 9542.2005
3 -20463.7313 6508.6032
4 5391.1892 -20463.7313
5 -6921.7207 5391.1892
6 40979.1360 -6921.7207
7 -8581.5765 40979.1360
8 -9414.7261 -8581.5765
9 4624.7485 -9414.7261
10 26250.7254 4624.7485
11 -11544.8581 26250.7254
12 1409.9549 -11544.8581
13 -21002.3395 1409.9549
14 5227.5594 -21002.3395
15 20903.6265 5227.5594
16 -5196.6340 20903.6265
17 1344.5912 -5196.6340
18 -21221.9767 1344.5912
19 -15784.6574 -21221.9767
20 6166.5319 -15784.6574
21 18975.1434 6166.5319
22 7877.9383 18975.1434
23 -24985.9022 7877.9383
24 -17075.1572 -24985.9022
25 9934.9706 -17075.1572
26 17338.6900 9934.9706
27 12863.0132 17338.6900
28 3249.1634 12863.0132
29 32197.9261 3249.1634
30 32937.1250 32197.9261
31 -20540.4172 32937.1250
32 42728.3367 -20540.4172
33 -8039.7606 42728.3367
34 35240.3494 -8039.7606
35 12204.0183 35240.3494
36 63254.1407 12204.0183
37 4631.0094 63254.1407
38 10447.7702 4631.0094
39 22615.0403 10447.7702
40 28157.0994 22615.0403
41 -11405.4710 28157.0994
42 38791.0335 -11405.4710
43 -7184.4924 38791.0335
44 11983.5966 -7184.4924
45 6316.7593 11983.5966
46 28270.6772 6316.7593
47 -13295.5802 28270.6772
48 10482.4149 -13295.5802
49 -14729.3429 10482.4149
50 4704.0204 -14729.3429
51 2929.9262 4704.0204
52 3766.2154 2929.9262
53 -3456.4141 3766.2154
54 8340.3613 -3456.4141
55 2116.4760 8340.3613
56 8515.2975 2116.4760
57 -38121.0786 8515.2975
58 16264.8676 -38121.0786
59 -5798.8640 16264.8676
60 37198.8631 -5798.8640
61 15814.9868 37198.8631
62 6434.1293 15814.9868
63 -2942.0762 6434.1293
64 17037.4178 -2942.0762
65 17453.7960 17037.4178
66 -24119.4407 17453.7960
67 7724.7447 -24119.4407
68 -30510.9148 7724.7447
69 -5690.2262 -30510.9148
70 -3406.2300 -5690.2262
71 -4632.0699 -3406.2300
72 8754.9638 -4632.0699
73 -18561.0248 8754.9638
74 -29494.4731 -18561.0248
75 -8418.3344 -29494.4731
76 22269.9918 -8418.3344
77 -22059.4684 22269.9918
78 -20696.1532 -22059.4684
79 -7426.4898 -20696.1532
80 6775.3067 -7426.4898
81 10288.9367 6775.3067
82 26003.9106 10288.9367
83 -25091.8633 26003.9106
84 -3560.2548 -25091.8633
85 -2637.1774 -3560.2548
86 -25430.4034 -2637.1774
87 23313.7140 -25430.4034
88 51793.2645 23313.7140
89 -51351.9589 51793.2645
90 12306.4193 -51351.9589
91 -34688.9740 12306.4193
92 505.5128 -34688.9740
93 -5237.7048 505.5128
94 -2215.5021 -5237.7048
95 -4712.6522 -2215.5021
96 -18490.5223 -4712.6522
97 2227.7782 -18490.5223
98 18608.1496 2227.7782
99 -13152.0604 18608.1496
100 12062.4723 -13152.0604
101 -1994.9985 12062.4723
102 14665.0057 -1994.9985
103 -30309.2632 14665.0057
104 7407.6055 -30309.2632
105 -32863.8349 7407.6055
106 8970.1203 -32863.8349
107 2803.5352 8970.1203
108 -2381.0536 2803.5352
109 -28121.7553 -2381.0536
110 26925.0828 -28121.7553
111 -12133.2704 26925.0828
112 -7581.3311 -12133.2704
113 -8496.5333 -7581.3311
114 -6504.7309 -8496.5333
115 -24489.7078 -6504.7309
116 30730.6546 -24489.7078
117 -2138.8309 30730.6546
118 17814.1124 -2138.8309
119 -22120.8230 17814.1124
120 33321.0728 -22120.8230
121 -17319.6347 33321.0728
122 -21633.1035 -17319.6347
123 -19573.9422 -21633.1035
124 -4793.2446 -19573.9422
125 -3117.6277 -4793.2446
126 5198.1147 -3117.6277
127 -12894.5646 5198.1147
128 33278.8205 -12894.5646
129 18338.8080 33278.8205
130 7294.3401 18338.8080
131 6066.6493 7294.3401
132 13858.7918 6066.6493
133 -9726.7798 13858.7918
134 8146.8281 -9726.7798
135 -21887.2571 8146.8281
136 -9691.2570 -21887.2571
137 -13940.7718 -9691.2570
138 21216.1001 -13940.7718
139 -16403.2929 21216.1001
140 -31864.4543 -16403.2929
141 10928.2487 -31864.4543
142 -46945.5871 10928.2487
143 -15027.7717 -46945.5871
144 3835.2840 -15027.7717
145 -25934.0971 3835.2840
146 2908.0321 -25934.0971
147 -25827.3123 2908.0321
148 -5911.6923 -25827.3123
149 -2878.7607 -5911.6923
150 -5911.6923 -2878.7607
151 -5911.6923 -5911.6923
152 -5911.6923 -5911.6923
153 -5911.6923 -5911.6923
154 -6339.6696 -5911.6923
155 11958.2717 -6339.6696
156 -5911.6923 11958.2717
157 -5911.6923 -5911.6923
158 -6039.5374 -5911.6923
159 5405.1283 -6039.5374
160 -1279.3506 5405.1283
161 -13409.4341 -1279.3506
162 -5911.6923 -13409.4341
163 -9561.3288 -5911.6923
164 NA -9561.3288
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 9542.2005 -1318.0848
[2,] 6508.6032 9542.2005
[3,] -20463.7313 6508.6032
[4,] 5391.1892 -20463.7313
[5,] -6921.7207 5391.1892
[6,] 40979.1360 -6921.7207
[7,] -8581.5765 40979.1360
[8,] -9414.7261 -8581.5765
[9,] 4624.7485 -9414.7261
[10,] 26250.7254 4624.7485
[11,] -11544.8581 26250.7254
[12,] 1409.9549 -11544.8581
[13,] -21002.3395 1409.9549
[14,] 5227.5594 -21002.3395
[15,] 20903.6265 5227.5594
[16,] -5196.6340 20903.6265
[17,] 1344.5912 -5196.6340
[18,] -21221.9767 1344.5912
[19,] -15784.6574 -21221.9767
[20,] 6166.5319 -15784.6574
[21,] 18975.1434 6166.5319
[22,] 7877.9383 18975.1434
[23,] -24985.9022 7877.9383
[24,] -17075.1572 -24985.9022
[25,] 9934.9706 -17075.1572
[26,] 17338.6900 9934.9706
[27,] 12863.0132 17338.6900
[28,] 3249.1634 12863.0132
[29,] 32197.9261 3249.1634
[30,] 32937.1250 32197.9261
[31,] -20540.4172 32937.1250
[32,] 42728.3367 -20540.4172
[33,] -8039.7606 42728.3367
[34,] 35240.3494 -8039.7606
[35,] 12204.0183 35240.3494
[36,] 63254.1407 12204.0183
[37,] 4631.0094 63254.1407
[38,] 10447.7702 4631.0094
[39,] 22615.0403 10447.7702
[40,] 28157.0994 22615.0403
[41,] -11405.4710 28157.0994
[42,] 38791.0335 -11405.4710
[43,] -7184.4924 38791.0335
[44,] 11983.5966 -7184.4924
[45,] 6316.7593 11983.5966
[46,] 28270.6772 6316.7593
[47,] -13295.5802 28270.6772
[48,] 10482.4149 -13295.5802
[49,] -14729.3429 10482.4149
[50,] 4704.0204 -14729.3429
[51,] 2929.9262 4704.0204
[52,] 3766.2154 2929.9262
[53,] -3456.4141 3766.2154
[54,] 8340.3613 -3456.4141
[55,] 2116.4760 8340.3613
[56,] 8515.2975 2116.4760
[57,] -38121.0786 8515.2975
[58,] 16264.8676 -38121.0786
[59,] -5798.8640 16264.8676
[60,] 37198.8631 -5798.8640
[61,] 15814.9868 37198.8631
[62,] 6434.1293 15814.9868
[63,] -2942.0762 6434.1293
[64,] 17037.4178 -2942.0762
[65,] 17453.7960 17037.4178
[66,] -24119.4407 17453.7960
[67,] 7724.7447 -24119.4407
[68,] -30510.9148 7724.7447
[69,] -5690.2262 -30510.9148
[70,] -3406.2300 -5690.2262
[71,] -4632.0699 -3406.2300
[72,] 8754.9638 -4632.0699
[73,] -18561.0248 8754.9638
[74,] -29494.4731 -18561.0248
[75,] -8418.3344 -29494.4731
[76,] 22269.9918 -8418.3344
[77,] -22059.4684 22269.9918
[78,] -20696.1532 -22059.4684
[79,] -7426.4898 -20696.1532
[80,] 6775.3067 -7426.4898
[81,] 10288.9367 6775.3067
[82,] 26003.9106 10288.9367
[83,] -25091.8633 26003.9106
[84,] -3560.2548 -25091.8633
[85,] -2637.1774 -3560.2548
[86,] -25430.4034 -2637.1774
[87,] 23313.7140 -25430.4034
[88,] 51793.2645 23313.7140
[89,] -51351.9589 51793.2645
[90,] 12306.4193 -51351.9589
[91,] -34688.9740 12306.4193
[92,] 505.5128 -34688.9740
[93,] -5237.7048 505.5128
[94,] -2215.5021 -5237.7048
[95,] -4712.6522 -2215.5021
[96,] -18490.5223 -4712.6522
[97,] 2227.7782 -18490.5223
[98,] 18608.1496 2227.7782
[99,] -13152.0604 18608.1496
[100,] 12062.4723 -13152.0604
[101,] -1994.9985 12062.4723
[102,] 14665.0057 -1994.9985
[103,] -30309.2632 14665.0057
[104,] 7407.6055 -30309.2632
[105,] -32863.8349 7407.6055
[106,] 8970.1203 -32863.8349
[107,] 2803.5352 8970.1203
[108,] -2381.0536 2803.5352
[109,] -28121.7553 -2381.0536
[110,] 26925.0828 -28121.7553
[111,] -12133.2704 26925.0828
[112,] -7581.3311 -12133.2704
[113,] -8496.5333 -7581.3311
[114,] -6504.7309 -8496.5333
[115,] -24489.7078 -6504.7309
[116,] 30730.6546 -24489.7078
[117,] -2138.8309 30730.6546
[118,] 17814.1124 -2138.8309
[119,] -22120.8230 17814.1124
[120,] 33321.0728 -22120.8230
[121,] -17319.6347 33321.0728
[122,] -21633.1035 -17319.6347
[123,] -19573.9422 -21633.1035
[124,] -4793.2446 -19573.9422
[125,] -3117.6277 -4793.2446
[126,] 5198.1147 -3117.6277
[127,] -12894.5646 5198.1147
[128,] 33278.8205 -12894.5646
[129,] 18338.8080 33278.8205
[130,] 7294.3401 18338.8080
[131,] 6066.6493 7294.3401
[132,] 13858.7918 6066.6493
[133,] -9726.7798 13858.7918
[134,] 8146.8281 -9726.7798
[135,] -21887.2571 8146.8281
[136,] -9691.2570 -21887.2571
[137,] -13940.7718 -9691.2570
[138,] 21216.1001 -13940.7718
[139,] -16403.2929 21216.1001
[140,] -31864.4543 -16403.2929
[141,] 10928.2487 -31864.4543
[142,] -46945.5871 10928.2487
[143,] -15027.7717 -46945.5871
[144,] 3835.2840 -15027.7717
[145,] -25934.0971 3835.2840
[146,] 2908.0321 -25934.0971
[147,] -25827.3123 2908.0321
[148,] -5911.6923 -25827.3123
[149,] -2878.7607 -5911.6923
[150,] -5911.6923 -2878.7607
[151,] -5911.6923 -5911.6923
[152,] -5911.6923 -5911.6923
[153,] -5911.6923 -5911.6923
[154,] -6339.6696 -5911.6923
[155,] 11958.2717 -6339.6696
[156,] -5911.6923 11958.2717
[157,] -5911.6923 -5911.6923
[158,] -6039.5374 -5911.6923
[159,] 5405.1283 -6039.5374
[160,] -1279.3506 5405.1283
[161,] -13409.4341 -1279.3506
[162,] -5911.6923 -13409.4341
[163,] -9561.3288 -5911.6923
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 9542.2005 -1318.0848
2 6508.6032 9542.2005
3 -20463.7313 6508.6032
4 5391.1892 -20463.7313
5 -6921.7207 5391.1892
6 40979.1360 -6921.7207
7 -8581.5765 40979.1360
8 -9414.7261 -8581.5765
9 4624.7485 -9414.7261
10 26250.7254 4624.7485
11 -11544.8581 26250.7254
12 1409.9549 -11544.8581
13 -21002.3395 1409.9549
14 5227.5594 -21002.3395
15 20903.6265 5227.5594
16 -5196.6340 20903.6265
17 1344.5912 -5196.6340
18 -21221.9767 1344.5912
19 -15784.6574 -21221.9767
20 6166.5319 -15784.6574
21 18975.1434 6166.5319
22 7877.9383 18975.1434
23 -24985.9022 7877.9383
24 -17075.1572 -24985.9022
25 9934.9706 -17075.1572
26 17338.6900 9934.9706
27 12863.0132 17338.6900
28 3249.1634 12863.0132
29 32197.9261 3249.1634
30 32937.1250 32197.9261
31 -20540.4172 32937.1250
32 42728.3367 -20540.4172
33 -8039.7606 42728.3367
34 35240.3494 -8039.7606
35 12204.0183 35240.3494
36 63254.1407 12204.0183
37 4631.0094 63254.1407
38 10447.7702 4631.0094
39 22615.0403 10447.7702
40 28157.0994 22615.0403
41 -11405.4710 28157.0994
42 38791.0335 -11405.4710
43 -7184.4924 38791.0335
44 11983.5966 -7184.4924
45 6316.7593 11983.5966
46 28270.6772 6316.7593
47 -13295.5802 28270.6772
48 10482.4149 -13295.5802
49 -14729.3429 10482.4149
50 4704.0204 -14729.3429
51 2929.9262 4704.0204
52 3766.2154 2929.9262
53 -3456.4141 3766.2154
54 8340.3613 -3456.4141
55 2116.4760 8340.3613
56 8515.2975 2116.4760
57 -38121.0786 8515.2975
58 16264.8676 -38121.0786
59 -5798.8640 16264.8676
60 37198.8631 -5798.8640
61 15814.9868 37198.8631
62 6434.1293 15814.9868
63 -2942.0762 6434.1293
64 17037.4178 -2942.0762
65 17453.7960 17037.4178
66 -24119.4407 17453.7960
67 7724.7447 -24119.4407
68 -30510.9148 7724.7447
69 -5690.2262 -30510.9148
70 -3406.2300 -5690.2262
71 -4632.0699 -3406.2300
72 8754.9638 -4632.0699
73 -18561.0248 8754.9638
74 -29494.4731 -18561.0248
75 -8418.3344 -29494.4731
76 22269.9918 -8418.3344
77 -22059.4684 22269.9918
78 -20696.1532 -22059.4684
79 -7426.4898 -20696.1532
80 6775.3067 -7426.4898
81 10288.9367 6775.3067
82 26003.9106 10288.9367
83 -25091.8633 26003.9106
84 -3560.2548 -25091.8633
85 -2637.1774 -3560.2548
86 -25430.4034 -2637.1774
87 23313.7140 -25430.4034
88 51793.2645 23313.7140
89 -51351.9589 51793.2645
90 12306.4193 -51351.9589
91 -34688.9740 12306.4193
92 505.5128 -34688.9740
93 -5237.7048 505.5128
94 -2215.5021 -5237.7048
95 -4712.6522 -2215.5021
96 -18490.5223 -4712.6522
97 2227.7782 -18490.5223
98 18608.1496 2227.7782
99 -13152.0604 18608.1496
100 12062.4723 -13152.0604
101 -1994.9985 12062.4723
102 14665.0057 -1994.9985
103 -30309.2632 14665.0057
104 7407.6055 -30309.2632
105 -32863.8349 7407.6055
106 8970.1203 -32863.8349
107 2803.5352 8970.1203
108 -2381.0536 2803.5352
109 -28121.7553 -2381.0536
110 26925.0828 -28121.7553
111 -12133.2704 26925.0828
112 -7581.3311 -12133.2704
113 -8496.5333 -7581.3311
114 -6504.7309 -8496.5333
115 -24489.7078 -6504.7309
116 30730.6546 -24489.7078
117 -2138.8309 30730.6546
118 17814.1124 -2138.8309
119 -22120.8230 17814.1124
120 33321.0728 -22120.8230
121 -17319.6347 33321.0728
122 -21633.1035 -17319.6347
123 -19573.9422 -21633.1035
124 -4793.2446 -19573.9422
125 -3117.6277 -4793.2446
126 5198.1147 -3117.6277
127 -12894.5646 5198.1147
128 33278.8205 -12894.5646
129 18338.8080 33278.8205
130 7294.3401 18338.8080
131 6066.6493 7294.3401
132 13858.7918 6066.6493
133 -9726.7798 13858.7918
134 8146.8281 -9726.7798
135 -21887.2571 8146.8281
136 -9691.2570 -21887.2571
137 -13940.7718 -9691.2570
138 21216.1001 -13940.7718
139 -16403.2929 21216.1001
140 -31864.4543 -16403.2929
141 10928.2487 -31864.4543
142 -46945.5871 10928.2487
143 -15027.7717 -46945.5871
144 3835.2840 -15027.7717
145 -25934.0971 3835.2840
146 2908.0321 -25934.0971
147 -25827.3123 2908.0321
148 -5911.6923 -25827.3123
149 -2878.7607 -5911.6923
150 -5911.6923 -2878.7607
151 -5911.6923 -5911.6923
152 -5911.6923 -5911.6923
153 -5911.6923 -5911.6923
154 -6339.6696 -5911.6923
155 11958.2717 -6339.6696
156 -5911.6923 11958.2717
157 -5911.6923 -5911.6923
158 -6039.5374 -5911.6923
159 5405.1283 -6039.5374
160 -1279.3506 5405.1283
161 -13409.4341 -1279.3506
162 -5911.6923 -13409.4341
163 -9561.3288 -5911.6923
> 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/7ppyd1321971799.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/8cnzs1321971799.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/9e0wm1321971799.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/10c3gc1321971799.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/11itav1321971799.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/12ybmu1321971799.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/135usd1321971799.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/14wnvl1321971799.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/15duyp1321971799.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/16hyhv1321971799.tab")
+ }
>
> try(system("convert tmp/1fr031321971799.ps tmp/1fr031321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/28c7t1321971799.ps tmp/28c7t1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/30ecx1321971799.ps tmp/30ecx1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/4c50r1321971799.ps tmp/4c50r1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/5wt8x1321971799.ps tmp/5wt8x1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/681vh1321971799.ps tmp/681vh1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ppyd1321971799.ps tmp/7ppyd1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/8cnzs1321971799.ps tmp/8cnzs1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/9e0wm1321971799.ps tmp/9e0wm1321971799.png",intern=TRUE))
character(0)
> try(system("convert tmp/10c3gc1321971799.ps tmp/10c3gc1321971799.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.755 0.512 5.388