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(47
+ ,46
+ ,26
+ ,99
+ ,24
+ ,48
+ ,20
+ ,77
+ ,31
+ ,37
+ ,24
+ ,90
+ ,42
+ ,75
+ ,25
+ ,96
+ ,24
+ ,31
+ ,15
+ ,41
+ ,10
+ ,18
+ ,16
+ ,64
+ ,85
+ ,79
+ ,20
+ ,76
+ ,9
+ ,16
+ ,18
+ ,67
+ ,32
+ ,38
+ ,19
+ ,72
+ ,36
+ ,24
+ ,20
+ ,75
+ ,45
+ ,65
+ ,30
+ ,113
+ ,36
+ ,74
+ ,37
+ ,139
+ ,28
+ ,43
+ ,23
+ ,76
+ ,54
+ ,42
+ ,36
+ ,123
+ ,39
+ ,55
+ ,29
+ ,110
+ ,70
+ ,121
+ ,35
+ ,133
+ ,50
+ ,42
+ ,24
+ ,92
+ ,55
+ ,102
+ ,22
+ ,83
+ ,32
+ ,36
+ ,19
+ ,72
+ ,44
+ ,50
+ ,30
+ ,115
+ ,46
+ ,48
+ ,27
+ ,99
+ ,80
+ ,56
+ ,26
+ ,92
+ ,25
+ ,19
+ ,15
+ ,56
+ ,30
+ ,32
+ ,30
+ ,120
+ ,41
+ ,77
+ ,28
+ ,107
+ ,40
+ ,90
+ ,24
+ ,90
+ ,45
+ ,81
+ ,21
+ ,78
+ ,45
+ ,55
+ ,27
+ ,103
+ ,30
+ ,34
+ ,21
+ ,81
+ ,52
+ ,38
+ ,30
+ ,114
+ ,53
+ ,53
+ ,30
+ ,115
+ ,36
+ ,48
+ ,33
+ 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,15
+ ,5
+ ,5
+ ,1
+ ,4
+ ,20
+ ,27
+ ,23
+ ,82
+ ,0
+ ,2
+ ,0
+ ,0
+ ,29
+ ,33
+ ,16
+ ,54)
+ ,dim=c(4
+ ,164)
+ ,dimnames=list(c('Y'
+ ,'X1'
+ ,'X2'
+ ,'X3')
+ ,1:164))
> y <- array(NA,dim=c(4,164),dimnames=list(c('Y','X1','X2','X3'),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 = '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
X2 Y X1 X3
1 26 47 46 99
2 20 24 48 77
3 24 31 37 90
4 25 42 75 96
5 15 24 31 41
6 16 10 18 64
7 20 85 79 76
8 18 9 16 67
9 19 32 38 72
10 20 36 24 75
11 30 45 65 113
12 37 36 74 139
13 23 28 43 76
14 36 54 42 123
15 29 39 55 110
16 35 70 121 133
17 24 50 42 92
18 22 55 102 83
19 19 32 36 72
20 30 44 50 115
21 27 46 48 99
22 26 80 56 92
23 15 25 19 56
24 30 30 32 120
25 28 41 77 107
26 24 40 90 90
27 21 45 81 78
28 27 45 55 103
29 21 30 34 81
30 30 52 38 114
31 30 53 53 115
32 33 36 48 118
33 30 57 63 113
34 20 17 25 75
35 27 68 56 103
36 25 46 37 93
37 30 73 83 114
38 20 34 50 76
39 8 22 26 27
40 24 58 108 92
41 25 62 55 96
42 25 32 41 92
43 21 38 49 76
44 21 23 31 79
45 21 26 49 57
46 26 85 96 99
47 26 22 42 82
48 30 44 55 113
49 34 62 70 129
50 30 36 39 110
51 18 36 53 78
52 4 7 24 12
53 31 72 209 114
54 18 18 17 67
55 14 27 58 52
56 20 48 27 76
57 36 50 58 138
58 24 55 114 92
59 26 59 75 93
60 22 39 51 83
61 31 68 86 118
62 21 57 77 77
63 31 40 62 122
64 26 47 60 99
65 24 39 39 92
66 15 32 35 58
67 19 32 86 73
68 28 40 102 103
69 24 42 49 92
70 18 26 35 69
71 25 33 33 95
72 20 19 28 76
73 25 35 44 95
74 24 41 37 92
75 23 27 33 88
76 25 53 45 95
77 20 55 57 76
78 23 29 58 87
79 22 25 36 84
80 25 33 42 95
81 18 27 30 69
82 30 76 67 115
83 22 37 53 83
84 25 38 59 47
85 8 22 25 28
86 21 30 39 79
87 22 27 36 83
88 24 63 114 92
89 30 48 54 98
90 27 33 70 103
91 24 37 51 89
92 25 42 49 95
93 21 31 42 78
94 24 47 51 92
95 24 52 51 92
96 20 36 27 76
97 20 40 29 67
98 24 53 54 92
99 40 56 92 151
100 22 69 72 83
101 31 43 63 118
102 26 51 41 98
103 20 30 111 76
104 19 12 14 71
105 15 35 45 57
106 21 36 91 79
107 22 41 29 83
108 24 52 64 92
109 19 21 32 75
110 24 26 65 95
111 23 49 42 88
112 27 39 55 99
113 1 6 10 0
114 24 35 53 91
115 11 17 25 32
116 27 25 33 101
117 22 71 66 84
118 0 6 16 0
119 17 47 35 60
120 8 9 19 25
121 24 52 76 90
122 31 38 35 115
123 24 21 46 92
124 20 21 29 71
125 8 11 34 27
126 22 25 25 83
127 33 54 48 126
128 33 38 38 125
129 31 68 50 119
130 33 56 65 127
131 35 71 72 133
132 21 39 23 79
133 20 21 29 76
134 24 53 194 92
135 29 78 114 109
136 20 14 15 76
137 27 70 86 100
138 24 29 50 87
139 26 47 33 97
140 26 36 50 95
141 12 21 72 48
142 21 69 81 80
143 24 42 54 91
144 21 48 63 79
145 30 55 69 114
146 32 19 39 120
147 24 39 49 89
148 29 51 67 111
149 0 0 0 0
150 0 4 10 0
151 0 0 1 0
152 0 0 2 0
153 0 0 0 0
154 0 0 0 0
155 20 38 58 74
156 27 51 72 107
157 0 0 0 0
158 0 0 4 0
159 0 2 5 0
160 5 13 20 15
161 1 5 5 4
162 23 20 27 82
163 0 0 2 0
164 16 29 33 54
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Y X1 X3
0.843098 0.005805 0.000767 0.254588
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.9506 -0.5855 -0.2687 0.0967 11.9254
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.843098 0.287200 2.936 0.00382 **
Y 0.005805 0.009457 0.614 0.54021
X1 0.000767 0.004946 0.155 0.87695
X3 0.254588 0.004702 54.143 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.383 on 160 degrees of freedom
Multiple R-squared: 0.9753, Adjusted R-squared: 0.9748
F-statistic: 2105 on 3 and 160 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.789624160 4.207517e-01 2.103758e-01
[2,] 0.667172841 6.656543e-01 3.328272e-01
[3,] 0.550201310 8.995974e-01 4.497987e-01
[4,] 0.419042834 8.380857e-01 5.809572e-01
[5,] 0.442365435 8.847309e-01 5.576346e-01
[6,] 0.469732653 9.394653e-01 5.302673e-01
[7,] 0.621919259 7.561615e-01 3.780807e-01
[8,] 0.902872282 1.942554e-01 9.712772e-02
[9,] 0.865071569 2.698569e-01 1.349284e-01
[10,] 0.817081011 3.658380e-01 1.829190e-01
[11,] 0.794949308 4.101014e-01 2.050507e-01
[12,] 0.734601492 5.307970e-01 2.653985e-01
[13,] 0.684392808 6.312144e-01 3.156072e-01
[14,] 0.634803130 7.303937e-01 3.651969e-01
[15,] 0.568164893 8.636702e-01 4.318351e-01
[16,] 0.516782431 9.664351e-01 4.832176e-01
[17,] 0.461870521 9.237410e-01 5.381295e-01
[18,] 0.516036199 9.679276e-01 4.839638e-01
[19,] 0.450241454 9.004829e-01 5.497585e-01
[20,] 0.385658203 7.713164e-01 6.143418e-01
[21,] 0.323917777 6.478356e-01 6.760822e-01
[22,] 0.274127242 5.482545e-01 7.258728e-01
[23,] 0.241138521 4.822770e-01 7.588615e-01
[24,] 0.198703806 3.974076e-01 8.012962e-01
[25,] 0.164160000 3.283200e-01 8.358400e-01
[26,] 0.206074714 4.121494e-01 7.939253e-01
[27,] 0.165676169 3.313523e-01 8.343238e-01
[28,] 0.131351345 2.627027e-01 8.686487e-01
[29,] 0.110540267 2.210805e-01 8.894597e-01
[30,] 0.085173424 1.703468e-01 9.148266e-01
[31,] 0.066054484 1.321090e-01 9.339455e-01
[32,] 0.051481791 1.029636e-01 9.485182e-01
[33,] 0.038005341 7.601068e-02 9.619947e-01
[34,] 0.028853460 5.770692e-02 9.711465e-01
[35,] 0.023504703 4.700941e-02 9.764953e-01
[36,] 0.017424945 3.484989e-02 9.825751e-01
[37,] 0.012911266 2.582253e-02 9.870887e-01
[38,] 0.009076570 1.815314e-02 9.909234e-01
[39,] 0.348648968 6.972979e-01 6.513510e-01
[40,] 0.308657483 6.173150e-01 6.913425e-01
[41,] 0.641383799 7.172324e-01 3.586162e-01
[42,] 0.593457978 8.130840e-01 4.065420e-01
[43,] 0.544456337 9.110873e-01 4.555437e-01
[44,] 0.512949774 9.741005e-01 4.870502e-01
[45,] 0.708815352 5.823693e-01 2.911846e-01
[46,] 0.675065198 6.498696e-01 3.249348e-01
[47,] 0.641053316 7.178934e-01 3.589467e-01
[48,] 0.598472789 8.030544e-01 4.015272e-01
[49,] 0.559535088 8.809298e-01 4.404649e-01
[50,] 0.518899798 9.622004e-01 4.811002e-01
[51,] 0.472609276 9.452186e-01 5.273907e-01
[52,] 0.437959220 8.759184e-01 5.620408e-01
[53,] 0.419278448 8.385569e-01 5.807216e-01
[54,] 0.376476427 7.529529e-01 6.235236e-01
[55,] 0.334032056 6.680641e-01 6.659679e-01
[56,] 0.292292033 5.845841e-01 7.077080e-01
[57,] 0.282021010 5.640420e-01 7.179790e-01
[58,] 0.246599213 4.931984e-01 7.534008e-01
[59,] 0.217236416 4.344728e-01 7.827636e-01
[60,] 0.201160591 4.023212e-01 7.988394e-01
[61,] 0.180736320 3.614726e-01 8.192637e-01
[62,] 0.156825131 3.136503e-01 8.431749e-01
[63,] 0.135001929 2.700039e-01 8.649981e-01
[64,] 0.117616649 2.352333e-01 8.823834e-01
[65,] 0.097216523 1.944330e-01 9.027835e-01
[66,] 0.080752890 1.615058e-01 9.192471e-01
[67,] 0.065503723 1.310074e-01 9.344963e-01
[68,] 0.053970631 1.079413e-01 9.460294e-01
[69,] 0.043790547 8.758109e-02 9.562095e-01
[70,] 0.034700222 6.940044e-02 9.652998e-01
[71,] 0.028027713 5.605543e-02 9.719723e-01
[72,] 0.021661858 4.332372e-02 9.783381e-01
[73,] 0.016912078 3.382416e-02 9.830879e-01
[74,] 0.012790827 2.558165e-02 9.872092e-01
[75,] 0.010153874 2.030775e-02 9.898461e-01
[76,] 0.007891680 1.578336e-02 9.921083e-01
[77,] 0.005798303 1.159661e-02 9.942017e-01
[78,] 1.000000000 1.738178e-11 8.690891e-12
[79,] 1.000000000 3.329723e-11 1.664862e-11
[80,] 1.000000000 7.331415e-11 3.665707e-11
[81,] 1.000000000 1.592644e-10 7.963219e-11
[82,] 1.000000000 2.999933e-10 1.499967e-10
[83,] 1.000000000 2.626577e-15 1.313289e-15
[84,] 1.000000000 6.776426e-15 3.388213e-15
[85,] 1.000000000 1.620331e-14 8.101655e-15
[86,] 1.000000000 4.061055e-14 2.030528e-14
[87,] 1.000000000 1.020993e-13 5.104965e-14
[88,] 1.000000000 2.127536e-13 1.063768e-13
[89,] 1.000000000 4.302355e-13 2.151177e-13
[90,] 1.000000000 9.509307e-13 4.754653e-13
[91,] 1.000000000 4.637774e-14 2.318887e-14
[92,] 1.000000000 9.939445e-14 4.969722e-14
[93,] 1.000000000 2.332904e-13 1.166452e-13
[94,] 1.000000000 5.934047e-13 2.967023e-13
[95,] 1.000000000 1.495632e-12 7.478159e-13
[96,] 1.000000000 3.857138e-12 1.928569e-12
[97,] 1.000000000 9.062936e-12 4.531468e-12
[98,] 1.000000000 2.273841e-11 1.136921e-11
[99,] 1.000000000 4.813532e-11 2.406766e-11
[100,] 1.000000000 1.138817e-10 5.694086e-11
[101,] 1.000000000 2.683483e-10 1.341741e-10
[102,] 1.000000000 5.374872e-10 2.687436e-10
[103,] 1.000000000 4.721775e-10 2.360888e-10
[104,] 1.000000000 2.765681e-10 1.382840e-10
[105,] 1.000000000 5.470338e-10 2.735169e-10
[106,] 1.000000000 8.736086e-10 4.368043e-10
[107,] 0.999999999 1.463832e-09 7.319160e-10
[108,] 0.999999998 3.362005e-09 1.681003e-09
[109,] 1.000000000 4.135156e-11 2.067578e-11
[110,] 1.000000000 1.105637e-10 5.528183e-11
[111,] 1.000000000 2.565020e-10 1.282510e-10
[112,] 1.000000000 5.049449e-10 2.524725e-10
[113,] 1.000000000 4.555017e-10 2.277509e-10
[114,] 1.000000000 2.394540e-10 1.197270e-10
[115,] 1.000000000 6.307120e-10 3.153560e-10
[116,] 0.999999999 1.325816e-09 6.629082e-10
[117,] 0.999999999 2.544839e-09 1.272420e-09
[118,] 0.999999999 1.725740e-09 8.628700e-10
[119,] 0.999999999 2.358488e-09 1.179244e-09
[120,] 0.999999997 6.406034e-09 3.203017e-09
[121,] 0.999999993 1.380709e-08 6.903545e-09
[122,] 0.999999983 3.390730e-08 1.695365e-08
[123,] 0.999999972 5.588833e-08 2.794417e-08
[124,] 0.999999966 6.847827e-08 3.423913e-08
[125,] 0.999999928 1.443162e-07 7.215808e-08
[126,] 0.999999822 3.552412e-07 1.776206e-07
[127,] 0.999999616 7.688782e-07 3.844391e-07
[128,] 0.999999277 1.445191e-06 7.225953e-07
[129,] 0.999998403 3.194561e-06 1.597281e-06
[130,] 0.999997497 5.006545e-06 2.503273e-06
[131,] 0.999996044 7.911936e-06 3.955968e-06
[132,] 0.999995751 8.498091e-06 4.249045e-06
[133,] 0.999991150 1.769934e-05 8.849671e-06
[134,] 0.999986662 2.667698e-05 1.333849e-05
[135,] 0.999978928 4.214425e-05 2.107212e-05
[136,] 0.999947598 1.048037e-04 5.240186e-05
[137,] 0.999883810 2.323809e-04 1.161905e-04
[138,] 0.999736097 5.278051e-04 2.639025e-04
[139,] 0.999512667 9.746663e-04 4.873332e-04
[140,] 0.998895187 2.209625e-03 1.104813e-03
[141,] 0.997534360 4.931281e-03 2.465640e-03
[142,] 0.996984162 6.031675e-03 3.015838e-03
[143,] 0.994065758 1.186848e-02 5.934242e-03
[144,] 0.988251970 2.349606e-02 1.174803e-02
[145,] 0.976970228 4.605954e-02 2.302977e-02
[146,] 0.955593450 8.881310e-02 4.440655e-02
[147,] 0.922943693 1.541126e-01 7.705631e-02
[148,] 0.873195013 2.536100e-01 1.268050e-01
[149,] 0.883181960 2.336361e-01 1.168180e-01
[150,] 0.999776246 4.475078e-04 2.237539e-04
[151,] 0.999546955 9.060893e-04 4.530446e-04
> postscript(file="/var/wessaorg/rcomp/tmp/1z8r31321906567.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/2jhwj1321906567.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/3l83d1321906567.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/4ue491321906567.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/5gwc11321906567.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
-0.3554257875 -0.6225112499 0.0356473320 -0.5848808272 3.5556978144
6 7 8 9 10
-1.2085883156 -0.7457962493 0.0349864078 -0.3883396196 -0.1645849516
11 12 13 14 15
0.0773779218 0.5034290917 2.6126924895 3.4968951374 -0.1163587062
16 17 18 19 20
-0.2024570480 -0.5876559138 -0.3714085592 -0.3868055906 -0.4144881157
21 22 23 24 25
0.6488450294 1.2274605060 -0.2597236148 -1.5923542643 -0.3810785657
26 27 28 29 30
-0.0572480500 -0.0243125431 -0.3690714282 -0.6649543242 -0.1971346583
31 32 33 34 35
-0.4690327723 1.8697205291 0.0092538000 -0.0550598939 -0.5033498986
36 37 38 39 40
0.1848104919 -0.3535520751 -0.4275056875 0.1353752856 -0.6847176384
41 42 43 44 45
-0.6856374552 0.5175983271 0.5500419434 -0.1128432584 5.4568730536
46 47 48 49 50
-0.6143606572 4.1207602765 0.0908529128 -0.0985483390 0.9133280636
51 52 53 54 55
-2.9505925238 0.0428027606 0.5556089430 -0.0180242199 -0.2828946704
56 57 58 59 60
-0.4911321965 -0.3109784684 -0.6719051877 1.0802009439 -0.2394132849
61 62 63 64 65
-0.3451810911 0.1636854145 -1.1825892595 -0.3661639906 -0.5215015653
66 67 68 69 70
-0.8218058692 -0.6797443664 0.6239031195 -0.5465862481 -0.5874453492
71 72 73 74 75
-0.2458345543 -0.3235586797 -0.2658814057 -0.5315772281 -0.4288891254
76 77 78 79 80
-0.3711356465 -0.5547765530 -0.2050861294 -0.4012282752 -0.2527376848
81 82 83 84 85
-0.5894151226 -0.6132824313 -0.2293376221 11.9254252626 -0.1184457504
86 87 88 89 90
-0.1596132957 -0.1582499165 -0.7183439550 3.8872213010 -0.3109184949
91 92 93 94 95
0.2446681039 -0.3103503995 0.0868688653 -0.5771445066 -0.6061687361
96 97 98 99 100
-0.4214740456 1.8450649961 -0.6142746256 0.3184693065 -0.4296659667
101 102 103 104 105
-0.1824186098 -0.1202220481 -0.4510741887 0.0007536971 -0.5923025015
106 107 108 109 110
-0.2343271255 -0.2341486576 -0.6161399247 -1.0836483791 -1.2297450971
111 112 113 114 115
-0.5634988659 0.6841098492 0.1144024154 -0.2544323342 1.8922262772
116 117 118 119 120
0.2730759100 -0.6912616220 -0.8901996716 0.5819453412 0.7253834849
121 122 123 124 125
-0.1161679978 0.6318461774 -0.4223834405 0.9370048664 0.1930924745
126 127 128 129 130
-0.1382030651 -0.2714711011 0.0836646289 -0.5721566194 -0.5507080900
131 132 133 134 135
-0.1706781831 -0.1995846768 -0.3359353861 -0.7216566564 -0.1334135019
136 137 138 139 140
-0.2845632616 0.2257941259 0.8010499867 0.1637215021 0.7237116614
141 142 143 144 145
-1.2404515961 -0.6728049458 -0.2958332701 -0.2825088702 -0.2383266458
146 147 148 149 150
0.4661299391 0.2345924411 -0.4498090816 -0.8430983641 -0.8739878927
151 152 153 154 155
-0.8438653786 -0.8446323931 -0.8430983641 -0.8430983641 0.0523149138
156 157 158 159 160
-1.4352919522 -0.8430983641 -0.8461664221 -0.8585431284 0.2472775917
161 162 163 164
-0.8943098681 1.1438751859 -0.8446323931 1.2154948995
> postscript(file="/var/wessaorg/rcomp/tmp/6088o1321906567.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 -0.3554257875 NA
1 -0.6225112499 -0.3554257875
2 0.0356473320 -0.6225112499
3 -0.5848808272 0.0356473320
4 3.5556978144 -0.5848808272
5 -1.2085883156 3.5556978144
6 -0.7457962493 -1.2085883156
7 0.0349864078 -0.7457962493
8 -0.3883396196 0.0349864078
9 -0.1645849516 -0.3883396196
10 0.0773779218 -0.1645849516
11 0.5034290917 0.0773779218
12 2.6126924895 0.5034290917
13 3.4968951374 2.6126924895
14 -0.1163587062 3.4968951374
15 -0.2024570480 -0.1163587062
16 -0.5876559138 -0.2024570480
17 -0.3714085592 -0.5876559138
18 -0.3868055906 -0.3714085592
19 -0.4144881157 -0.3868055906
20 0.6488450294 -0.4144881157
21 1.2274605060 0.6488450294
22 -0.2597236148 1.2274605060
23 -1.5923542643 -0.2597236148
24 -0.3810785657 -1.5923542643
25 -0.0572480500 -0.3810785657
26 -0.0243125431 -0.0572480500
27 -0.3690714282 -0.0243125431
28 -0.6649543242 -0.3690714282
29 -0.1971346583 -0.6649543242
30 -0.4690327723 -0.1971346583
31 1.8697205291 -0.4690327723
32 0.0092538000 1.8697205291
33 -0.0550598939 0.0092538000
34 -0.5033498986 -0.0550598939
35 0.1848104919 -0.5033498986
36 -0.3535520751 0.1848104919
37 -0.4275056875 -0.3535520751
38 0.1353752856 -0.4275056875
39 -0.6847176384 0.1353752856
40 -0.6856374552 -0.6847176384
41 0.5175983271 -0.6856374552
42 0.5500419434 0.5175983271
43 -0.1128432584 0.5500419434
44 5.4568730536 -0.1128432584
45 -0.6143606572 5.4568730536
46 4.1207602765 -0.6143606572
47 0.0908529128 4.1207602765
48 -0.0985483390 0.0908529128
49 0.9133280636 -0.0985483390
50 -2.9505925238 0.9133280636
51 0.0428027606 -2.9505925238
52 0.5556089430 0.0428027606
53 -0.0180242199 0.5556089430
54 -0.2828946704 -0.0180242199
55 -0.4911321965 -0.2828946704
56 -0.3109784684 -0.4911321965
57 -0.6719051877 -0.3109784684
58 1.0802009439 -0.6719051877
59 -0.2394132849 1.0802009439
60 -0.3451810911 -0.2394132849
61 0.1636854145 -0.3451810911
62 -1.1825892595 0.1636854145
63 -0.3661639906 -1.1825892595
64 -0.5215015653 -0.3661639906
65 -0.8218058692 -0.5215015653
66 -0.6797443664 -0.8218058692
67 0.6239031195 -0.6797443664
68 -0.5465862481 0.6239031195
69 -0.5874453492 -0.5465862481
70 -0.2458345543 -0.5874453492
71 -0.3235586797 -0.2458345543
72 -0.2658814057 -0.3235586797
73 -0.5315772281 -0.2658814057
74 -0.4288891254 -0.5315772281
75 -0.3711356465 -0.4288891254
76 -0.5547765530 -0.3711356465
77 -0.2050861294 -0.5547765530
78 -0.4012282752 -0.2050861294
79 -0.2527376848 -0.4012282752
80 -0.5894151226 -0.2527376848
81 -0.6132824313 -0.5894151226
82 -0.2293376221 -0.6132824313
83 11.9254252626 -0.2293376221
84 -0.1184457504 11.9254252626
85 -0.1596132957 -0.1184457504
86 -0.1582499165 -0.1596132957
87 -0.7183439550 -0.1582499165
88 3.8872213010 -0.7183439550
89 -0.3109184949 3.8872213010
90 0.2446681039 -0.3109184949
91 -0.3103503995 0.2446681039
92 0.0868688653 -0.3103503995
93 -0.5771445066 0.0868688653
94 -0.6061687361 -0.5771445066
95 -0.4214740456 -0.6061687361
96 1.8450649961 -0.4214740456
97 -0.6142746256 1.8450649961
98 0.3184693065 -0.6142746256
99 -0.4296659667 0.3184693065
100 -0.1824186098 -0.4296659667
101 -0.1202220481 -0.1824186098
102 -0.4510741887 -0.1202220481
103 0.0007536971 -0.4510741887
104 -0.5923025015 0.0007536971
105 -0.2343271255 -0.5923025015
106 -0.2341486576 -0.2343271255
107 -0.6161399247 -0.2341486576
108 -1.0836483791 -0.6161399247
109 -1.2297450971 -1.0836483791
110 -0.5634988659 -1.2297450971
111 0.6841098492 -0.5634988659
112 0.1144024154 0.6841098492
113 -0.2544323342 0.1144024154
114 1.8922262772 -0.2544323342
115 0.2730759100 1.8922262772
116 -0.6912616220 0.2730759100
117 -0.8901996716 -0.6912616220
118 0.5819453412 -0.8901996716
119 0.7253834849 0.5819453412
120 -0.1161679978 0.7253834849
121 0.6318461774 -0.1161679978
122 -0.4223834405 0.6318461774
123 0.9370048664 -0.4223834405
124 0.1930924745 0.9370048664
125 -0.1382030651 0.1930924745
126 -0.2714711011 -0.1382030651
127 0.0836646289 -0.2714711011
128 -0.5721566194 0.0836646289
129 -0.5507080900 -0.5721566194
130 -0.1706781831 -0.5507080900
131 -0.1995846768 -0.1706781831
132 -0.3359353861 -0.1995846768
133 -0.7216566564 -0.3359353861
134 -0.1334135019 -0.7216566564
135 -0.2845632616 -0.1334135019
136 0.2257941259 -0.2845632616
137 0.8010499867 0.2257941259
138 0.1637215021 0.8010499867
139 0.7237116614 0.1637215021
140 -1.2404515961 0.7237116614
141 -0.6728049458 -1.2404515961
142 -0.2958332701 -0.6728049458
143 -0.2825088702 -0.2958332701
144 -0.2383266458 -0.2825088702
145 0.4661299391 -0.2383266458
146 0.2345924411 0.4661299391
147 -0.4498090816 0.2345924411
148 -0.8430983641 -0.4498090816
149 -0.8739878927 -0.8430983641
150 -0.8438653786 -0.8739878927
151 -0.8446323931 -0.8438653786
152 -0.8430983641 -0.8446323931
153 -0.8430983641 -0.8430983641
154 0.0523149138 -0.8430983641
155 -1.4352919522 0.0523149138
156 -0.8430983641 -1.4352919522
157 -0.8461664221 -0.8430983641
158 -0.8585431284 -0.8461664221
159 0.2472775917 -0.8585431284
160 -0.8943098681 0.2472775917
161 1.1438751859 -0.8943098681
162 -0.8446323931 1.1438751859
163 1.2154948995 -0.8446323931
164 NA 1.2154948995
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.6225112499 -0.3554257875
[2,] 0.0356473320 -0.6225112499
[3,] -0.5848808272 0.0356473320
[4,] 3.5556978144 -0.5848808272
[5,] -1.2085883156 3.5556978144
[6,] -0.7457962493 -1.2085883156
[7,] 0.0349864078 -0.7457962493
[8,] -0.3883396196 0.0349864078
[9,] -0.1645849516 -0.3883396196
[10,] 0.0773779218 -0.1645849516
[11,] 0.5034290917 0.0773779218
[12,] 2.6126924895 0.5034290917
[13,] 3.4968951374 2.6126924895
[14,] -0.1163587062 3.4968951374
[15,] -0.2024570480 -0.1163587062
[16,] -0.5876559138 -0.2024570480
[17,] -0.3714085592 -0.5876559138
[18,] -0.3868055906 -0.3714085592
[19,] -0.4144881157 -0.3868055906
[20,] 0.6488450294 -0.4144881157
[21,] 1.2274605060 0.6488450294
[22,] -0.2597236148 1.2274605060
[23,] -1.5923542643 -0.2597236148
[24,] -0.3810785657 -1.5923542643
[25,] -0.0572480500 -0.3810785657
[26,] -0.0243125431 -0.0572480500
[27,] -0.3690714282 -0.0243125431
[28,] -0.6649543242 -0.3690714282
[29,] -0.1971346583 -0.6649543242
[30,] -0.4690327723 -0.1971346583
[31,] 1.8697205291 -0.4690327723
[32,] 0.0092538000 1.8697205291
[33,] -0.0550598939 0.0092538000
[34,] -0.5033498986 -0.0550598939
[35,] 0.1848104919 -0.5033498986
[36,] -0.3535520751 0.1848104919
[37,] -0.4275056875 -0.3535520751
[38,] 0.1353752856 -0.4275056875
[39,] -0.6847176384 0.1353752856
[40,] -0.6856374552 -0.6847176384
[41,] 0.5175983271 -0.6856374552
[42,] 0.5500419434 0.5175983271
[43,] -0.1128432584 0.5500419434
[44,] 5.4568730536 -0.1128432584
[45,] -0.6143606572 5.4568730536
[46,] 4.1207602765 -0.6143606572
[47,] 0.0908529128 4.1207602765
[48,] -0.0985483390 0.0908529128
[49,] 0.9133280636 -0.0985483390
[50,] -2.9505925238 0.9133280636
[51,] 0.0428027606 -2.9505925238
[52,] 0.5556089430 0.0428027606
[53,] -0.0180242199 0.5556089430
[54,] -0.2828946704 -0.0180242199
[55,] -0.4911321965 -0.2828946704
[56,] -0.3109784684 -0.4911321965
[57,] -0.6719051877 -0.3109784684
[58,] 1.0802009439 -0.6719051877
[59,] -0.2394132849 1.0802009439
[60,] -0.3451810911 -0.2394132849
[61,] 0.1636854145 -0.3451810911
[62,] -1.1825892595 0.1636854145
[63,] -0.3661639906 -1.1825892595
[64,] -0.5215015653 -0.3661639906
[65,] -0.8218058692 -0.5215015653
[66,] -0.6797443664 -0.8218058692
[67,] 0.6239031195 -0.6797443664
[68,] -0.5465862481 0.6239031195
[69,] -0.5874453492 -0.5465862481
[70,] -0.2458345543 -0.5874453492
[71,] -0.3235586797 -0.2458345543
[72,] -0.2658814057 -0.3235586797
[73,] -0.5315772281 -0.2658814057
[74,] -0.4288891254 -0.5315772281
[75,] -0.3711356465 -0.4288891254
[76,] -0.5547765530 -0.3711356465
[77,] -0.2050861294 -0.5547765530
[78,] -0.4012282752 -0.2050861294
[79,] -0.2527376848 -0.4012282752
[80,] -0.5894151226 -0.2527376848
[81,] -0.6132824313 -0.5894151226
[82,] -0.2293376221 -0.6132824313
[83,] 11.9254252626 -0.2293376221
[84,] -0.1184457504 11.9254252626
[85,] -0.1596132957 -0.1184457504
[86,] -0.1582499165 -0.1596132957
[87,] -0.7183439550 -0.1582499165
[88,] 3.8872213010 -0.7183439550
[89,] -0.3109184949 3.8872213010
[90,] 0.2446681039 -0.3109184949
[91,] -0.3103503995 0.2446681039
[92,] 0.0868688653 -0.3103503995
[93,] -0.5771445066 0.0868688653
[94,] -0.6061687361 -0.5771445066
[95,] -0.4214740456 -0.6061687361
[96,] 1.8450649961 -0.4214740456
[97,] -0.6142746256 1.8450649961
[98,] 0.3184693065 -0.6142746256
[99,] -0.4296659667 0.3184693065
[100,] -0.1824186098 -0.4296659667
[101,] -0.1202220481 -0.1824186098
[102,] -0.4510741887 -0.1202220481
[103,] 0.0007536971 -0.4510741887
[104,] -0.5923025015 0.0007536971
[105,] -0.2343271255 -0.5923025015
[106,] -0.2341486576 -0.2343271255
[107,] -0.6161399247 -0.2341486576
[108,] -1.0836483791 -0.6161399247
[109,] -1.2297450971 -1.0836483791
[110,] -0.5634988659 -1.2297450971
[111,] 0.6841098492 -0.5634988659
[112,] 0.1144024154 0.6841098492
[113,] -0.2544323342 0.1144024154
[114,] 1.8922262772 -0.2544323342
[115,] 0.2730759100 1.8922262772
[116,] -0.6912616220 0.2730759100
[117,] -0.8901996716 -0.6912616220
[118,] 0.5819453412 -0.8901996716
[119,] 0.7253834849 0.5819453412
[120,] -0.1161679978 0.7253834849
[121,] 0.6318461774 -0.1161679978
[122,] -0.4223834405 0.6318461774
[123,] 0.9370048664 -0.4223834405
[124,] 0.1930924745 0.9370048664
[125,] -0.1382030651 0.1930924745
[126,] -0.2714711011 -0.1382030651
[127,] 0.0836646289 -0.2714711011
[128,] -0.5721566194 0.0836646289
[129,] -0.5507080900 -0.5721566194
[130,] -0.1706781831 -0.5507080900
[131,] -0.1995846768 -0.1706781831
[132,] -0.3359353861 -0.1995846768
[133,] -0.7216566564 -0.3359353861
[134,] -0.1334135019 -0.7216566564
[135,] -0.2845632616 -0.1334135019
[136,] 0.2257941259 -0.2845632616
[137,] 0.8010499867 0.2257941259
[138,] 0.1637215021 0.8010499867
[139,] 0.7237116614 0.1637215021
[140,] -1.2404515961 0.7237116614
[141,] -0.6728049458 -1.2404515961
[142,] -0.2958332701 -0.6728049458
[143,] -0.2825088702 -0.2958332701
[144,] -0.2383266458 -0.2825088702
[145,] 0.4661299391 -0.2383266458
[146,] 0.2345924411 0.4661299391
[147,] -0.4498090816 0.2345924411
[148,] -0.8430983641 -0.4498090816
[149,] -0.8739878927 -0.8430983641
[150,] -0.8438653786 -0.8739878927
[151,] -0.8446323931 -0.8438653786
[152,] -0.8430983641 -0.8446323931
[153,] -0.8430983641 -0.8430983641
[154,] 0.0523149138 -0.8430983641
[155,] -1.4352919522 0.0523149138
[156,] -0.8430983641 -1.4352919522
[157,] -0.8461664221 -0.8430983641
[158,] -0.8585431284 -0.8461664221
[159,] 0.2472775917 -0.8585431284
[160,] -0.8943098681 0.2472775917
[161,] 1.1438751859 -0.8943098681
[162,] -0.8446323931 1.1438751859
[163,] 1.2154948995 -0.8446323931
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.6225112499 -0.3554257875
2 0.0356473320 -0.6225112499
3 -0.5848808272 0.0356473320
4 3.5556978144 -0.5848808272
5 -1.2085883156 3.5556978144
6 -0.7457962493 -1.2085883156
7 0.0349864078 -0.7457962493
8 -0.3883396196 0.0349864078
9 -0.1645849516 -0.3883396196
10 0.0773779218 -0.1645849516
11 0.5034290917 0.0773779218
12 2.6126924895 0.5034290917
13 3.4968951374 2.6126924895
14 -0.1163587062 3.4968951374
15 -0.2024570480 -0.1163587062
16 -0.5876559138 -0.2024570480
17 -0.3714085592 -0.5876559138
18 -0.3868055906 -0.3714085592
19 -0.4144881157 -0.3868055906
20 0.6488450294 -0.4144881157
21 1.2274605060 0.6488450294
22 -0.2597236148 1.2274605060
23 -1.5923542643 -0.2597236148
24 -0.3810785657 -1.5923542643
25 -0.0572480500 -0.3810785657
26 -0.0243125431 -0.0572480500
27 -0.3690714282 -0.0243125431
28 -0.6649543242 -0.3690714282
29 -0.1971346583 -0.6649543242
30 -0.4690327723 -0.1971346583
31 1.8697205291 -0.4690327723
32 0.0092538000 1.8697205291
33 -0.0550598939 0.0092538000
34 -0.5033498986 -0.0550598939
35 0.1848104919 -0.5033498986
36 -0.3535520751 0.1848104919
37 -0.4275056875 -0.3535520751
38 0.1353752856 -0.4275056875
39 -0.6847176384 0.1353752856
40 -0.6856374552 -0.6847176384
41 0.5175983271 -0.6856374552
42 0.5500419434 0.5175983271
43 -0.1128432584 0.5500419434
44 5.4568730536 -0.1128432584
45 -0.6143606572 5.4568730536
46 4.1207602765 -0.6143606572
47 0.0908529128 4.1207602765
48 -0.0985483390 0.0908529128
49 0.9133280636 -0.0985483390
50 -2.9505925238 0.9133280636
51 0.0428027606 -2.9505925238
52 0.5556089430 0.0428027606
53 -0.0180242199 0.5556089430
54 -0.2828946704 -0.0180242199
55 -0.4911321965 -0.2828946704
56 -0.3109784684 -0.4911321965
57 -0.6719051877 -0.3109784684
58 1.0802009439 -0.6719051877
59 -0.2394132849 1.0802009439
60 -0.3451810911 -0.2394132849
61 0.1636854145 -0.3451810911
62 -1.1825892595 0.1636854145
63 -0.3661639906 -1.1825892595
64 -0.5215015653 -0.3661639906
65 -0.8218058692 -0.5215015653
66 -0.6797443664 -0.8218058692
67 0.6239031195 -0.6797443664
68 -0.5465862481 0.6239031195
69 -0.5874453492 -0.5465862481
70 -0.2458345543 -0.5874453492
71 -0.3235586797 -0.2458345543
72 -0.2658814057 -0.3235586797
73 -0.5315772281 -0.2658814057
74 -0.4288891254 -0.5315772281
75 -0.3711356465 -0.4288891254
76 -0.5547765530 -0.3711356465
77 -0.2050861294 -0.5547765530
78 -0.4012282752 -0.2050861294
79 -0.2527376848 -0.4012282752
80 -0.5894151226 -0.2527376848
81 -0.6132824313 -0.5894151226
82 -0.2293376221 -0.6132824313
83 11.9254252626 -0.2293376221
84 -0.1184457504 11.9254252626
85 -0.1596132957 -0.1184457504
86 -0.1582499165 -0.1596132957
87 -0.7183439550 -0.1582499165
88 3.8872213010 -0.7183439550
89 -0.3109184949 3.8872213010
90 0.2446681039 -0.3109184949
91 -0.3103503995 0.2446681039
92 0.0868688653 -0.3103503995
93 -0.5771445066 0.0868688653
94 -0.6061687361 -0.5771445066
95 -0.4214740456 -0.6061687361
96 1.8450649961 -0.4214740456
97 -0.6142746256 1.8450649961
98 0.3184693065 -0.6142746256
99 -0.4296659667 0.3184693065
100 -0.1824186098 -0.4296659667
101 -0.1202220481 -0.1824186098
102 -0.4510741887 -0.1202220481
103 0.0007536971 -0.4510741887
104 -0.5923025015 0.0007536971
105 -0.2343271255 -0.5923025015
106 -0.2341486576 -0.2343271255
107 -0.6161399247 -0.2341486576
108 -1.0836483791 -0.6161399247
109 -1.2297450971 -1.0836483791
110 -0.5634988659 -1.2297450971
111 0.6841098492 -0.5634988659
112 0.1144024154 0.6841098492
113 -0.2544323342 0.1144024154
114 1.8922262772 -0.2544323342
115 0.2730759100 1.8922262772
116 -0.6912616220 0.2730759100
117 -0.8901996716 -0.6912616220
118 0.5819453412 -0.8901996716
119 0.7253834849 0.5819453412
120 -0.1161679978 0.7253834849
121 0.6318461774 -0.1161679978
122 -0.4223834405 0.6318461774
123 0.9370048664 -0.4223834405
124 0.1930924745 0.9370048664
125 -0.1382030651 0.1930924745
126 -0.2714711011 -0.1382030651
127 0.0836646289 -0.2714711011
128 -0.5721566194 0.0836646289
129 -0.5507080900 -0.5721566194
130 -0.1706781831 -0.5507080900
131 -0.1995846768 -0.1706781831
132 -0.3359353861 -0.1995846768
133 -0.7216566564 -0.3359353861
134 -0.1334135019 -0.7216566564
135 -0.2845632616 -0.1334135019
136 0.2257941259 -0.2845632616
137 0.8010499867 0.2257941259
138 0.1637215021 0.8010499867
139 0.7237116614 0.1637215021
140 -1.2404515961 0.7237116614
141 -0.6728049458 -1.2404515961
142 -0.2958332701 -0.6728049458
143 -0.2825088702 -0.2958332701
144 -0.2383266458 -0.2825088702
145 0.4661299391 -0.2383266458
146 0.2345924411 0.4661299391
147 -0.4498090816 0.2345924411
148 -0.8430983641 -0.4498090816
149 -0.8739878927 -0.8430983641
150 -0.8438653786 -0.8739878927
151 -0.8446323931 -0.8438653786
152 -0.8430983641 -0.8446323931
153 -0.8430983641 -0.8430983641
154 0.0523149138 -0.8430983641
155 -1.4352919522 0.0523149138
156 -0.8430983641 -1.4352919522
157 -0.8461664221 -0.8430983641
158 -0.8585431284 -0.8461664221
159 0.2472775917 -0.8585431284
160 -0.8943098681 0.2472775917
161 1.1438751859 -0.8943098681
162 -0.8446323931 1.1438751859
163 1.2154948995 -0.8446323931
> 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/7mlbn1321906567.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/8pzup1321906567.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/97ltr1321906567.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/103pap1321906567.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/11xe2r1321906567.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/12s7091321906567.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/133ca31321906567.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/14kjs71321906567.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/1553vu1321906567.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/162pja1321906567.tab")
+ }
>
> try(system("convert tmp/1z8r31321906567.ps tmp/1z8r31321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/2jhwj1321906567.ps tmp/2jhwj1321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/3l83d1321906567.ps tmp/3l83d1321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ue491321906567.ps tmp/4ue491321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/5gwc11321906567.ps tmp/5gwc11321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/6088o1321906567.ps tmp/6088o1321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mlbn1321906567.ps tmp/7mlbn1321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/8pzup1321906567.ps tmp/8pzup1321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/97ltr1321906567.ps tmp/97ltr1321906567.png",intern=TRUE))
character(0)
> try(system("convert tmp/103pap1321906567.ps tmp/103pap1321906567.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.675 0.523 5.238