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(3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,5
+ ,5
+ ,4
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,5
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,5
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,5
+ ,5
+ ,3
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,2
+ ,3
+ ,4
+ ,3
+ ,2
+ ,2
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,5
+ ,5
+ ,3
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,4
+ ,3
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,5
+ ,3
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,5
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,3
+ ,5
+ ,5
+ ,3
+ ,4
+ ,5
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,2
+ ,3
+ ,4
+ ,3
+ ,4
+ ,5
+ ,5
+ ,5
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,3
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,5
+ ,5
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,1
+ ,3
+ ,3
+ ,5
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,5
+ ,3
+ ,5
+ ,5
+ ,5
+ ,3
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,3
+ ,4
+ ,2
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,3
+ ,3
+ ,3
+ ,4
+ ,2
+ ,4
+ ,5
+ ,5
+ ,4
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,2
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,5
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,3
+ ,5
+ ,3
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,2
+ ,4
+ ,4
+ ,3
+ ,5
+ ,4
+ ,5
+ ,5
+ ,5
+ ,1
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,5
+ ,5
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,2
+ ,2
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,2
+ ,3
+ ,3
+ ,5
+ ,5
+ ,4
+ ,4
+ ,2
+ ,3
+ ,5
+ ,3
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4)
+ ,dim=c(3
+ ,162)
+ ,dimnames=list(c('A'
+ ,'B'
+ ,'C')
+ ,1:162))
> y <- array(NA,dim=c(3,162),dimnames=list(c('A','B','C'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '3'
> 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
C A B t
1 3 3 3 1
2 5 4 4 2
3 3 5 4 3
4 3 4 4 4
5 4 3 4 5
6 5 3 3 6
7 4 4 5 7
8 4 4 4 8
9 4 3 3 9
10 4 4 3 10
11 4 4 4 11
12 5 4 4 12
13 2 4 4 13
14 4 4 4 14
15 5 4 4 15
16 4 4 4 16
17 4 4 4 17
18 4 5 5 18
19 4 5 4 19
20 5 4 4 20
21 4 4 4 21
22 3 4 4 22
23 3 5 5 23
24 3 4 4 24
25 5 4 4 25
26 2 4 4 26
27 4 4 4 27
28 4 4 4 28
29 4 4 4 29
30 3 3 4 30
31 4 3 4 31
32 3 3 3 32
33 4 4 4 33
34 4 4 4 34
35 4 3 3 35
36 4 2 3 36
37 2 3 2 37
38 4 3 3 38
39 5 4 4 39
40 3 4 4 40
41 4 4 4 41
42 4 4 4 42
43 5 5 5 43
44 3 3 4 44
45 4 3 4 45
46 3 3 4 46
47 4 4 3 47
48 4 4 4 48
49 5 4 4 49
50 4 3 3 50
51 3 4 4 51
52 3 3 3 52
53 4 3 3 53
54 3 4 5 54
55 4 3 2 55
56 4 4 4 56
57 4 4 4 57
58 3 4 4 58
59 3 5 3 59
60 3 4 4 60
61 3 3 3 61
62 4 4 4 62
63 4 4 4 63
64 4 3 4 64
65 4 4 4 65
66 3 3 4 66
67 3 5 5 67
68 3 4 5 68
69 4 3 3 69
70 4 4 4 70
71 4 2 3 71
72 5 3 4 72
73 4 5 5 73
74 4 4 5 74
75 3 4 4 75
76 4 5 4 76
77 5 4 4 77
78 3 4 4 78
79 5 3 4 79
80 4 4 4 80
81 4 3 4 81
82 4 5 5 82
83 3 4 4 83
84 4 4 4 84
85 4 4 4 85
86 4 4 4 86
87 4 3 4 87
88 4 4 4 88
89 4 4 4 89
90 1 3 4 90
91 5 3 3 91
92 4 5 4 92
93 4 4 4 93
94 4 4 4 94
95 4 3 4 95
96 4 4 4 96
97 2 4 4 97
98 4 4 4 98
99 4 4 4 99
100 4 4 4 100
101 4 4 4 101
102 3 3 5 102
103 5 5 5 103
104 3 3 4 104
105 4 4 4 105
106 2 3 3 106
107 4 4 4 107
108 5 4 4 108
109 2 3 4 109
110 4 3 2 110
111 4 4 4 111
112 4 4 4 112
113 3 5 4 113
114 4 3 3 114
115 5 2 4 115
116 3 5 4 116
117 4 3 3 117
118 4 4 4 118
119 4 3 4 119
120 4 4 4 120
121 2 3 4 121
122 3 4 4 122
123 4 3 4 123
124 4 4 4 124
125 4 3 4 125
126 3 4 4 126
127 4 4 4 127
128 4 4 4 128
129 5 3 4 129
130 4 3 3 130
131 3 4 4 131
132 3 3 3 132
133 4 4 4 133
134 4 3 3 134
135 4 4 3 135
136 5 4 3 136
137 3 3 4 137
138 4 4 4 138
139 3 3 4 139
140 4 3 4 140
141 2 3 3 141
142 3 4 4 142
143 5 5 4 143
144 1 5 5 144
145 4 4 4 145
146 5 3 3 146
147 4 5 4 147
148 3 3 3 148
149 3 4 4 149
150 2 3 4 150
151 4 2 3 151
152 4 4 4 152
153 5 4 4 153
154 3 4 4 154
155 2 3 4 155
156 5 3 3 156
157 4 5 4 157
158 5 2 3 158
159 5 3 4 159
160 4 4 4 160
161 4 3 3 161
162 4 4 4 162
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) A B t
3.9752414 0.0638968 -0.1063116 -0.0006228
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.6856 -0.7130 0.2266 0.2841 1.3938
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.9752414 0.4879939 8.146 1.07e-13 ***
A 0.0638968 0.1132392 0.564 0.573
B -0.1063116 0.1372291 -0.775 0.440
t -0.0006228 0.0014101 -0.442 0.659
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8326 on 158 degrees of freedom
Multiple R-squared: 0.005328, Adjusted R-squared: -0.01356
F-statistic: 0.2821 on 3 and 158 DF, p-value: 0.8383
> 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.864079543 0.27184091 0.13592046
[2,] 0.769070855 0.46185829 0.23092914
[3,] 0.674053243 0.65189351 0.32594676
[4,] 0.552478658 0.89504268 0.44752134
[5,] 0.437013220 0.87402644 0.56298678
[6,] 0.410080864 0.82016173 0.58991914
[7,] 0.839651210 0.32069758 0.16034879
[8,] 0.778848269 0.44230346 0.22115173
[9,] 0.793736535 0.41252693 0.20626347
[10,] 0.730141444 0.53971711 0.26985856
[11,] 0.660011182 0.67997764 0.33998882
[12,] 0.584357903 0.83128419 0.41564210
[13,] 0.507881165 0.98423767 0.49211884
[14,] 0.489708486 0.97941697 0.51029151
[15,] 0.433500600 0.86700120 0.56649940
[16,] 0.518811415 0.96237717 0.48118858
[17,] 0.517671669 0.96465666 0.48232833
[18,] 0.533824294 0.93235141 0.46617571
[19,] 0.571776720 0.85644656 0.42822328
[20,] 0.784019867 0.43196027 0.21598013
[21,] 0.738653293 0.52269341 0.26134671
[22,] 0.688695229 0.62260954 0.31130477
[23,] 0.635042126 0.72991575 0.36495787
[24,] 0.634701320 0.73059736 0.36529868
[25,] 0.581753186 0.83649363 0.41824681
[26,] 0.565815770 0.86836846 0.43418423
[27,] 0.518874130 0.96225174 0.48112587
[28,] 0.470455434 0.94091087 0.52954457
[29,] 0.419351858 0.83870372 0.58064814
[30,] 0.367228973 0.73445795 0.63277103
[31,] 0.496242162 0.99248432 0.50375784
[32,] 0.459145951 0.91829190 0.54085405
[33,] 0.542492808 0.91501438 0.45750719
[34,] 0.525345801 0.94930840 0.47465420
[35,] 0.479600406 0.95920081 0.52039959
[36,] 0.433431948 0.86686390 0.56656805
[37,] 0.481999936 0.96399987 0.51800006
[38,] 0.482683513 0.96536703 0.51731649
[39,] 0.434888328 0.86977666 0.56511167
[40,] 0.425415772 0.85083154 0.57458423
[41,] 0.389733239 0.77946648 0.61026676
[42,] 0.345941497 0.69188299 0.65405850
[43,] 0.401385382 0.80277076 0.59861462
[44,] 0.360368109 0.72073622 0.63963189
[45,] 0.358069359 0.71613872 0.64193064
[46,] 0.341982132 0.68396426 0.65801787
[47,] 0.306455500 0.61291100 0.69354450
[48,] 0.304697407 0.60939481 0.69530259
[49,] 0.273377715 0.54675543 0.72662229
[50,] 0.237553733 0.47510747 0.76244627
[51,] 0.204412381 0.40882476 0.79558762
[52,] 0.198065951 0.39613190 0.80193405
[53,] 0.197729578 0.39545916 0.80227042
[54,] 0.188439144 0.37687829 0.81156086
[55,] 0.181662043 0.36332409 0.81833796
[56,] 0.156819160 0.31363832 0.84318084
[57,] 0.133937529 0.26787506 0.86606247
[58,] 0.113707393 0.22741479 0.88629261
[59,] 0.095125186 0.19025037 0.90487481
[60,] 0.088799449 0.17759890 0.91120055
[61,] 0.083364318 0.16672864 0.91663568
[62,] 0.075354383 0.15070877 0.92464562
[63,] 0.064440595 0.12888119 0.93555941
[64,] 0.053591370 0.10718274 0.94640863
[65,] 0.044565302 0.08913060 0.95543470
[66,] 0.065178000 0.13035600 0.93482200
[67,] 0.053825044 0.10765009 0.94617496
[68,] 0.044554089 0.08910818 0.95544591
[69,] 0.041823853 0.08364771 0.95817615
[70,] 0.033953179 0.06790636 0.96604682
[71,] 0.048261255 0.09652251 0.95173874
[72,] 0.045831671 0.09166334 0.95416833
[73,] 0.064480199 0.12896040 0.93551980
[74,] 0.052467659 0.10493532 0.94753234
[75,] 0.042764344 0.08552869 0.95723566
[76,] 0.035080977 0.07016195 0.96491902
[77,] 0.033035669 0.06607134 0.96696433
[78,] 0.026229940 0.05245988 0.97377006
[79,] 0.020637094 0.04127419 0.97936291
[80,] 0.016093139 0.03218628 0.98390686
[81,] 0.012679444 0.02535889 0.98732056
[82,] 0.009743941 0.01948788 0.99025606
[83,] 0.007430295 0.01486059 0.99256971
[84,] 0.084048412 0.16809682 0.91595159
[85,] 0.105382476 0.21076495 0.89461752
[86,] 0.087271617 0.17454323 0.91272838
[87,] 0.072327264 0.14465453 0.92767274
[88,] 0.059497116 0.11899423 0.94050288
[89,] 0.049420895 0.09884179 0.95057910
[90,] 0.040150907 0.08030181 0.95984909
[91,] 0.080164008 0.16032802 0.91983599
[92,] 0.066156399 0.13231280 0.93384360
[93,] 0.054178373 0.10835675 0.94582163
[94,] 0.044048867 0.08809773 0.95595113
[95,] 0.035574978 0.07114996 0.96442502
[96,] 0.030142695 0.06028539 0.96985730
[97,] 0.051817680 0.10363536 0.94818232
[98,] 0.045024637 0.09004927 0.95497536
[99,] 0.037147425 0.07429485 0.96285257
[100,] 0.085028615 0.17005723 0.91497139
[101,] 0.071221093 0.14244219 0.92877891
[102,] 0.105695966 0.21139193 0.89430403
[103,] 0.165301378 0.33060276 0.83469862
[104,] 0.147113525 0.29422705 0.85288648
[105,] 0.126083968 0.25216794 0.87391603
[106,] 0.107792626 0.21558525 0.89220737
[107,] 0.099122636 0.19824527 0.90087736
[108,] 0.080982234 0.16196447 0.91901777
[109,] 0.136855801 0.27371160 0.86314420
[110,] 0.128705606 0.25741121 0.87129439
[111,] 0.105501233 0.21100247 0.89449877
[112,] 0.088881732 0.17776346 0.91111827
[113,] 0.079796218 0.15959244 0.92020378
[114,] 0.067792322 0.13558464 0.93220768
[115,] 0.101245104 0.20249021 0.89875490
[116,] 0.089458353 0.17891671 0.91054165
[117,] 0.077984716 0.15596943 0.92201528
[118,] 0.064869794 0.12973959 0.93513021
[119,] 0.058981403 0.11796281 0.94101860
[120,] 0.049233524 0.09846705 0.95076648
[121,] 0.040846791 0.08169358 0.95915321
[122,] 0.034369177 0.06873835 0.96563082
[123,] 0.107206492 0.21441298 0.89279351
[124,] 0.085594948 0.17118990 0.91440505
[125,] 0.068413893 0.13682779 0.93158611
[126,] 0.065479838 0.13095968 0.93452016
[127,] 0.061336042 0.12267208 0.93866396
[128,] 0.046012109 0.09202422 0.95398789
[129,] 0.034982803 0.06996561 0.96501720
[130,] 0.034233795 0.06846759 0.96576620
[131,] 0.025861908 0.05172382 0.97413809
[132,] 0.024926621 0.04985324 0.97507338
[133,] 0.018987464 0.03797493 0.98101254
[134,] 0.039545004 0.07909001 0.96045500
[135,] 0.112408794 0.22481759 0.88759121
[136,] 0.084917711 0.16983542 0.91508229
[137,] 0.133621015 0.26724203 0.86637898
[138,] 0.213481381 0.42696276 0.78651862
[139,] 0.198916438 0.39783288 0.80108356
[140,] 0.250181873 0.50036375 0.74981813
[141,] 0.226417790 0.45283558 0.77358221
[142,] 0.207501439 0.41500288 0.79249856
[143,] 0.152780347 0.30556069 0.84721965
[144,] 0.202887693 0.40577539 0.79711231
[145,] 0.144897049 0.28979410 0.85510295
[146,] 0.094570771 0.18914154 0.90542923
[147,] 0.207504712 0.41500942 0.79249529
[148,] 0.130197507 0.26039501 0.86980249
[149,] 0.985657283 0.02868543 0.01434272
> postscript(file="/var/wessaorg/rcomp/tmp/11aw91322070936.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/2638j1322070936.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/3tlhr1322070936.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/4d7jy1322070936.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/5eqe01322070936.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 = 162
Frequency = 1
1 2 3 4 5 6
-0.84737430 1.19566326 -0.86761076 -0.80309113 0.26142850 1.15573972
7 8 9 10 11 12
0.30508886 0.19940008 0.15760813 0.09433411 0.20126849 1.20189130
13 14 15 16 17 18
-1.79748590 0.20313690 1.20375971 0.20438251 0.20500531 0.24804287
19 20 21 22 23 24
0.14235409 1.20687372 0.20749653 -0.79188067 -0.74884311 -0.79063506
25 26 27 28 29 30
1.20998774 -1.78938945 0.21123335 0.21185615 0.21247896 -0.72300141
31 32 33 34 35 36
0.27762139 -0.82806738 0.21497017 0.21559297 0.17380103 0.23832066
37 38 39 40 41 42
-1.93126495 0.17566944 1.21870699 -0.78067020 0.21995260 0.22057540
43 44 45 46 47 48
1.26361296 -0.71428216 0.28634064 -0.71303656 0.11737784 0.22431222
49 50 51 52 53 54
1.22493503 0.18314308 -0.77381936 -0.81561131 0.18501149 -0.66563937
55 56 57 58 59 60
0.07994552 0.22929465 0.22991746 -0.76945974 -0.93904534 -0.76821413
61 62 63 64 65 66
-0.81000608 0.23303148 0.23365428 0.29817391 0.23489989 -0.70058048
67 68 69 70 71 72
-0.72143975 -0.65692012 0.19497635 0.23801390 0.26011878 1.30315634
73 74 75 76 77 78
0.28229707 0.34681670 -0.75887208 0.17785390 1.24237353 -0.75700367
79 80 81 82 83 84
1.30751596 0.24424194 0.30876157 0.28790230 -0.75388965 0.24673315
85 86 87 88 89 90
0.24735596 0.24797876 0.31249839 0.24922437 0.24984717 -2.68563320
91 92 93 94 95 96
1.20867803 0.18781876 0.25233839 0.25296119 0.31748082 0.25420680
97 98 99 100 101 102
-1.74517040 0.25545240 0.25607521 0.25669801 0.25732081 -0.57184798
103 104 105 106 107 108
1.30098117 -0.67691395 0.25981203 -1.78197992 0.26105764 1.26168044
109 110 111 112 113 114
-1.67379993 0.11419971 0.26354885 0.26417165 -0.79910237 0.22300251
115 116 117 118 119 120
1.39383372 -0.79723396 0.22487092 0.26790848 0.33242811 0.26915408
121 122 123 124 125 126
-1.66632629 -0.72960031 0.33491932 0.27164530 0.33616493 -0.72710910
127 128 129 130 131 132
0.27351371 0.27413651 1.33865614 0.23296737 -0.72399508 -0.76578703
133 134 135 136 137 138
0.27725053 0.23545858 0.17218456 1.17280736 -0.65636143 0.28036455
139 140 141 142 143 144
-0.65511582 0.34550698 -1.76018180 -0.71714424 1.21958174 -2.67348388
145 146 147 148 149 150
0.28472417 1.24293222 0.22207295 -0.75582217 -0.71278461 -1.64826498
151 152 153 154 155 156
0.30994307 0.28908380 1.28970660 -0.70967060 -1.64515097 1.24916026
157 158 159 160 161 162
0.22830099 1.31430269 1.35734025 0.29406623 0.25227428 0.29531183
> postscript(file="/var/wessaorg/rcomp/tmp/6qifg1322070936.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.84737430 NA
1 1.19566326 -0.84737430
2 -0.86761076 1.19566326
3 -0.80309113 -0.86761076
4 0.26142850 -0.80309113
5 1.15573972 0.26142850
6 0.30508886 1.15573972
7 0.19940008 0.30508886
8 0.15760813 0.19940008
9 0.09433411 0.15760813
10 0.20126849 0.09433411
11 1.20189130 0.20126849
12 -1.79748590 1.20189130
13 0.20313690 -1.79748590
14 1.20375971 0.20313690
15 0.20438251 1.20375971
16 0.20500531 0.20438251
17 0.24804287 0.20500531
18 0.14235409 0.24804287
19 1.20687372 0.14235409
20 0.20749653 1.20687372
21 -0.79188067 0.20749653
22 -0.74884311 -0.79188067
23 -0.79063506 -0.74884311
24 1.20998774 -0.79063506
25 -1.78938945 1.20998774
26 0.21123335 -1.78938945
27 0.21185615 0.21123335
28 0.21247896 0.21185615
29 -0.72300141 0.21247896
30 0.27762139 -0.72300141
31 -0.82806738 0.27762139
32 0.21497017 -0.82806738
33 0.21559297 0.21497017
34 0.17380103 0.21559297
35 0.23832066 0.17380103
36 -1.93126495 0.23832066
37 0.17566944 -1.93126495
38 1.21870699 0.17566944
39 -0.78067020 1.21870699
40 0.21995260 -0.78067020
41 0.22057540 0.21995260
42 1.26361296 0.22057540
43 -0.71428216 1.26361296
44 0.28634064 -0.71428216
45 -0.71303656 0.28634064
46 0.11737784 -0.71303656
47 0.22431222 0.11737784
48 1.22493503 0.22431222
49 0.18314308 1.22493503
50 -0.77381936 0.18314308
51 -0.81561131 -0.77381936
52 0.18501149 -0.81561131
53 -0.66563937 0.18501149
54 0.07994552 -0.66563937
55 0.22929465 0.07994552
56 0.22991746 0.22929465
57 -0.76945974 0.22991746
58 -0.93904534 -0.76945974
59 -0.76821413 -0.93904534
60 -0.81000608 -0.76821413
61 0.23303148 -0.81000608
62 0.23365428 0.23303148
63 0.29817391 0.23365428
64 0.23489989 0.29817391
65 -0.70058048 0.23489989
66 -0.72143975 -0.70058048
67 -0.65692012 -0.72143975
68 0.19497635 -0.65692012
69 0.23801390 0.19497635
70 0.26011878 0.23801390
71 1.30315634 0.26011878
72 0.28229707 1.30315634
73 0.34681670 0.28229707
74 -0.75887208 0.34681670
75 0.17785390 -0.75887208
76 1.24237353 0.17785390
77 -0.75700367 1.24237353
78 1.30751596 -0.75700367
79 0.24424194 1.30751596
80 0.30876157 0.24424194
81 0.28790230 0.30876157
82 -0.75388965 0.28790230
83 0.24673315 -0.75388965
84 0.24735596 0.24673315
85 0.24797876 0.24735596
86 0.31249839 0.24797876
87 0.24922437 0.31249839
88 0.24984717 0.24922437
89 -2.68563320 0.24984717
90 1.20867803 -2.68563320
91 0.18781876 1.20867803
92 0.25233839 0.18781876
93 0.25296119 0.25233839
94 0.31748082 0.25296119
95 0.25420680 0.31748082
96 -1.74517040 0.25420680
97 0.25545240 -1.74517040
98 0.25607521 0.25545240
99 0.25669801 0.25607521
100 0.25732081 0.25669801
101 -0.57184798 0.25732081
102 1.30098117 -0.57184798
103 -0.67691395 1.30098117
104 0.25981203 -0.67691395
105 -1.78197992 0.25981203
106 0.26105764 -1.78197992
107 1.26168044 0.26105764
108 -1.67379993 1.26168044
109 0.11419971 -1.67379993
110 0.26354885 0.11419971
111 0.26417165 0.26354885
112 -0.79910237 0.26417165
113 0.22300251 -0.79910237
114 1.39383372 0.22300251
115 -0.79723396 1.39383372
116 0.22487092 -0.79723396
117 0.26790848 0.22487092
118 0.33242811 0.26790848
119 0.26915408 0.33242811
120 -1.66632629 0.26915408
121 -0.72960031 -1.66632629
122 0.33491932 -0.72960031
123 0.27164530 0.33491932
124 0.33616493 0.27164530
125 -0.72710910 0.33616493
126 0.27351371 -0.72710910
127 0.27413651 0.27351371
128 1.33865614 0.27413651
129 0.23296737 1.33865614
130 -0.72399508 0.23296737
131 -0.76578703 -0.72399508
132 0.27725053 -0.76578703
133 0.23545858 0.27725053
134 0.17218456 0.23545858
135 1.17280736 0.17218456
136 -0.65636143 1.17280736
137 0.28036455 -0.65636143
138 -0.65511582 0.28036455
139 0.34550698 -0.65511582
140 -1.76018180 0.34550698
141 -0.71714424 -1.76018180
142 1.21958174 -0.71714424
143 -2.67348388 1.21958174
144 0.28472417 -2.67348388
145 1.24293222 0.28472417
146 0.22207295 1.24293222
147 -0.75582217 0.22207295
148 -0.71278461 -0.75582217
149 -1.64826498 -0.71278461
150 0.30994307 -1.64826498
151 0.28908380 0.30994307
152 1.28970660 0.28908380
153 -0.70967060 1.28970660
154 -1.64515097 -0.70967060
155 1.24916026 -1.64515097
156 0.22830099 1.24916026
157 1.31430269 0.22830099
158 1.35734025 1.31430269
159 0.29406623 1.35734025
160 0.25227428 0.29406623
161 0.29531183 0.25227428
162 NA 0.29531183
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.19566326 -0.84737430
[2,] -0.86761076 1.19566326
[3,] -0.80309113 -0.86761076
[4,] 0.26142850 -0.80309113
[5,] 1.15573972 0.26142850
[6,] 0.30508886 1.15573972
[7,] 0.19940008 0.30508886
[8,] 0.15760813 0.19940008
[9,] 0.09433411 0.15760813
[10,] 0.20126849 0.09433411
[11,] 1.20189130 0.20126849
[12,] -1.79748590 1.20189130
[13,] 0.20313690 -1.79748590
[14,] 1.20375971 0.20313690
[15,] 0.20438251 1.20375971
[16,] 0.20500531 0.20438251
[17,] 0.24804287 0.20500531
[18,] 0.14235409 0.24804287
[19,] 1.20687372 0.14235409
[20,] 0.20749653 1.20687372
[21,] -0.79188067 0.20749653
[22,] -0.74884311 -0.79188067
[23,] -0.79063506 -0.74884311
[24,] 1.20998774 -0.79063506
[25,] -1.78938945 1.20998774
[26,] 0.21123335 -1.78938945
[27,] 0.21185615 0.21123335
[28,] 0.21247896 0.21185615
[29,] -0.72300141 0.21247896
[30,] 0.27762139 -0.72300141
[31,] -0.82806738 0.27762139
[32,] 0.21497017 -0.82806738
[33,] 0.21559297 0.21497017
[34,] 0.17380103 0.21559297
[35,] 0.23832066 0.17380103
[36,] -1.93126495 0.23832066
[37,] 0.17566944 -1.93126495
[38,] 1.21870699 0.17566944
[39,] -0.78067020 1.21870699
[40,] 0.21995260 -0.78067020
[41,] 0.22057540 0.21995260
[42,] 1.26361296 0.22057540
[43,] -0.71428216 1.26361296
[44,] 0.28634064 -0.71428216
[45,] -0.71303656 0.28634064
[46,] 0.11737784 -0.71303656
[47,] 0.22431222 0.11737784
[48,] 1.22493503 0.22431222
[49,] 0.18314308 1.22493503
[50,] -0.77381936 0.18314308
[51,] -0.81561131 -0.77381936
[52,] 0.18501149 -0.81561131
[53,] -0.66563937 0.18501149
[54,] 0.07994552 -0.66563937
[55,] 0.22929465 0.07994552
[56,] 0.22991746 0.22929465
[57,] -0.76945974 0.22991746
[58,] -0.93904534 -0.76945974
[59,] -0.76821413 -0.93904534
[60,] -0.81000608 -0.76821413
[61,] 0.23303148 -0.81000608
[62,] 0.23365428 0.23303148
[63,] 0.29817391 0.23365428
[64,] 0.23489989 0.29817391
[65,] -0.70058048 0.23489989
[66,] -0.72143975 -0.70058048
[67,] -0.65692012 -0.72143975
[68,] 0.19497635 -0.65692012
[69,] 0.23801390 0.19497635
[70,] 0.26011878 0.23801390
[71,] 1.30315634 0.26011878
[72,] 0.28229707 1.30315634
[73,] 0.34681670 0.28229707
[74,] -0.75887208 0.34681670
[75,] 0.17785390 -0.75887208
[76,] 1.24237353 0.17785390
[77,] -0.75700367 1.24237353
[78,] 1.30751596 -0.75700367
[79,] 0.24424194 1.30751596
[80,] 0.30876157 0.24424194
[81,] 0.28790230 0.30876157
[82,] -0.75388965 0.28790230
[83,] 0.24673315 -0.75388965
[84,] 0.24735596 0.24673315
[85,] 0.24797876 0.24735596
[86,] 0.31249839 0.24797876
[87,] 0.24922437 0.31249839
[88,] 0.24984717 0.24922437
[89,] -2.68563320 0.24984717
[90,] 1.20867803 -2.68563320
[91,] 0.18781876 1.20867803
[92,] 0.25233839 0.18781876
[93,] 0.25296119 0.25233839
[94,] 0.31748082 0.25296119
[95,] 0.25420680 0.31748082
[96,] -1.74517040 0.25420680
[97,] 0.25545240 -1.74517040
[98,] 0.25607521 0.25545240
[99,] 0.25669801 0.25607521
[100,] 0.25732081 0.25669801
[101,] -0.57184798 0.25732081
[102,] 1.30098117 -0.57184798
[103,] -0.67691395 1.30098117
[104,] 0.25981203 -0.67691395
[105,] -1.78197992 0.25981203
[106,] 0.26105764 -1.78197992
[107,] 1.26168044 0.26105764
[108,] -1.67379993 1.26168044
[109,] 0.11419971 -1.67379993
[110,] 0.26354885 0.11419971
[111,] 0.26417165 0.26354885
[112,] -0.79910237 0.26417165
[113,] 0.22300251 -0.79910237
[114,] 1.39383372 0.22300251
[115,] -0.79723396 1.39383372
[116,] 0.22487092 -0.79723396
[117,] 0.26790848 0.22487092
[118,] 0.33242811 0.26790848
[119,] 0.26915408 0.33242811
[120,] -1.66632629 0.26915408
[121,] -0.72960031 -1.66632629
[122,] 0.33491932 -0.72960031
[123,] 0.27164530 0.33491932
[124,] 0.33616493 0.27164530
[125,] -0.72710910 0.33616493
[126,] 0.27351371 -0.72710910
[127,] 0.27413651 0.27351371
[128,] 1.33865614 0.27413651
[129,] 0.23296737 1.33865614
[130,] -0.72399508 0.23296737
[131,] -0.76578703 -0.72399508
[132,] 0.27725053 -0.76578703
[133,] 0.23545858 0.27725053
[134,] 0.17218456 0.23545858
[135,] 1.17280736 0.17218456
[136,] -0.65636143 1.17280736
[137,] 0.28036455 -0.65636143
[138,] -0.65511582 0.28036455
[139,] 0.34550698 -0.65511582
[140,] -1.76018180 0.34550698
[141,] -0.71714424 -1.76018180
[142,] 1.21958174 -0.71714424
[143,] -2.67348388 1.21958174
[144,] 0.28472417 -2.67348388
[145,] 1.24293222 0.28472417
[146,] 0.22207295 1.24293222
[147,] -0.75582217 0.22207295
[148,] -0.71278461 -0.75582217
[149,] -1.64826498 -0.71278461
[150,] 0.30994307 -1.64826498
[151,] 0.28908380 0.30994307
[152,] 1.28970660 0.28908380
[153,] -0.70967060 1.28970660
[154,] -1.64515097 -0.70967060
[155,] 1.24916026 -1.64515097
[156,] 0.22830099 1.24916026
[157,] 1.31430269 0.22830099
[158,] 1.35734025 1.31430269
[159,] 0.29406623 1.35734025
[160,] 0.25227428 0.29406623
[161,] 0.29531183 0.25227428
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.19566326 -0.84737430
2 -0.86761076 1.19566326
3 -0.80309113 -0.86761076
4 0.26142850 -0.80309113
5 1.15573972 0.26142850
6 0.30508886 1.15573972
7 0.19940008 0.30508886
8 0.15760813 0.19940008
9 0.09433411 0.15760813
10 0.20126849 0.09433411
11 1.20189130 0.20126849
12 -1.79748590 1.20189130
13 0.20313690 -1.79748590
14 1.20375971 0.20313690
15 0.20438251 1.20375971
16 0.20500531 0.20438251
17 0.24804287 0.20500531
18 0.14235409 0.24804287
19 1.20687372 0.14235409
20 0.20749653 1.20687372
21 -0.79188067 0.20749653
22 -0.74884311 -0.79188067
23 -0.79063506 -0.74884311
24 1.20998774 -0.79063506
25 -1.78938945 1.20998774
26 0.21123335 -1.78938945
27 0.21185615 0.21123335
28 0.21247896 0.21185615
29 -0.72300141 0.21247896
30 0.27762139 -0.72300141
31 -0.82806738 0.27762139
32 0.21497017 -0.82806738
33 0.21559297 0.21497017
34 0.17380103 0.21559297
35 0.23832066 0.17380103
36 -1.93126495 0.23832066
37 0.17566944 -1.93126495
38 1.21870699 0.17566944
39 -0.78067020 1.21870699
40 0.21995260 -0.78067020
41 0.22057540 0.21995260
42 1.26361296 0.22057540
43 -0.71428216 1.26361296
44 0.28634064 -0.71428216
45 -0.71303656 0.28634064
46 0.11737784 -0.71303656
47 0.22431222 0.11737784
48 1.22493503 0.22431222
49 0.18314308 1.22493503
50 -0.77381936 0.18314308
51 -0.81561131 -0.77381936
52 0.18501149 -0.81561131
53 -0.66563937 0.18501149
54 0.07994552 -0.66563937
55 0.22929465 0.07994552
56 0.22991746 0.22929465
57 -0.76945974 0.22991746
58 -0.93904534 -0.76945974
59 -0.76821413 -0.93904534
60 -0.81000608 -0.76821413
61 0.23303148 -0.81000608
62 0.23365428 0.23303148
63 0.29817391 0.23365428
64 0.23489989 0.29817391
65 -0.70058048 0.23489989
66 -0.72143975 -0.70058048
67 -0.65692012 -0.72143975
68 0.19497635 -0.65692012
69 0.23801390 0.19497635
70 0.26011878 0.23801390
71 1.30315634 0.26011878
72 0.28229707 1.30315634
73 0.34681670 0.28229707
74 -0.75887208 0.34681670
75 0.17785390 -0.75887208
76 1.24237353 0.17785390
77 -0.75700367 1.24237353
78 1.30751596 -0.75700367
79 0.24424194 1.30751596
80 0.30876157 0.24424194
81 0.28790230 0.30876157
82 -0.75388965 0.28790230
83 0.24673315 -0.75388965
84 0.24735596 0.24673315
85 0.24797876 0.24735596
86 0.31249839 0.24797876
87 0.24922437 0.31249839
88 0.24984717 0.24922437
89 -2.68563320 0.24984717
90 1.20867803 -2.68563320
91 0.18781876 1.20867803
92 0.25233839 0.18781876
93 0.25296119 0.25233839
94 0.31748082 0.25296119
95 0.25420680 0.31748082
96 -1.74517040 0.25420680
97 0.25545240 -1.74517040
98 0.25607521 0.25545240
99 0.25669801 0.25607521
100 0.25732081 0.25669801
101 -0.57184798 0.25732081
102 1.30098117 -0.57184798
103 -0.67691395 1.30098117
104 0.25981203 -0.67691395
105 -1.78197992 0.25981203
106 0.26105764 -1.78197992
107 1.26168044 0.26105764
108 -1.67379993 1.26168044
109 0.11419971 -1.67379993
110 0.26354885 0.11419971
111 0.26417165 0.26354885
112 -0.79910237 0.26417165
113 0.22300251 -0.79910237
114 1.39383372 0.22300251
115 -0.79723396 1.39383372
116 0.22487092 -0.79723396
117 0.26790848 0.22487092
118 0.33242811 0.26790848
119 0.26915408 0.33242811
120 -1.66632629 0.26915408
121 -0.72960031 -1.66632629
122 0.33491932 -0.72960031
123 0.27164530 0.33491932
124 0.33616493 0.27164530
125 -0.72710910 0.33616493
126 0.27351371 -0.72710910
127 0.27413651 0.27351371
128 1.33865614 0.27413651
129 0.23296737 1.33865614
130 -0.72399508 0.23296737
131 -0.76578703 -0.72399508
132 0.27725053 -0.76578703
133 0.23545858 0.27725053
134 0.17218456 0.23545858
135 1.17280736 0.17218456
136 -0.65636143 1.17280736
137 0.28036455 -0.65636143
138 -0.65511582 0.28036455
139 0.34550698 -0.65511582
140 -1.76018180 0.34550698
141 -0.71714424 -1.76018180
142 1.21958174 -0.71714424
143 -2.67348388 1.21958174
144 0.28472417 -2.67348388
145 1.24293222 0.28472417
146 0.22207295 1.24293222
147 -0.75582217 0.22207295
148 -0.71278461 -0.75582217
149 -1.64826498 -0.71278461
150 0.30994307 -1.64826498
151 0.28908380 0.30994307
152 1.28970660 0.28908380
153 -0.70967060 1.28970660
154 -1.64515097 -0.70967060
155 1.24916026 -1.64515097
156 0.22830099 1.24916026
157 1.31430269 0.22830099
158 1.35734025 1.31430269
159 0.29406623 1.35734025
160 0.25227428 0.29406623
161 0.29531183 0.25227428
> 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/7awh41322070936.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/8n87p1322070936.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/9j3yp1322070936.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/1067901322070936.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/11sqs61322070936.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/12xb5c1322070936.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/132jds1322070936.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/141s8c1322070936.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/15oqhc1322070936.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/16yo1h1322070936.tab")
+ }
>
> try(system("convert tmp/11aw91322070936.ps tmp/11aw91322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/2638j1322070936.ps tmp/2638j1322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/3tlhr1322070936.ps tmp/3tlhr1322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/4d7jy1322070936.ps tmp/4d7jy1322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/5eqe01322070936.ps tmp/5eqe01322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/6qifg1322070936.ps tmp/6qifg1322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/7awh41322070936.ps tmp/7awh41322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/8n87p1322070936.ps tmp/8n87p1322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/9j3yp1322070936.ps tmp/9j3yp1322070936.png",intern=TRUE))
character(0)
> try(system("convert tmp/1067901322070936.ps tmp/1067901322070936.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.631 0.553 5.202