R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(116,111,104,100,93,91,119,139,134,124,113,109,109,106,101,98,93,91,122,139,140,132,117,114,113,110,107,103,98,98,137,148,147,139,130,128,127,123,118,114,108,111,151,159,158,148,138,137,136,133,126,120,114,116,153,162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137,135,124,118,121,121,118,113,107,100,102,130,136,133,120,112,109,110,106,102,98,92,92,120,127,124,114,108,106,111,110,104,100,96,98,122,134,133),dim=c(1,153),dimnames=list(c('Werkloosheid'),1:153))
> y <- array(NA,dim=c(1,153),dimnames=list(c('Werkloosheid'),1:153))
> 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 = 'Include Monthly Dummies'
> par1 = '1'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Werkloosheid M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 116 1 0 0 0 0 0 0 0 0 0 0 1
2 111 0 1 0 0 0 0 0 0 0 0 0 2
3 104 0 0 1 0 0 0 0 0 0 0 0 3
4 100 0 0 0 1 0 0 0 0 0 0 0 4
5 93 0 0 0 0 1 0 0 0 0 0 0 5
6 91 0 0 0 0 0 1 0 0 0 0 0 6
7 119 0 0 0 0 0 0 1 0 0 0 0 7
8 139 0 0 0 0 0 0 0 1 0 0 0 8
9 134 0 0 0 0 0 0 0 0 1 0 0 9
10 124 0 0 0 0 0 0 0 0 0 1 0 10
11 113 0 0 0 0 0 0 0 0 0 0 1 11
12 109 0 0 0 0 0 0 0 0 0 0 0 12
13 109 1 0 0 0 0 0 0 0 0 0 0 13
14 106 0 1 0 0 0 0 0 0 0 0 0 14
15 101 0 0 1 0 0 0 0 0 0 0 0 15
16 98 0 0 0 1 0 0 0 0 0 0 0 16
17 93 0 0 0 0 1 0 0 0 0 0 0 17
18 91 0 0 0 0 0 1 0 0 0 0 0 18
19 122 0 0 0 0 0 0 1 0 0 0 0 19
20 139 0 0 0 0 0 0 0 1 0 0 0 20
21 140 0 0 0 0 0 0 0 0 1 0 0 21
22 132 0 0 0 0 0 0 0 0 0 1 0 22
23 117 0 0 0 0 0 0 0 0 0 0 1 23
24 114 0 0 0 0 0 0 0 0 0 0 0 24
25 113 1 0 0 0 0 0 0 0 0 0 0 25
26 110 0 1 0 0 0 0 0 0 0 0 0 26
27 107 0 0 1 0 0 0 0 0 0 0 0 27
28 103 0 0 0 1 0 0 0 0 0 0 0 28
29 98 0 0 0 0 1 0 0 0 0 0 0 29
30 98 0 0 0 0 0 1 0 0 0 0 0 30
31 137 0 0 0 0 0 0 1 0 0 0 0 31
32 148 0 0 0 0 0 0 0 1 0 0 0 32
33 147 0 0 0 0 0 0 0 0 1 0 0 33
34 139 0 0 0 0 0 0 0 0 0 1 0 34
35 130 0 0 0 0 0 0 0 0 0 0 1 35
36 128 0 0 0 0 0 0 0 0 0 0 0 36
37 127 1 0 0 0 0 0 0 0 0 0 0 37
38 123 0 1 0 0 0 0 0 0 0 0 0 38
39 118 0 0 1 0 0 0 0 0 0 0 0 39
40 114 0 0 0 1 0 0 0 0 0 0 0 40
41 108 0 0 0 0 1 0 0 0 0 0 0 41
42 111 0 0 0 0 0 1 0 0 0 0 0 42
43 151 0 0 0 0 0 0 1 0 0 0 0 43
44 159 0 0 0 0 0 0 0 1 0 0 0 44
45 158 0 0 0 0 0 0 0 0 1 0 0 45
46 148 0 0 0 0 0 0 0 0 0 1 0 46
47 138 0 0 0 0 0 0 0 0 0 0 1 47
48 137 0 0 0 0 0 0 0 0 0 0 0 48
49 136 1 0 0 0 0 0 0 0 0 0 0 49
50 133 0 1 0 0 0 0 0 0 0 0 0 50
51 126 0 0 1 0 0 0 0 0 0 0 0 51
52 120 0 0 0 1 0 0 0 0 0 0 0 52
53 114 0 0 0 0 1 0 0 0 0 0 0 53
54 116 0 0 0 0 0 1 0 0 0 0 0 54
55 153 0 0 0 0 0 0 1 0 0 0 0 55
56 162 0 0 0 0 0 0 0 1 0 0 0 56
57 161 0 0 0 0 0 0 0 0 1 0 0 57
58 149 0 0 0 0 0 0 0 0 0 1 0 58
59 139 0 0 0 0 0 0 0 0 0 0 1 59
60 135 0 0 0 0 0 0 0 0 0 0 0 60
61 130 1 0 0 0 0 0 0 0 0 0 0 61
62 127 0 1 0 0 0 0 0 0 0 0 0 62
63 122 0 0 1 0 0 0 0 0 0 0 0 63
64 117 0 0 0 1 0 0 0 0 0 0 0 64
65 112 0 0 0 0 1 0 0 0 0 0 0 65
66 113 0 0 0 0 0 1 0 0 0 0 0 66
67 149 0 0 0 0 0 0 1 0 0 0 0 67
68 157 0 0 0 0 0 0 0 1 0 0 0 68
69 157 0 0 0 0 0 0 0 0 1 0 0 69
70 147 0 0 0 0 0 0 0 0 0 1 0 70
71 137 0 0 0 0 0 0 0 0 0 0 1 71
72 132 0 0 0 0 0 0 0 0 0 0 0 72
73 125 1 0 0 0 0 0 0 0 0 0 0 73
74 123 0 1 0 0 0 0 0 0 0 0 0 74
75 117 0 0 1 0 0 0 0 0 0 0 0 75
76 114 0 0 0 1 0 0 0 0 0 0 0 76
77 111 0 0 0 0 1 0 0 0 0 0 0 77
78 112 0 0 0 0 0 1 0 0 0 0 0 78
79 144 0 0 0 0 0 0 1 0 0 0 0 79
80 150 0 0 0 0 0 0 0 1 0 0 0 80
81 149 0 0 0 0 0 0 0 0 1 0 0 81
82 134 0 0 0 0 0 0 0 0 0 1 0 82
83 123 0 0 0 0 0 0 0 0 0 0 1 83
84 116 0 0 0 0 0 0 0 0 0 0 0 84
85 117 1 0 0 0 0 0 0 0 0 0 0 85
86 111 0 1 0 0 0 0 0 0 0 0 0 86
87 105 0 0 1 0 0 0 0 0 0 0 0 87
88 102 0 0 0 1 0 0 0 0 0 0 0 88
89 95 0 0 0 0 1 0 0 0 0 0 0 89
90 93 0 0 0 0 0 1 0 0 0 0 0 90
91 124 0 0 0 0 0 0 1 0 0 0 0 91
92 130 0 0 0 0 0 0 0 1 0 0 0 92
93 124 0 0 0 0 0 0 0 0 1 0 0 93
94 115 0 0 0 0 0 0 0 0 0 1 0 94
95 106 0 0 0 0 0 0 0 0 0 0 1 95
96 105 0 0 0 0 0 0 0 0 0 0 0 96
97 105 1 0 0 0 0 0 0 0 0 0 0 97
98 101 0 1 0 0 0 0 0 0 0 0 0 98
99 95 0 0 1 0 0 0 0 0 0 0 0 99
100 93 0 0 0 1 0 0 0 0 0 0 0 100
101 84 0 0 0 0 1 0 0 0 0 0 0 101
102 87 0 0 0 0 0 1 0 0 0 0 0 102
103 116 0 0 0 0 0 0 1 0 0 0 0 103
104 120 0 0 0 0 0 0 0 1 0 0 0 104
105 117 0 0 0 0 0 0 0 0 1 0 0 105
106 109 0 0 0 0 0 0 0 0 0 1 0 106
107 105 0 0 0 0 0 0 0 0 0 0 1 107
108 107 0 0 0 0 0 0 0 0 0 0 0 108
109 109 1 0 0 0 0 0 0 0 0 0 0 109
110 109 0 1 0 0 0 0 0 0 0 0 0 110
111 108 0 0 1 0 0 0 0 0 0 0 0 111
112 107 0 0 0 1 0 0 0 0 0 0 0 112
113 99 0 0 0 0 1 0 0 0 0 0 0 113
114 103 0 0 0 0 0 1 0 0 0 0 0 114
115 131 0 0 0 0 0 0 1 0 0 0 0 115
116 137 0 0 0 0 0 0 0 1 0 0 0 116
117 135 0 0 0 0 0 0 0 0 1 0 0 117
118 124 0 0 0 0 0 0 0 0 0 1 0 118
119 118 0 0 0 0 0 0 0 0 0 0 1 119
120 121 0 0 0 0 0 0 0 0 0 0 0 120
121 121 1 0 0 0 0 0 0 0 0 0 0 121
122 118 0 1 0 0 0 0 0 0 0 0 0 122
123 113 0 0 1 0 0 0 0 0 0 0 0 123
124 107 0 0 0 1 0 0 0 0 0 0 0 124
125 100 0 0 0 0 1 0 0 0 0 0 0 125
126 102 0 0 0 0 0 1 0 0 0 0 0 126
127 130 0 0 0 0 0 0 1 0 0 0 0 127
128 136 0 0 0 0 0 0 0 1 0 0 0 128
129 133 0 0 0 0 0 0 0 0 1 0 0 129
130 120 0 0 0 0 0 0 0 0 0 1 0 130
131 112 0 0 0 0 0 0 0 0 0 0 1 131
132 109 0 0 0 0 0 0 0 0 0 0 0 132
133 110 1 0 0 0 0 0 0 0 0 0 0 133
134 106 0 1 0 0 0 0 0 0 0 0 0 134
135 102 0 0 1 0 0 0 0 0 0 0 0 135
136 98 0 0 0 1 0 0 0 0 0 0 0 136
137 92 0 0 0 0 1 0 0 0 0 0 0 137
138 92 0 0 0 0 0 1 0 0 0 0 0 138
139 120 0 0 0 0 0 0 1 0 0 0 0 139
140 127 0 0 0 0 0 0 0 1 0 0 0 140
141 124 0 0 0 0 0 0 0 0 1 0 0 141
142 114 0 0 0 0 0 0 0 0 0 1 0 142
143 108 0 0 0 0 0 0 0 0 0 0 1 143
144 106 0 0 0 0 0 0 0 0 0 0 0 144
145 111 1 0 0 0 0 0 0 0 0 0 0 145
146 110 0 1 0 0 0 0 0 0 0 0 0 146
147 104 0 0 1 0 0 0 0 0 0 0 0 147
148 100 0 0 0 1 0 0 0 0 0 0 0 148
149 96 0 0 0 0 1 0 0 0 0 0 0 149
150 98 0 0 0 0 0 1 0 0 0 0 0 150
151 122 0 0 0 0 0 0 1 0 0 0 0 151
152 134 0 0 0 0 0 0 0 1 0 0 0 152
153 133 0 0 0 0 0 0 0 0 1 0 0 153
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) M1 M2 M3 M4 M5
124.72484 -1.04967 -4.12050 -9.11442 -12.80064 -18.71763
M6 M7 M8 M9 M10 M11
-17.71154 13.98686 23.30064 21.38365 11.16731 2.16699
t
-0.08301
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-20.392 -8.600 -1.396 7.600 19.623
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 124.72484 3.45131 36.138 < 2e-16 ***
M1 -1.04967 4.29005 -0.245 0.80707
M2 -4.12050 4.28964 -0.961 0.33842
M3 -9.11442 4.28933 -2.125 0.03535 *
M4 -12.80064 4.28910 -2.984 0.00335 **
M5 -18.71763 4.28897 -4.364 2.46e-05 ***
M6 -17.71154 4.28892 -4.130 6.22e-05 ***
M7 13.98686 4.28897 3.261 0.00139 **
M8 23.30064 4.28910 5.433 2.39e-07 ***
M9 21.38365 4.28933 4.985 1.80e-06 ***
M10 11.16731 4.37404 2.553 0.01175 *
M11 2.16699 4.37390 0.495 0.62107
t -0.08301 0.01964 -4.227 4.25e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.71 on 140 degrees of freedom
Multiple R-squared: 0.6567, Adjusted R-squared: 0.6272
F-statistic: 22.31 on 12 and 140 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,] 5.443953e-03 1.088791e-02 9.945560e-01
[2,] 2.817185e-03 5.634370e-03 9.971828e-01
[3,] 1.029797e-03 2.059594e-03 9.989702e-01
[4,] 1.068637e-03 2.137275e-03 9.989314e-01
[5,] 3.030062e-04 6.060123e-04 9.996970e-01
[6,] 5.686991e-04 1.137398e-03 9.994313e-01
[7,] 1.021463e-03 2.042926e-03 9.989785e-01
[8,] 5.119242e-04 1.023848e-03 9.994881e-01
[9,] 3.001064e-04 6.002127e-04 9.996999e-01
[10,] 1.207595e-04 2.415190e-04 9.998792e-01
[11,] 4.909270e-05 9.818540e-05 9.999509e-01
[12,] 2.727031e-05 5.454062e-05 9.999727e-01
[13,] 1.347771e-05 2.695542e-05 9.999865e-01
[14,] 7.671747e-06 1.534349e-05 9.999923e-01
[15,] 7.417155e-06 1.483431e-05 9.999926e-01
[16,] 2.412441e-04 4.824881e-04 9.997588e-01
[17,] 1.762710e-04 3.525419e-04 9.998237e-01
[18,] 1.416069e-04 2.832138e-04 9.998584e-01
[19,] 1.207176e-04 2.414352e-04 9.998793e-01
[20,] 2.329313e-04 4.658626e-04 9.997671e-01
[21,] 4.809544e-04 9.619088e-04 9.995190e-01
[22,] 3.752575e-04 7.505151e-04 9.996247e-01
[23,] 2.671703e-04 5.343406e-04 9.997328e-01
[24,] 1.819275e-04 3.638550e-04 9.998181e-01
[25,] 1.168915e-04 2.337831e-04 9.998831e-01
[26,] 7.150536e-05 1.430107e-04 9.999285e-01
[27,] 7.319686e-05 1.463937e-04 9.999268e-01
[28,] 3.434152e-04 6.868303e-04 9.996566e-01
[29,] 2.397635e-04 4.795271e-04 9.997602e-01
[30,] 1.755542e-04 3.511084e-04 9.998244e-01
[31,] 1.140280e-04 2.280559e-04 9.998860e-01
[32,] 8.207847e-05 1.641569e-04 9.999179e-01
[33,] 7.495834e-05 1.499167e-04 9.999250e-01
[34,] 4.521466e-05 9.042931e-05 9.999548e-01
[35,] 2.812682e-05 5.625365e-05 9.999719e-01
[36,] 1.497773e-05 2.995545e-05 9.999850e-01
[37,] 7.728940e-06 1.545788e-05 9.999923e-01
[38,] 3.950743e-06 7.901486e-06 9.999960e-01
[39,] 1.968417e-06 3.936834e-06 9.999980e-01
[40,] 1.329369e-06 2.658739e-06 9.999987e-01
[41,] 8.952459e-07 1.790492e-06 9.999991e-01
[42,] 6.561904e-07 1.312381e-06 9.999993e-01
[43,] 6.347167e-07 1.269433e-06 9.999994e-01
[44,] 4.850224e-07 9.700448e-07 9.999995e-01
[45,] 3.908103e-07 7.816206e-07 9.999996e-01
[46,] 9.887835e-07 1.977567e-06 9.999990e-01
[47,] 1.645285e-06 3.290570e-06 9.999984e-01
[48,] 2.143763e-06 4.287525e-06 9.999979e-01
[49,] 2.807848e-06 5.615696e-06 9.999972e-01
[50,] 2.969184e-06 5.938369e-06 9.999970e-01
[51,] 2.597231e-06 5.194462e-06 9.999974e-01
[52,] 2.804737e-06 5.609475e-06 9.999972e-01
[53,] 7.346627e-06 1.469325e-05 9.999927e-01
[54,] 1.853455e-05 3.706909e-05 9.999815e-01
[55,] 6.543840e-05 1.308768e-04 9.999346e-01
[56,] 1.626617e-04 3.253233e-04 9.998373e-01
[57,] 3.838540e-04 7.677080e-04 9.996161e-01
[58,] 1.425128e-03 2.850257e-03 9.985749e-01
[59,] 3.166383e-03 6.332766e-03 9.968336e-01
[60,] 6.117303e-03 1.223461e-02 9.938827e-01
[61,] 9.227756e-03 1.845551e-02 9.907722e-01
[62,] 1.340692e-02 2.681385e-02 9.865931e-01
[63,] 1.850249e-02 3.700498e-02 9.814975e-01
[64,] 4.288278e-02 8.576555e-02 9.571172e-01
[65,] 1.328554e-01 2.657109e-01 8.671446e-01
[66,] 3.583046e-01 7.166091e-01 6.416954e-01
[67,] 6.750496e-01 6.499009e-01 3.249504e-01
[68,] 8.536821e-01 2.926359e-01 1.463179e-01
[69,] 9.343118e-01 1.313763e-01 6.568816e-02
[70,] 9.633168e-01 7.336645e-02 3.668323e-02
[71,] 9.790317e-01 4.193654e-02 2.096827e-02
[72,] 9.868166e-01 2.636683e-02 1.318341e-02
[73,] 9.904004e-01 1.919910e-02 9.599550e-03
[74,] 9.932354e-01 1.352930e-02 6.764649e-03
[75,] 9.952616e-01 9.476763e-03 4.738382e-03
[76,] 9.973169e-01 5.366119e-03 2.683060e-03
[77,] 9.988177e-01 2.364503e-03 1.182252e-03
[78,] 9.995698e-01 8.603207e-04 4.301604e-04
[79,] 9.997829e-01 4.341143e-04 2.170571e-04
[80,] 9.998554e-01 2.891906e-04 1.445953e-04
[81,] 9.998772e-01 2.455952e-04 1.227976e-04
[82,] 9.998868e-01 2.264457e-04 1.132229e-04
[83,] 9.999074e-01 1.851033e-04 9.255167e-05
[84,] 9.999394e-01 1.212579e-04 6.062893e-05
[85,] 9.999492e-01 1.015766e-04 5.078831e-05
[86,] 9.999756e-01 4.875117e-05 2.437559e-05
[87,] 9.999868e-01 2.647183e-05 1.323592e-05
[88,] 9.999928e-01 1.437437e-05 7.187186e-06
[89,] 9.999990e-01 1.994171e-06 9.970855e-07
[90,] 1.000000e+00 8.636737e-08 4.318369e-08
[91,] 1.000000e+00 1.130684e-08 5.653422e-09
[92,] 1.000000e+00 2.988926e-09 1.494463e-09
[93,] 1.000000e+00 1.591836e-09 7.959182e-10
[94,] 1.000000e+00 6.361082e-10 3.180541e-10
[95,] 1.000000e+00 5.001893e-10 2.500947e-10
[96,] 1.000000e+00 1.044401e-09 5.222006e-10
[97,] 1.000000e+00 3.288641e-09 1.644321e-09
[98,] 1.000000e+00 8.030467e-09 4.015234e-09
[99,] 1.000000e+00 2.431497e-08 1.215749e-08
[100,] 1.000000e+00 7.484092e-08 3.742046e-08
[101,] 9.999999e-01 2.026370e-07 1.013185e-07
[102,] 9.999997e-01 5.442769e-07 2.721385e-07
[103,] 9.999993e-01 1.485936e-06 7.429681e-07
[104,] 9.999981e-01 3.750027e-06 1.875013e-06
[105,] 9.999983e-01 3.301073e-06 1.650537e-06
[106,] 9.999975e-01 4.978503e-06 2.489251e-06
[107,] 9.999963e-01 7.403214e-06 3.701607e-06
[108,] 9.999953e-01 9.439929e-06 4.719965e-06
[109,] 9.999918e-01 1.643221e-05 8.216107e-06
[110,] 9.999814e-01 3.714018e-05 1.857009e-05
[111,] 9.999687e-01 6.263675e-05 3.131838e-05
[112,] 9.999790e-01 4.205478e-05 2.102739e-05
[113,] 9.999737e-01 5.267532e-05 2.633766e-05
[114,] 9.999730e-01 5.392191e-05 2.696096e-05
[115,] 9.999830e-01 3.401210e-05 1.700605e-05
[116,] 9.999866e-01 2.683331e-05 1.341665e-05
[117,] 9.999929e-01 1.412982e-05 7.064911e-06
[118,] 9.999785e-01 4.296151e-05 2.148075e-05
[119,] 9.998663e-01 2.674709e-04 1.337355e-04
[120,] 9.994850e-01 1.029950e-03 5.149748e-04
[121,] 9.983483e-01 3.303434e-03 1.651717e-03
[122,] 9.912678e-01 1.746436e-02 8.732181e-03
> postscript(file="/var/wessaorg/rcomp/tmp/11yr41353676652.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/2eyez1353676652.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/3sgt81353676652.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/42nfa1353676653.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/5piwt1353676653.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 = 153
Frequency = 1
1 2 3 4 5 6
-7.5921626 -9.4383164 -11.3613933 -11.5921626 -12.5921626 -15.5152395
7 8 9 10 11 12
-19.1306241 -8.3613933 -11.3613933 -11.0620464 -12.9787131 -14.7287131
13 14 15 16 17 18
-13.5960329 -13.4421867 -13.3652637 -12.5960329 -11.5960329 -14.5191098
19 20 21 22 23 24
-15.1344944 -7.3652637 -4.3652637 -2.0659168 -7.9825835 -8.7325835
25 26 27 28 29 30
-8.5999032 -8.4460571 -6.3691340 -6.5999032 -5.5999032 -6.5229802
31 32 33 34 35 36
0.8616352 2.6308660 3.6308660 5.9302129 6.0135462 6.2635462
37 38 39 40 41 42
6.3962264 5.5500726 5.6269956 5.3962264 5.3962264 7.4731495
43 44 45 46 47 48
15.8577649 14.6269956 15.6269956 15.9263425 15.0096759 16.2596759
49 50 51 52 53 54
16.3923561 16.5462022 14.6231253 12.3923561 12.3923561 13.4692791
55 56 57 58 59 60
18.8538945 18.6231253 19.6231253 17.9224722 17.0058055 15.2558055
61 62 63 64 65 66
11.3884857 11.5423319 11.6192550 10.3884857 11.3884857 11.4654088
67 68 69 70 71 72
15.8500242 14.6192550 16.6192550 16.9186018 16.0019352 13.2519352
73 74 75 76 77 78
7.3846154 8.5384615 7.6153846 8.3846154 11.3846154 11.4615385
79 80 81 82 83 84
11.8461538 8.6153846 9.6153846 4.9147315 2.9980648 -1.7519352
85 86 87 88 89 90
0.3807450 -2.4654088 -3.3884857 -2.6192550 -3.6192550 -6.5423319
91 92 93 94 95 96
-7.1577165 -10.3884857 -14.3884857 -13.0891388 -13.0058055 -11.7558055
97 98 99 100 101 102
-10.6231253 -11.4692791 -12.3923561 -10.6231253 -13.6231253 -11.5462022
103 104 105 106 107 108
-14.1615868 -19.3923561 -20.3923561 -18.0930092 -13.0096759 -8.7596759
109 110 111 112 113 114
-5.6269956 -2.4731495 1.6037736 4.3730044 2.3730044 5.4499274
115 116 117 118 119 120
1.8345428 -1.3962264 -1.3962264 -2.0968795 0.9864538 6.2364538
121 122 123 124 125 126
7.3691340 7.5229802 7.5999032 5.3691340 4.3691340 5.4460571
127 128 129 130 131 132
1.8306725 -1.4000968 -2.4000968 -5.1007499 -4.0174165 -4.7674165
133 134 135 136 137 138
-2.6347363 -3.4808902 -2.4039671 -2.6347363 -2.6347363 -3.5578133
139 140 141 142 143 144
-7.1731979 -9.4039671 -10.4039671 -10.1046202 -7.0212869 -6.7712869
145 146 147 148 149 150
-0.6386067 1.5152395 0.5921626 0.3613933 2.3613933 3.4383164
151 152 153
-4.1770682 -1.4078374 -0.4078374
> postscript(file="/var/wessaorg/rcomp/tmp/6l2xg1353676653.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 = 153
Frequency = 1
lag(myerror, k = 1) myerror
0 -7.5921626 NA
1 -9.4383164 -7.5921626
2 -11.3613933 -9.4383164
3 -11.5921626 -11.3613933
4 -12.5921626 -11.5921626
5 -15.5152395 -12.5921626
6 -19.1306241 -15.5152395
7 -8.3613933 -19.1306241
8 -11.3613933 -8.3613933
9 -11.0620464 -11.3613933
10 -12.9787131 -11.0620464
11 -14.7287131 -12.9787131
12 -13.5960329 -14.7287131
13 -13.4421867 -13.5960329
14 -13.3652637 -13.4421867
15 -12.5960329 -13.3652637
16 -11.5960329 -12.5960329
17 -14.5191098 -11.5960329
18 -15.1344944 -14.5191098
19 -7.3652637 -15.1344944
20 -4.3652637 -7.3652637
21 -2.0659168 -4.3652637
22 -7.9825835 -2.0659168
23 -8.7325835 -7.9825835
24 -8.5999032 -8.7325835
25 -8.4460571 -8.5999032
26 -6.3691340 -8.4460571
27 -6.5999032 -6.3691340
28 -5.5999032 -6.5999032
29 -6.5229802 -5.5999032
30 0.8616352 -6.5229802
31 2.6308660 0.8616352
32 3.6308660 2.6308660
33 5.9302129 3.6308660
34 6.0135462 5.9302129
35 6.2635462 6.0135462
36 6.3962264 6.2635462
37 5.5500726 6.3962264
38 5.6269956 5.5500726
39 5.3962264 5.6269956
40 5.3962264 5.3962264
41 7.4731495 5.3962264
42 15.8577649 7.4731495
43 14.6269956 15.8577649
44 15.6269956 14.6269956
45 15.9263425 15.6269956
46 15.0096759 15.9263425
47 16.2596759 15.0096759
48 16.3923561 16.2596759
49 16.5462022 16.3923561
50 14.6231253 16.5462022
51 12.3923561 14.6231253
52 12.3923561 12.3923561
53 13.4692791 12.3923561
54 18.8538945 13.4692791
55 18.6231253 18.8538945
56 19.6231253 18.6231253
57 17.9224722 19.6231253
58 17.0058055 17.9224722
59 15.2558055 17.0058055
60 11.3884857 15.2558055
61 11.5423319 11.3884857
62 11.6192550 11.5423319
63 10.3884857 11.6192550
64 11.3884857 10.3884857
65 11.4654088 11.3884857
66 15.8500242 11.4654088
67 14.6192550 15.8500242
68 16.6192550 14.6192550
69 16.9186018 16.6192550
70 16.0019352 16.9186018
71 13.2519352 16.0019352
72 7.3846154 13.2519352
73 8.5384615 7.3846154
74 7.6153846 8.5384615
75 8.3846154 7.6153846
76 11.3846154 8.3846154
77 11.4615385 11.3846154
78 11.8461538 11.4615385
79 8.6153846 11.8461538
80 9.6153846 8.6153846
81 4.9147315 9.6153846
82 2.9980648 4.9147315
83 -1.7519352 2.9980648
84 0.3807450 -1.7519352
85 -2.4654088 0.3807450
86 -3.3884857 -2.4654088
87 -2.6192550 -3.3884857
88 -3.6192550 -2.6192550
89 -6.5423319 -3.6192550
90 -7.1577165 -6.5423319
91 -10.3884857 -7.1577165
92 -14.3884857 -10.3884857
93 -13.0891388 -14.3884857
94 -13.0058055 -13.0891388
95 -11.7558055 -13.0058055
96 -10.6231253 -11.7558055
97 -11.4692791 -10.6231253
98 -12.3923561 -11.4692791
99 -10.6231253 -12.3923561
100 -13.6231253 -10.6231253
101 -11.5462022 -13.6231253
102 -14.1615868 -11.5462022
103 -19.3923561 -14.1615868
104 -20.3923561 -19.3923561
105 -18.0930092 -20.3923561
106 -13.0096759 -18.0930092
107 -8.7596759 -13.0096759
108 -5.6269956 -8.7596759
109 -2.4731495 -5.6269956
110 1.6037736 -2.4731495
111 4.3730044 1.6037736
112 2.3730044 4.3730044
113 5.4499274 2.3730044
114 1.8345428 5.4499274
115 -1.3962264 1.8345428
116 -1.3962264 -1.3962264
117 -2.0968795 -1.3962264
118 0.9864538 -2.0968795
119 6.2364538 0.9864538
120 7.3691340 6.2364538
121 7.5229802 7.3691340
122 7.5999032 7.5229802
123 5.3691340 7.5999032
124 4.3691340 5.3691340
125 5.4460571 4.3691340
126 1.8306725 5.4460571
127 -1.4000968 1.8306725
128 -2.4000968 -1.4000968
129 -5.1007499 -2.4000968
130 -4.0174165 -5.1007499
131 -4.7674165 -4.0174165
132 -2.6347363 -4.7674165
133 -3.4808902 -2.6347363
134 -2.4039671 -3.4808902
135 -2.6347363 -2.4039671
136 -2.6347363 -2.6347363
137 -3.5578133 -2.6347363
138 -7.1731979 -3.5578133
139 -9.4039671 -7.1731979
140 -10.4039671 -9.4039671
141 -10.1046202 -10.4039671
142 -7.0212869 -10.1046202
143 -6.7712869 -7.0212869
144 -0.6386067 -6.7712869
145 1.5152395 -0.6386067
146 0.5921626 1.5152395
147 0.3613933 0.5921626
148 2.3613933 0.3613933
149 3.4383164 2.3613933
150 -4.1770682 3.4383164
151 -1.4078374 -4.1770682
152 -0.4078374 -1.4078374
153 NA -0.4078374
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -9.4383164 -7.5921626
[2,] -11.3613933 -9.4383164
[3,] -11.5921626 -11.3613933
[4,] -12.5921626 -11.5921626
[5,] -15.5152395 -12.5921626
[6,] -19.1306241 -15.5152395
[7,] -8.3613933 -19.1306241
[8,] -11.3613933 -8.3613933
[9,] -11.0620464 -11.3613933
[10,] -12.9787131 -11.0620464
[11,] -14.7287131 -12.9787131
[12,] -13.5960329 -14.7287131
[13,] -13.4421867 -13.5960329
[14,] -13.3652637 -13.4421867
[15,] -12.5960329 -13.3652637
[16,] -11.5960329 -12.5960329
[17,] -14.5191098 -11.5960329
[18,] -15.1344944 -14.5191098
[19,] -7.3652637 -15.1344944
[20,] -4.3652637 -7.3652637
[21,] -2.0659168 -4.3652637
[22,] -7.9825835 -2.0659168
[23,] -8.7325835 -7.9825835
[24,] -8.5999032 -8.7325835
[25,] -8.4460571 -8.5999032
[26,] -6.3691340 -8.4460571
[27,] -6.5999032 -6.3691340
[28,] -5.5999032 -6.5999032
[29,] -6.5229802 -5.5999032
[30,] 0.8616352 -6.5229802
[31,] 2.6308660 0.8616352
[32,] 3.6308660 2.6308660
[33,] 5.9302129 3.6308660
[34,] 6.0135462 5.9302129
[35,] 6.2635462 6.0135462
[36,] 6.3962264 6.2635462
[37,] 5.5500726 6.3962264
[38,] 5.6269956 5.5500726
[39,] 5.3962264 5.6269956
[40,] 5.3962264 5.3962264
[41,] 7.4731495 5.3962264
[42,] 15.8577649 7.4731495
[43,] 14.6269956 15.8577649
[44,] 15.6269956 14.6269956
[45,] 15.9263425 15.6269956
[46,] 15.0096759 15.9263425
[47,] 16.2596759 15.0096759
[48,] 16.3923561 16.2596759
[49,] 16.5462022 16.3923561
[50,] 14.6231253 16.5462022
[51,] 12.3923561 14.6231253
[52,] 12.3923561 12.3923561
[53,] 13.4692791 12.3923561
[54,] 18.8538945 13.4692791
[55,] 18.6231253 18.8538945
[56,] 19.6231253 18.6231253
[57,] 17.9224722 19.6231253
[58,] 17.0058055 17.9224722
[59,] 15.2558055 17.0058055
[60,] 11.3884857 15.2558055
[61,] 11.5423319 11.3884857
[62,] 11.6192550 11.5423319
[63,] 10.3884857 11.6192550
[64,] 11.3884857 10.3884857
[65,] 11.4654088 11.3884857
[66,] 15.8500242 11.4654088
[67,] 14.6192550 15.8500242
[68,] 16.6192550 14.6192550
[69,] 16.9186018 16.6192550
[70,] 16.0019352 16.9186018
[71,] 13.2519352 16.0019352
[72,] 7.3846154 13.2519352
[73,] 8.5384615 7.3846154
[74,] 7.6153846 8.5384615
[75,] 8.3846154 7.6153846
[76,] 11.3846154 8.3846154
[77,] 11.4615385 11.3846154
[78,] 11.8461538 11.4615385
[79,] 8.6153846 11.8461538
[80,] 9.6153846 8.6153846
[81,] 4.9147315 9.6153846
[82,] 2.9980648 4.9147315
[83,] -1.7519352 2.9980648
[84,] 0.3807450 -1.7519352
[85,] -2.4654088 0.3807450
[86,] -3.3884857 -2.4654088
[87,] -2.6192550 -3.3884857
[88,] -3.6192550 -2.6192550
[89,] -6.5423319 -3.6192550
[90,] -7.1577165 -6.5423319
[91,] -10.3884857 -7.1577165
[92,] -14.3884857 -10.3884857
[93,] -13.0891388 -14.3884857
[94,] -13.0058055 -13.0891388
[95,] -11.7558055 -13.0058055
[96,] -10.6231253 -11.7558055
[97,] -11.4692791 -10.6231253
[98,] -12.3923561 -11.4692791
[99,] -10.6231253 -12.3923561
[100,] -13.6231253 -10.6231253
[101,] -11.5462022 -13.6231253
[102,] -14.1615868 -11.5462022
[103,] -19.3923561 -14.1615868
[104,] -20.3923561 -19.3923561
[105,] -18.0930092 -20.3923561
[106,] -13.0096759 -18.0930092
[107,] -8.7596759 -13.0096759
[108,] -5.6269956 -8.7596759
[109,] -2.4731495 -5.6269956
[110,] 1.6037736 -2.4731495
[111,] 4.3730044 1.6037736
[112,] 2.3730044 4.3730044
[113,] 5.4499274 2.3730044
[114,] 1.8345428 5.4499274
[115,] -1.3962264 1.8345428
[116,] -1.3962264 -1.3962264
[117,] -2.0968795 -1.3962264
[118,] 0.9864538 -2.0968795
[119,] 6.2364538 0.9864538
[120,] 7.3691340 6.2364538
[121,] 7.5229802 7.3691340
[122,] 7.5999032 7.5229802
[123,] 5.3691340 7.5999032
[124,] 4.3691340 5.3691340
[125,] 5.4460571 4.3691340
[126,] 1.8306725 5.4460571
[127,] -1.4000968 1.8306725
[128,] -2.4000968 -1.4000968
[129,] -5.1007499 -2.4000968
[130,] -4.0174165 -5.1007499
[131,] -4.7674165 -4.0174165
[132,] -2.6347363 -4.7674165
[133,] -3.4808902 -2.6347363
[134,] -2.4039671 -3.4808902
[135,] -2.6347363 -2.4039671
[136,] -2.6347363 -2.6347363
[137,] -3.5578133 -2.6347363
[138,] -7.1731979 -3.5578133
[139,] -9.4039671 -7.1731979
[140,] -10.4039671 -9.4039671
[141,] -10.1046202 -10.4039671
[142,] -7.0212869 -10.1046202
[143,] -6.7712869 -7.0212869
[144,] -0.6386067 -6.7712869
[145,] 1.5152395 -0.6386067
[146,] 0.5921626 1.5152395
[147,] 0.3613933 0.5921626
[148,] 2.3613933 0.3613933
[149,] 3.4383164 2.3613933
[150,] -4.1770682 3.4383164
[151,] -1.4078374 -4.1770682
[152,] -0.4078374 -1.4078374
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -9.4383164 -7.5921626
2 -11.3613933 -9.4383164
3 -11.5921626 -11.3613933
4 -12.5921626 -11.5921626
5 -15.5152395 -12.5921626
6 -19.1306241 -15.5152395
7 -8.3613933 -19.1306241
8 -11.3613933 -8.3613933
9 -11.0620464 -11.3613933
10 -12.9787131 -11.0620464
11 -14.7287131 -12.9787131
12 -13.5960329 -14.7287131
13 -13.4421867 -13.5960329
14 -13.3652637 -13.4421867
15 -12.5960329 -13.3652637
16 -11.5960329 -12.5960329
17 -14.5191098 -11.5960329
18 -15.1344944 -14.5191098
19 -7.3652637 -15.1344944
20 -4.3652637 -7.3652637
21 -2.0659168 -4.3652637
22 -7.9825835 -2.0659168
23 -8.7325835 -7.9825835
24 -8.5999032 -8.7325835
25 -8.4460571 -8.5999032
26 -6.3691340 -8.4460571
27 -6.5999032 -6.3691340
28 -5.5999032 -6.5999032
29 -6.5229802 -5.5999032
30 0.8616352 -6.5229802
31 2.6308660 0.8616352
32 3.6308660 2.6308660
33 5.9302129 3.6308660
34 6.0135462 5.9302129
35 6.2635462 6.0135462
36 6.3962264 6.2635462
37 5.5500726 6.3962264
38 5.6269956 5.5500726
39 5.3962264 5.6269956
40 5.3962264 5.3962264
41 7.4731495 5.3962264
42 15.8577649 7.4731495
43 14.6269956 15.8577649
44 15.6269956 14.6269956
45 15.9263425 15.6269956
46 15.0096759 15.9263425
47 16.2596759 15.0096759
48 16.3923561 16.2596759
49 16.5462022 16.3923561
50 14.6231253 16.5462022
51 12.3923561 14.6231253
52 12.3923561 12.3923561
53 13.4692791 12.3923561
54 18.8538945 13.4692791
55 18.6231253 18.8538945
56 19.6231253 18.6231253
57 17.9224722 19.6231253
58 17.0058055 17.9224722
59 15.2558055 17.0058055
60 11.3884857 15.2558055
61 11.5423319 11.3884857
62 11.6192550 11.5423319
63 10.3884857 11.6192550
64 11.3884857 10.3884857
65 11.4654088 11.3884857
66 15.8500242 11.4654088
67 14.6192550 15.8500242
68 16.6192550 14.6192550
69 16.9186018 16.6192550
70 16.0019352 16.9186018
71 13.2519352 16.0019352
72 7.3846154 13.2519352
73 8.5384615 7.3846154
74 7.6153846 8.5384615
75 8.3846154 7.6153846
76 11.3846154 8.3846154
77 11.4615385 11.3846154
78 11.8461538 11.4615385
79 8.6153846 11.8461538
80 9.6153846 8.6153846
81 4.9147315 9.6153846
82 2.9980648 4.9147315
83 -1.7519352 2.9980648
84 0.3807450 -1.7519352
85 -2.4654088 0.3807450
86 -3.3884857 -2.4654088
87 -2.6192550 -3.3884857
88 -3.6192550 -2.6192550
89 -6.5423319 -3.6192550
90 -7.1577165 -6.5423319
91 -10.3884857 -7.1577165
92 -14.3884857 -10.3884857
93 -13.0891388 -14.3884857
94 -13.0058055 -13.0891388
95 -11.7558055 -13.0058055
96 -10.6231253 -11.7558055
97 -11.4692791 -10.6231253
98 -12.3923561 -11.4692791
99 -10.6231253 -12.3923561
100 -13.6231253 -10.6231253
101 -11.5462022 -13.6231253
102 -14.1615868 -11.5462022
103 -19.3923561 -14.1615868
104 -20.3923561 -19.3923561
105 -18.0930092 -20.3923561
106 -13.0096759 -18.0930092
107 -8.7596759 -13.0096759
108 -5.6269956 -8.7596759
109 -2.4731495 -5.6269956
110 1.6037736 -2.4731495
111 4.3730044 1.6037736
112 2.3730044 4.3730044
113 5.4499274 2.3730044
114 1.8345428 5.4499274
115 -1.3962264 1.8345428
116 -1.3962264 -1.3962264
117 -2.0968795 -1.3962264
118 0.9864538 -2.0968795
119 6.2364538 0.9864538
120 7.3691340 6.2364538
121 7.5229802 7.3691340
122 7.5999032 7.5229802
123 5.3691340 7.5999032
124 4.3691340 5.3691340
125 5.4460571 4.3691340
126 1.8306725 5.4460571
127 -1.4000968 1.8306725
128 -2.4000968 -1.4000968
129 -5.1007499 -2.4000968
130 -4.0174165 -5.1007499
131 -4.7674165 -4.0174165
132 -2.6347363 -4.7674165
133 -3.4808902 -2.6347363
134 -2.4039671 -3.4808902
135 -2.6347363 -2.4039671
136 -2.6347363 -2.6347363
137 -3.5578133 -2.6347363
138 -7.1731979 -3.5578133
139 -9.4039671 -7.1731979
140 -10.4039671 -9.4039671
141 -10.1046202 -10.4039671
142 -7.0212869 -10.1046202
143 -6.7712869 -7.0212869
144 -0.6386067 -6.7712869
145 1.5152395 -0.6386067
146 0.5921626 1.5152395
147 0.3613933 0.5921626
148 2.3613933 0.3613933
149 3.4383164 2.3613933
150 -4.1770682 3.4383164
151 -1.4078374 -4.1770682
152 -0.4078374 -1.4078374
> 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/73p2g1353676653.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/847vy1353676653.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/94yxm1353676653.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/10yow51353676653.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/11owpb1353676653.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/12bzt71353676653.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/13bvsn1353676653.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/14vg191353676653.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/150oeg1353676653.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/169zak1353676653.tab")
+ }
>
> try(system("convert tmp/11yr41353676652.ps tmp/11yr41353676652.png",intern=TRUE))
character(0)
> try(system("convert tmp/2eyez1353676652.ps tmp/2eyez1353676652.png",intern=TRUE))
character(0)
> try(system("convert tmp/3sgt81353676652.ps tmp/3sgt81353676652.png",intern=TRUE))
character(0)
> try(system("convert tmp/42nfa1353676653.ps tmp/42nfa1353676653.png",intern=TRUE))
character(0)
> try(system("convert tmp/5piwt1353676653.ps tmp/5piwt1353676653.png",intern=TRUE))
character(0)
> try(system("convert tmp/6l2xg1353676653.ps tmp/6l2xg1353676653.png",intern=TRUE))
character(0)
> try(system("convert tmp/73p2g1353676653.ps tmp/73p2g1353676653.png",intern=TRUE))
character(0)
> try(system("convert tmp/847vy1353676653.ps tmp/847vy1353676653.png",intern=TRUE))
character(0)
> try(system("convert tmp/94yxm1353676653.ps tmp/94yxm1353676653.png",intern=TRUE))
character(0)
> try(system("convert tmp/10yow51353676653.ps tmp/10yow51353676653.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.288 0.914 8.197