R version 2.11.1 (2010-05-31)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(2,14,2,18,2,11,1,12,2,16,2,18,2,14,2,14,2,15,2,15,1,17,2,19,1,10,2,16,2,18,1,14,1,14,2,17,1,14,2,16,1,18,2,11,2,14,2,12,1,17,2,9,1,16,2,14,2,15,1,11,2,16,1,13,2,17,2,15,1,14,1,16,1,9,1,15,2,17,1,13,1,15,2,16,1,16,1,12,2,12,2,11,2,15,2,15,2,17,1,13,2,16,1,14,1,11,2,12,1,12,2,15,2,16,2,15,1,12,2,12,1,8,1,13,2,11,2,14,2,15,1,10,2,11,1,12,2,15,1,15,1,14,2,16,2,15,1,15,1,13,2,12,2,17,2,13,1,15,1,13,1,15,1,16,2,15,1,16,2,15,2,14,1,15,2,14,2,13,2,7,2,17,2,13,2,15,2,14,2,13,2,16,2,12,2,14,1,17,1,15,2,17,1,12,2,16,1,11,2,15,1,9,2,16,1,15,1,10,2,10,2,15,2,11,2,13,1,14,2,18,1,16,2,14,2,14,2,14,2,14,2,12,2,14,2,15,2,15,2,15,2,13,1,17,2,17,2,19,2,15,1,13,1,9,2,15,1,15,1,15,2,16,1,11,1,14,2,11,2,15,1,13,2,15,1,16,2,14,1,15,2,16,2,16,1,11,1,12,1,9,2,16,2,13,1,16,2,12,2,9,2,13,2,13,2,14,2,19,2,13,2,12,2,13),dim=c(2,162),dimnames=list(c('x','y'),1:162))
> y <- array(NA,dim=c(2,162),dimnames=list(c('x','y'),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 = 'Include Monthly Dummies'
> par1 = '2'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> 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
y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 14 2 1 0 0 0 0 0 0 0 0 0 0 1
2 18 2 0 1 0 0 0 0 0 0 0 0 0 2
3 11 2 0 0 1 0 0 0 0 0 0 0 0 3
4 12 1 0 0 0 1 0 0 0 0 0 0 0 4
5 16 2 0 0 0 0 1 0 0 0 0 0 0 5
6 18 2 0 0 0 0 0 1 0 0 0 0 0 6
7 14 2 0 0 0 0 0 0 1 0 0 0 0 7
8 14 2 0 0 0 0 0 0 0 1 0 0 0 8
9 15 2 0 0 0 0 0 0 0 0 1 0 0 9
10 15 2 0 0 0 0 0 0 0 0 0 1 0 10
11 17 1 0 0 0 0 0 0 0 0 0 0 1 11
12 19 2 0 0 0 0 0 0 0 0 0 0 0 12
13 10 1 1 0 0 0 0 0 0 0 0 0 0 13
14 16 2 0 1 0 0 0 0 0 0 0 0 0 14
15 18 2 0 0 1 0 0 0 0 0 0 0 0 15
16 14 1 0 0 0 1 0 0 0 0 0 0 0 16
17 14 1 0 0 0 0 1 0 0 0 0 0 0 17
18 17 2 0 0 0 0 0 1 0 0 0 0 0 18
19 14 1 0 0 0 0 0 0 1 0 0 0 0 19
20 16 2 0 0 0 0 0 0 0 1 0 0 0 20
21 18 1 0 0 0 0 0 0 0 0 1 0 0 21
22 11 2 0 0 0 0 0 0 0 0 0 1 0 22
23 14 2 0 0 0 0 0 0 0 0 0 0 1 23
24 12 2 0 0 0 0 0 0 0 0 0 0 0 24
25 17 1 1 0 0 0 0 0 0 0 0 0 0 25
26 9 2 0 1 0 0 0 0 0 0 0 0 0 26
27 16 1 0 0 1 0 0 0 0 0 0 0 0 27
28 14 2 0 0 0 1 0 0 0 0 0 0 0 28
29 15 2 0 0 0 0 1 0 0 0 0 0 0 29
30 11 1 0 0 0 0 0 1 0 0 0 0 0 30
31 16 2 0 0 0 0 0 0 1 0 0 0 0 31
32 13 1 0 0 0 0 0 0 0 1 0 0 0 32
33 17 2 0 0 0 0 0 0 0 0 1 0 0 33
34 15 2 0 0 0 0 0 0 0 0 0 1 0 34
35 14 1 0 0 0 0 0 0 0 0 0 0 1 35
36 16 1 0 0 0 0 0 0 0 0 0 0 0 36
37 9 1 1 0 0 0 0 0 0 0 0 0 0 37
38 15 1 0 1 0 0 0 0 0 0 0 0 0 38
39 17 2 0 0 1 0 0 0 0 0 0 0 0 39
40 13 1 0 0 0 1 0 0 0 0 0 0 0 40
41 15 1 0 0 0 0 1 0 0 0 0 0 0 41
42 16 2 0 0 0 0 0 1 0 0 0 0 0 42
43 16 1 0 0 0 0 0 0 1 0 0 0 0 43
44 12 1 0 0 0 0 0 0 0 1 0 0 0 44
45 12 2 0 0 0 0 0 0 0 0 1 0 0 45
46 11 2 0 0 0 0 0 0 0 0 0 1 0 46
47 15 2 0 0 0 0 0 0 0 0 0 0 1 47
48 15 2 0 0 0 0 0 0 0 0 0 0 0 48
49 17 2 1 0 0 0 0 0 0 0 0 0 0 49
50 13 1 0 1 0 0 0 0 0 0 0 0 0 50
51 16 2 0 0 1 0 0 0 0 0 0 0 0 51
52 14 1 0 0 0 1 0 0 0 0 0 0 0 52
53 11 1 0 0 0 0 1 0 0 0 0 0 0 53
54 12 2 0 0 0 0 0 1 0 0 0 0 0 54
55 12 1 0 0 0 0 0 0 1 0 0 0 0 55
56 15 2 0 0 0 0 0 0 0 1 0 0 0 56
57 16 2 0 0 0 0 0 0 0 0 1 0 0 57
58 15 2 0 0 0 0 0 0 0 0 0 1 0 58
59 12 1 0 0 0 0 0 0 0 0 0 0 1 59
60 12 2 0 0 0 0 0 0 0 0 0 0 0 60
61 8 1 1 0 0 0 0 0 0 0 0 0 0 61
62 13 1 0 1 0 0 0 0 0 0 0 0 0 62
63 11 2 0 0 1 0 0 0 0 0 0 0 0 63
64 14 2 0 0 0 1 0 0 0 0 0 0 0 64
65 15 2 0 0 0 0 1 0 0 0 0 0 0 65
66 10 1 0 0 0 0 0 1 0 0 0 0 0 66
67 11 2 0 0 0 0 0 0 1 0 0 0 0 67
68 12 1 0 0 0 0 0 0 0 1 0 0 0 68
69 15 2 0 0 0 0 0 0 0 0 1 0 0 69
70 15 1 0 0 0 0 0 0 0 0 0 1 0 70
71 14 1 0 0 0 0 0 0 0 0 0 0 1 71
72 16 2 0 0 0 0 0 0 0 0 0 0 0 72
73 15 2 1 0 0 0 0 0 0 0 0 0 0 73
74 15 1 0 1 0 0 0 0 0 0 0 0 0 74
75 13 1 0 0 1 0 0 0 0 0 0 0 0 75
76 12 2 0 0 0 1 0 0 0 0 0 0 0 76
77 17 2 0 0 0 0 1 0 0 0 0 0 0 77
78 13 2 0 0 0 0 0 1 0 0 0 0 0 78
79 15 1 0 0 0 0 0 0 1 0 0 0 0 79
80 13 1 0 0 0 0 0 0 0 1 0 0 0 80
81 15 1 0 0 0 0 0 0 0 0 1 0 0 81
82 16 1 0 0 0 0 0 0 0 0 0 1 0 82
83 15 2 0 0 0 0 0 0 0 0 0 0 1 83
84 16 1 0 0 0 0 0 0 0 0 0 0 0 84
85 15 2 1 0 0 0 0 0 0 0 0 0 0 85
86 14 2 0 1 0 0 0 0 0 0 0 0 0 86
87 15 1 0 0 1 0 0 0 0 0 0 0 0 87
88 14 2 0 0 0 1 0 0 0 0 0 0 0 88
89 13 2 0 0 0 0 1 0 0 0 0 0 0 89
90 7 2 0 0 0 0 0 1 0 0 0 0 0 90
91 17 2 0 0 0 0 0 0 1 0 0 0 0 91
92 13 2 0 0 0 0 0 0 0 1 0 0 0 92
93 15 2 0 0 0 0 0 0 0 0 1 0 0 93
94 14 2 0 0 0 0 0 0 0 0 0 1 0 94
95 13 2 0 0 0 0 0 0 0 0 0 0 1 95
96 16 2 0 0 0 0 0 0 0 0 0 0 0 96
97 12 2 1 0 0 0 0 0 0 0 0 0 0 97
98 14 2 0 1 0 0 0 0 0 0 0 0 0 98
99 17 1 0 0 1 0 0 0 0 0 0 0 0 99
100 15 1 0 0 0 1 0 0 0 0 0 0 0 100
101 17 2 0 0 0 0 1 0 0 0 0 0 0 101
102 12 1 0 0 0 0 0 1 0 0 0 0 0 102
103 16 2 0 0 0 0 0 0 1 0 0 0 0 103
104 11 1 0 0 0 0 0 0 0 1 0 0 0 104
105 15 2 0 0 0 0 0 0 0 0 1 0 0 105
106 9 1 0 0 0 0 0 0 0 0 0 1 0 106
107 16 2 0 0 0 0 0 0 0 0 0 0 1 107
108 15 1 0 0 0 0 0 0 0 0 0 0 0 108
109 10 1 1 0 0 0 0 0 0 0 0 0 0 109
110 10 2 0 1 0 0 0 0 0 0 0 0 0 110
111 15 2 0 0 1 0 0 0 0 0 0 0 0 111
112 11 2 0 0 0 1 0 0 0 0 0 0 0 112
113 13 2 0 0 0 0 1 0 0 0 0 0 0 113
114 14 1 0 0 0 0 0 1 0 0 0 0 0 114
115 18 2 0 0 0 0 0 0 1 0 0 0 0 115
116 16 1 0 0 0 0 0 0 0 1 0 0 0 116
117 14 2 0 0 0 0 0 0 0 0 1 0 0 117
118 14 2 0 0 0 0 0 0 0 0 0 1 0 118
119 14 2 0 0 0 0 0 0 0 0 0 0 1 119
120 14 2 0 0 0 0 0 0 0 0 0 0 0 120
121 12 2 1 0 0 0 0 0 0 0 0 0 0 121
122 14 2 0 1 0 0 0 0 0 0 0 0 0 122
123 15 2 0 0 1 0 0 0 0 0 0 0 0 123
124 15 2 0 0 0 1 0 0 0 0 0 0 0 124
125 15 2 0 0 0 0 1 0 0 0 0 0 0 125
126 13 2 0 0 0 0 0 1 0 0 0 0 0 126
127 17 1 0 0 0 0 0 0 1 0 0 0 0 127
128 17 2 0 0 0 0 0 0 0 1 0 0 0 128
129 19 2 0 0 0 0 0 0 0 0 1 0 0 129
130 15 2 0 0 0 0 0 0 0 0 0 1 0 130
131 13 1 0 0 0 0 0 0 0 0 0 0 1 131
132 9 1 0 0 0 0 0 0 0 0 0 0 0 132
133 15 2 1 0 0 0 0 0 0 0 0 0 0 133
134 15 1 0 1 0 0 0 0 0 0 0 0 0 134
135 15 1 0 0 1 0 0 0 0 0 0 0 0 135
136 16 2 0 0 0 1 0 0 0 0 0 0 0 136
137 11 1 0 0 0 0 1 0 0 0 0 0 0 137
138 14 1 0 0 0 0 0 1 0 0 0 0 0 138
139 11 2 0 0 0 0 0 0 1 0 0 0 0 139
140 15 2 0 0 0 0 0 0 0 1 0 0 0 140
141 13 1 0 0 0 0 0 0 0 0 1 0 0 141
142 15 2 0 0 0 0 0 0 0 0 0 1 0 142
143 16 1 0 0 0 0 0 0 0 0 0 0 1 143
144 14 2 0 0 0 0 0 0 0 0 0 0 0 144
145 15 1 1 0 0 0 0 0 0 0 0 0 0 145
146 16 2 0 1 0 0 0 0 0 0 0 0 0 146
147 16 2 0 0 1 0 0 0 0 0 0 0 0 147
148 11 1 0 0 0 1 0 0 0 0 0 0 0 148
149 12 1 0 0 0 0 1 0 0 0 0 0 0 149
150 9 1 0 0 0 0 0 1 0 0 0 0 0 150
151 16 2 0 0 0 0 0 0 1 0 0 0 0 151
152 13 2 0 0 0 0 0 0 0 1 0 0 0 152
153 16 1 0 0 0 0 0 0 0 0 1 0 0 153
154 12 2 0 0 0 0 0 0 0 0 0 1 0 154
155 9 2 0 0 0 0 0 0 0 0 0 0 1 155
156 13 2 0 0 0 0 0 0 0 0 0 0 0 156
157 13 2 1 0 0 0 0 0 0 0 0 0 0 157
158 14 2 0 1 0 0 0 0 0 0 0 0 0 158
159 19 2 0 0 1 0 0 0 0 0 0 0 0 159
160 13 2 0 0 0 1 0 0 0 0 0 0 0 160
161 12 2 0 0 0 0 1 0 0 0 0 0 0 161
162 13 2 0 0 0 0 0 1 0 0 0 0 0 162
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x M1 M2 M3 M4
13.428303 0.832898 -1.310912 -0.365009 0.926100 -0.866155
M5 M6 M7 M8 M9 M10
-0.348823 -1.498221 0.498631 -0.431905 0.983814 -0.844090
M11 t
-0.261873 -0.005395
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.1103 -1.2947 0.1908 1.4500 4.4365
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.428303 0.923422 14.542 <2e-16 ***
x 0.832898 0.367901 2.264 0.0250 *
M1 -1.310912 0.865430 -1.515 0.1320
M2 -0.365009 0.864442 -0.422 0.6735
M3 0.926100 0.864388 1.071 0.2857
M4 -0.866155 0.865290 -1.001 0.3185
M5 -0.348823 0.864331 -0.404 0.6871
M6 -1.498221 0.865280 -1.731 0.0854 .
M7 0.498631 0.880616 0.566 0.5721
M8 -0.431905 0.881885 -0.490 0.6250
M9 0.983814 0.880066 1.118 0.2654
M10 -0.844090 0.880495 -0.959 0.3393
M11 -0.261873 0.881806 -0.297 0.7669
t -0.005395 0.003778 -1.428 0.1554
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.244 on 148 degrees of freedom
Multiple R-squared: 0.1532, Adjusted R-squared: 0.07886
F-statistic: 2.06 on 13 and 148 DF, p-value: 0.01975
> 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.7757051 0.44858986 0.224294932
[2,] 0.7461282 0.50774368 0.253871839
[3,] 0.6877758 0.62444843 0.312224216
[4,] 0.5734685 0.85306310 0.426531548
[5,] 0.6638957 0.67220850 0.336104252
[6,] 0.7796051 0.44078989 0.220394944
[7,] 0.7856082 0.42878368 0.214391839
[8,] 0.9033672 0.19326563 0.096632815
[9,] 0.9592302 0.08153969 0.040769847
[10,] 0.9934333 0.01313339 0.006566694
[11,] 0.9900975 0.01980493 0.009902467
[12,] 0.9896046 0.02079071 0.010395353
[13,] 0.9842655 0.03146898 0.015734491
[14,] 0.9928276 0.01434486 0.007172428
[15,] 0.9914077 0.01718460 0.008592302
[16,] 0.9868653 0.02626942 0.013134708
[17,] 0.9814858 0.03702834 0.018514169
[18,] 0.9781964 0.04360719 0.021803596
[19,] 0.9689258 0.06214839 0.031074196
[20,] 0.9622945 0.07541107 0.037705536
[21,] 0.9702177 0.05956468 0.029782340
[22,] 0.9646505 0.07069895 0.035349477
[23,] 0.9609978 0.07800434 0.039002172
[24,] 0.9468413 0.10631738 0.053158690
[25,] 0.9336080 0.13278405 0.066392027
[26,] 0.9298216 0.14035677 0.070178387
[27,] 0.9209148 0.15817043 0.079085214
[28,] 0.9054805 0.18903903 0.094519516
[29,] 0.9316277 0.13674459 0.068372294
[30,] 0.9277307 0.14453866 0.072269328
[31,] 0.9089196 0.18216080 0.091080398
[32,] 0.8852304 0.22953918 0.114769591
[33,] 0.9335477 0.13290469 0.066452346
[34,] 0.9145769 0.17084625 0.085423124
[35,] 0.8939243 0.21215139 0.106075694
[36,] 0.8754452 0.24910961 0.124554806
[37,] 0.8800356 0.23992871 0.119964353
[38,] 0.8761180 0.24776406 0.123882030
[39,] 0.8666866 0.26662670 0.133313351
[40,] 0.8465212 0.30695752 0.153478758
[41,] 0.8178214 0.36435722 0.182178608
[42,] 0.8083120 0.38337606 0.191688030
[43,] 0.7872759 0.42544815 0.212724075
[44,] 0.7917147 0.41657061 0.208285306
[45,] 0.8580149 0.28397023 0.141985114
[46,] 0.8292505 0.34149892 0.170749462
[47,] 0.8827592 0.23448155 0.117240773
[48,] 0.8600318 0.27993642 0.139968210
[49,] 0.8381744 0.32365116 0.161825579
[50,] 0.8344594 0.33108122 0.165540608
[51,] 0.8800070 0.23998601 0.119993005
[52,] 0.8624184 0.27516316 0.137581578
[53,] 0.8365330 0.32693403 0.163467017
[54,] 0.8492550 0.30148990 0.150744952
[55,] 0.8225640 0.35487206 0.177436029
[56,] 0.8096613 0.38067732 0.190338661
[57,] 0.8096882 0.38062351 0.190311753
[58,] 0.8001743 0.39965143 0.199825716
[59,] 0.7905127 0.41897455 0.209487274
[60,] 0.7710688 0.45786236 0.228931180
[61,] 0.7977712 0.40445754 0.202228769
[62,] 0.7633843 0.47323137 0.236615685
[63,] 0.7463597 0.50728067 0.253640337
[64,] 0.7113758 0.57724831 0.288624154
[65,] 0.6725089 0.65498225 0.327491124
[66,] 0.7119579 0.57608426 0.288042131
[67,] 0.6763370 0.64732608 0.323663041
[68,] 0.6813350 0.63732996 0.318664981
[69,] 0.6714322 0.65713567 0.328567835
[70,] 0.6257533 0.74849345 0.374246727
[71,] 0.5890443 0.82191150 0.410955748
[72,] 0.5433148 0.91337032 0.456685161
[73,] 0.5032525 0.99349495 0.496747473
[74,] 0.7524535 0.49509305 0.247546523
[75,] 0.7457908 0.50841835 0.254209177
[76,] 0.7210668 0.55786639 0.278933197
[77,] 0.6826099 0.63478012 0.317390059
[78,] 0.6384255 0.72314898 0.361574490
[79,] 0.6025884 0.79482314 0.397411571
[80,] 0.5851294 0.82974114 0.414870568
[81,] 0.5507194 0.89856126 0.449280632
[82,] 0.5010757 0.99784860 0.498924300
[83,] 0.4994043 0.99880850 0.500595750
[84,] 0.4978438 0.99568763 0.502156186
[85,] 0.5505493 0.89890136 0.449450682
[86,] 0.4991888 0.99837765 0.500811176
[87,] 0.4572772 0.91455445 0.542722774
[88,] 0.4807411 0.96148221 0.519258897
[89,] 0.4344430 0.86888608 0.565556959
[90,] 0.5371969 0.92560617 0.462803087
[91,] 0.5285554 0.94288929 0.471444643
[92,] 0.5210482 0.95790352 0.478951758
[93,] 0.5526880 0.89462400 0.447312000
[94,] 0.7060960 0.58780805 0.293904023
[95,] 0.6830741 0.63385189 0.316925944
[96,] 0.7309084 0.53818310 0.269091550
[97,] 0.6899914 0.62001717 0.310008585
[98,] 0.6585297 0.68294056 0.341470279
[99,] 0.6742072 0.65158558 0.325792791
[100,] 0.6568408 0.68631843 0.343159216
[101,] 0.6714115 0.65717703 0.328588517
[102,] 0.6222195 0.75556109 0.377780543
[103,] 0.5641680 0.87166404 0.435832022
[104,] 0.5112411 0.97751786 0.488758929
[105,] 0.5427045 0.91459108 0.457295540
[106,] 0.5301097 0.93978054 0.469890268
[107,] 0.5653384 0.86932320 0.434661598
[108,] 0.5111178 0.97776442 0.488882212
[109,] 0.4529751 0.90595025 0.547024876
[110,] 0.4093661 0.81873215 0.590633926
[111,] 0.4707701 0.94154022 0.529229890
[112,] 0.4516703 0.90334053 0.548329737
[113,] 0.4415774 0.88315477 0.558422615
[114,] 0.3810729 0.76214587 0.618927067
[115,] 0.3162765 0.63255298 0.683723512
[116,] 0.4188269 0.83765387 0.581173064
[117,] 0.3543766 0.70875322 0.645623391
[118,] 0.2906115 0.58122301 0.709388497
[119,] 0.2779461 0.55589224 0.722053879
[120,] 0.3100598 0.62011954 0.689940232
[121,] 0.2593783 0.51875658 0.740621708
[122,] 0.2478723 0.49574460 0.752127702
[123,] 0.3399469 0.67989375 0.660053126
[124,] 0.2757577 0.55151531 0.724242344
[125,] 0.2658224 0.53164489 0.734177556
[126,] 0.2238067 0.44761341 0.776193294
[127,] 0.6510302 0.69793968 0.348969840
[128,] 0.5274063 0.94518739 0.472593696
[129,] 0.5721191 0.85576181 0.427880905
> postscript(file="/var/www/rcomp/tmp/1z8m61290776646.ps",horizontal=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/www/rcomp/tmp/2z8m61290776646.ps",horizontal=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/www/rcomp/tmp/3ahm91290776646.ps",horizontal=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/www/rcomp/tmp/4ahm91290776646.ps",horizontal=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/www/rcomp/tmp/5ahm91290776646.ps",horizontal=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.22220856 3.28170127 -5.00401302 -1.37346502 1.28170127 4.43649428
7 8 9 10 11 12
-1.55496245 -0.61903151 -1.02935492 0.80394491 3.06002018 3.97064508
13 14 15 16 17 18
-2.88014971 1.34644515 2.06073086 0.69127886 0.17934299 3.50123816
19 20 21 22 23 24
-0.65732073 1.44571237 2.86828680 -3.13131121 -0.70813379 -2.96461104
25 26 27 28 29 30
4.18459417 -5.58881097 0.95837258 -0.07687511 0.41118903 -1.60112012
31 32 33 34 35 36
0.57452531 -0.65664591 1.10013284 0.93343267 0.18950794 1.93303068
37 38 39 40 41 42
-3.75066195 1.30883075 1.19021862 -0.17923338 1.30883075 2.63072592
43 44 45 46 47 48
1.47216703 -1.59190203 -3.83512328 -3.00182345 0.42135397 0.16487672
49 50 51 52 53 54
3.48118408 -0.62642537 0.25496250 0.88551050 -2.62642537 -1.30453020
55 56 57 58 59 60
-2.46308909 0.63994401 0.22962060 1.06292043 -1.68100430 -2.77037940
61 62 63 64 65 66
-4.62117419 -0.56168149 -4.68029362 0.11735653 0.60542066 -2.40688848
67 68 69 70 71 72
-4.23124305 -1.46241427 -0.70563552 1.96056215 0.38373957 1.29436448
73 74 75 76 77 78
1.61067184 1.50306239 -1.78265190 -1.81789959 2.67016454 -0.17504244
79 80 81 82 83 84
0.66639867 -0.39767039 0.19200620 3.02530603 0.61558561 2.19200620
85 86 87 88 89 90
1.67541572 -0.26509158 0.28209198 0.24684429 -1.26509158 -6.11029856
91 92 93 94 95 96
1.89824471 -1.16582436 -0.57614776 0.25715207 -1.31967051 1.42385224
97 98 99 100 101 102
-1.25984040 -0.20034770 2.34683586 2.14448602 2.79965230 -0.21265684
103 104 105 106 107 108
0.96298859 -2.26818263 -0.51140388 -3.84520621 1.74507337 1.32149396
109 110 111 112 113 114
-2.36219868 -4.13560382 -0.42131810 -2.62366795 -1.13560382 1.85208704
115 116 117 118 119 120
3.02773247 2.79656125 -1.44666001 0.38663983 -0.19018275 -0.44666001
121 122 123 124 125 126
-1.13035264 -0.07085994 -0.35657422 1.44107593 0.92914006 0.08393307
127 128 129 130 131 132
2.92537419 3.02840728 3.61808387 1.45138371 -0.29254103 -4.54901828
133 134 135 136 137 138
1.93439124 1.82678179 0.54106750 2.50581981 -2.17321821 1.98157480
139 140 141 142 143 144
-3.84277977 1.09315116 -1.48427440 1.51612759 2.77220285 -0.31717225
145 146 147 148 149 150
2.83203296 2.05862782 0.77291354 -1.59653847 -1.10847433 -2.95368132
151 152 153 154 155 156
1.22196411 -0.84210496 1.58046948 -1.41912853 -4.99595111 -1.25242837
157 158 159 160 161 162
0.06387900 0.12337170 3.83765742 -0.36469243 -1.87662830 0.27816471
> postscript(file="/var/www/rcomp/tmp/6k8lb1290776646.ps",horizontal=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.22220856 NA
1 3.28170127 0.22220856
2 -5.00401302 3.28170127
3 -1.37346502 -5.00401302
4 1.28170127 -1.37346502
5 4.43649428 1.28170127
6 -1.55496245 4.43649428
7 -0.61903151 -1.55496245
8 -1.02935492 -0.61903151
9 0.80394491 -1.02935492
10 3.06002018 0.80394491
11 3.97064508 3.06002018
12 -2.88014971 3.97064508
13 1.34644515 -2.88014971
14 2.06073086 1.34644515
15 0.69127886 2.06073086
16 0.17934299 0.69127886
17 3.50123816 0.17934299
18 -0.65732073 3.50123816
19 1.44571237 -0.65732073
20 2.86828680 1.44571237
21 -3.13131121 2.86828680
22 -0.70813379 -3.13131121
23 -2.96461104 -0.70813379
24 4.18459417 -2.96461104
25 -5.58881097 4.18459417
26 0.95837258 -5.58881097
27 -0.07687511 0.95837258
28 0.41118903 -0.07687511
29 -1.60112012 0.41118903
30 0.57452531 -1.60112012
31 -0.65664591 0.57452531
32 1.10013284 -0.65664591
33 0.93343267 1.10013284
34 0.18950794 0.93343267
35 1.93303068 0.18950794
36 -3.75066195 1.93303068
37 1.30883075 -3.75066195
38 1.19021862 1.30883075
39 -0.17923338 1.19021862
40 1.30883075 -0.17923338
41 2.63072592 1.30883075
42 1.47216703 2.63072592
43 -1.59190203 1.47216703
44 -3.83512328 -1.59190203
45 -3.00182345 -3.83512328
46 0.42135397 -3.00182345
47 0.16487672 0.42135397
48 3.48118408 0.16487672
49 -0.62642537 3.48118408
50 0.25496250 -0.62642537
51 0.88551050 0.25496250
52 -2.62642537 0.88551050
53 -1.30453020 -2.62642537
54 -2.46308909 -1.30453020
55 0.63994401 -2.46308909
56 0.22962060 0.63994401
57 1.06292043 0.22962060
58 -1.68100430 1.06292043
59 -2.77037940 -1.68100430
60 -4.62117419 -2.77037940
61 -0.56168149 -4.62117419
62 -4.68029362 -0.56168149
63 0.11735653 -4.68029362
64 0.60542066 0.11735653
65 -2.40688848 0.60542066
66 -4.23124305 -2.40688848
67 -1.46241427 -4.23124305
68 -0.70563552 -1.46241427
69 1.96056215 -0.70563552
70 0.38373957 1.96056215
71 1.29436448 0.38373957
72 1.61067184 1.29436448
73 1.50306239 1.61067184
74 -1.78265190 1.50306239
75 -1.81789959 -1.78265190
76 2.67016454 -1.81789959
77 -0.17504244 2.67016454
78 0.66639867 -0.17504244
79 -0.39767039 0.66639867
80 0.19200620 -0.39767039
81 3.02530603 0.19200620
82 0.61558561 3.02530603
83 2.19200620 0.61558561
84 1.67541572 2.19200620
85 -0.26509158 1.67541572
86 0.28209198 -0.26509158
87 0.24684429 0.28209198
88 -1.26509158 0.24684429
89 -6.11029856 -1.26509158
90 1.89824471 -6.11029856
91 -1.16582436 1.89824471
92 -0.57614776 -1.16582436
93 0.25715207 -0.57614776
94 -1.31967051 0.25715207
95 1.42385224 -1.31967051
96 -1.25984040 1.42385224
97 -0.20034770 -1.25984040
98 2.34683586 -0.20034770
99 2.14448602 2.34683586
100 2.79965230 2.14448602
101 -0.21265684 2.79965230
102 0.96298859 -0.21265684
103 -2.26818263 0.96298859
104 -0.51140388 -2.26818263
105 -3.84520621 -0.51140388
106 1.74507337 -3.84520621
107 1.32149396 1.74507337
108 -2.36219868 1.32149396
109 -4.13560382 -2.36219868
110 -0.42131810 -4.13560382
111 -2.62366795 -0.42131810
112 -1.13560382 -2.62366795
113 1.85208704 -1.13560382
114 3.02773247 1.85208704
115 2.79656125 3.02773247
116 -1.44666001 2.79656125
117 0.38663983 -1.44666001
118 -0.19018275 0.38663983
119 -0.44666001 -0.19018275
120 -1.13035264 -0.44666001
121 -0.07085994 -1.13035264
122 -0.35657422 -0.07085994
123 1.44107593 -0.35657422
124 0.92914006 1.44107593
125 0.08393307 0.92914006
126 2.92537419 0.08393307
127 3.02840728 2.92537419
128 3.61808387 3.02840728
129 1.45138371 3.61808387
130 -0.29254103 1.45138371
131 -4.54901828 -0.29254103
132 1.93439124 -4.54901828
133 1.82678179 1.93439124
134 0.54106750 1.82678179
135 2.50581981 0.54106750
136 -2.17321821 2.50581981
137 1.98157480 -2.17321821
138 -3.84277977 1.98157480
139 1.09315116 -3.84277977
140 -1.48427440 1.09315116
141 1.51612759 -1.48427440
142 2.77220285 1.51612759
143 -0.31717225 2.77220285
144 2.83203296 -0.31717225
145 2.05862782 2.83203296
146 0.77291354 2.05862782
147 -1.59653847 0.77291354
148 -1.10847433 -1.59653847
149 -2.95368132 -1.10847433
150 1.22196411 -2.95368132
151 -0.84210496 1.22196411
152 1.58046948 -0.84210496
153 -1.41912853 1.58046948
154 -4.99595111 -1.41912853
155 -1.25242837 -4.99595111
156 0.06387900 -1.25242837
157 0.12337170 0.06387900
158 3.83765742 0.12337170
159 -0.36469243 3.83765742
160 -1.87662830 -0.36469243
161 0.27816471 -1.87662830
162 NA 0.27816471
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.28170127 0.22220856
[2,] -5.00401302 3.28170127
[3,] -1.37346502 -5.00401302
[4,] 1.28170127 -1.37346502
[5,] 4.43649428 1.28170127
[6,] -1.55496245 4.43649428
[7,] -0.61903151 -1.55496245
[8,] -1.02935492 -0.61903151
[9,] 0.80394491 -1.02935492
[10,] 3.06002018 0.80394491
[11,] 3.97064508 3.06002018
[12,] -2.88014971 3.97064508
[13,] 1.34644515 -2.88014971
[14,] 2.06073086 1.34644515
[15,] 0.69127886 2.06073086
[16,] 0.17934299 0.69127886
[17,] 3.50123816 0.17934299
[18,] -0.65732073 3.50123816
[19,] 1.44571237 -0.65732073
[20,] 2.86828680 1.44571237
[21,] -3.13131121 2.86828680
[22,] -0.70813379 -3.13131121
[23,] -2.96461104 -0.70813379
[24,] 4.18459417 -2.96461104
[25,] -5.58881097 4.18459417
[26,] 0.95837258 -5.58881097
[27,] -0.07687511 0.95837258
[28,] 0.41118903 -0.07687511
[29,] -1.60112012 0.41118903
[30,] 0.57452531 -1.60112012
[31,] -0.65664591 0.57452531
[32,] 1.10013284 -0.65664591
[33,] 0.93343267 1.10013284
[34,] 0.18950794 0.93343267
[35,] 1.93303068 0.18950794
[36,] -3.75066195 1.93303068
[37,] 1.30883075 -3.75066195
[38,] 1.19021862 1.30883075
[39,] -0.17923338 1.19021862
[40,] 1.30883075 -0.17923338
[41,] 2.63072592 1.30883075
[42,] 1.47216703 2.63072592
[43,] -1.59190203 1.47216703
[44,] -3.83512328 -1.59190203
[45,] -3.00182345 -3.83512328
[46,] 0.42135397 -3.00182345
[47,] 0.16487672 0.42135397
[48,] 3.48118408 0.16487672
[49,] -0.62642537 3.48118408
[50,] 0.25496250 -0.62642537
[51,] 0.88551050 0.25496250
[52,] -2.62642537 0.88551050
[53,] -1.30453020 -2.62642537
[54,] -2.46308909 -1.30453020
[55,] 0.63994401 -2.46308909
[56,] 0.22962060 0.63994401
[57,] 1.06292043 0.22962060
[58,] -1.68100430 1.06292043
[59,] -2.77037940 -1.68100430
[60,] -4.62117419 -2.77037940
[61,] -0.56168149 -4.62117419
[62,] -4.68029362 -0.56168149
[63,] 0.11735653 -4.68029362
[64,] 0.60542066 0.11735653
[65,] -2.40688848 0.60542066
[66,] -4.23124305 -2.40688848
[67,] -1.46241427 -4.23124305
[68,] -0.70563552 -1.46241427
[69,] 1.96056215 -0.70563552
[70,] 0.38373957 1.96056215
[71,] 1.29436448 0.38373957
[72,] 1.61067184 1.29436448
[73,] 1.50306239 1.61067184
[74,] -1.78265190 1.50306239
[75,] -1.81789959 -1.78265190
[76,] 2.67016454 -1.81789959
[77,] -0.17504244 2.67016454
[78,] 0.66639867 -0.17504244
[79,] -0.39767039 0.66639867
[80,] 0.19200620 -0.39767039
[81,] 3.02530603 0.19200620
[82,] 0.61558561 3.02530603
[83,] 2.19200620 0.61558561
[84,] 1.67541572 2.19200620
[85,] -0.26509158 1.67541572
[86,] 0.28209198 -0.26509158
[87,] 0.24684429 0.28209198
[88,] -1.26509158 0.24684429
[89,] -6.11029856 -1.26509158
[90,] 1.89824471 -6.11029856
[91,] -1.16582436 1.89824471
[92,] -0.57614776 -1.16582436
[93,] 0.25715207 -0.57614776
[94,] -1.31967051 0.25715207
[95,] 1.42385224 -1.31967051
[96,] -1.25984040 1.42385224
[97,] -0.20034770 -1.25984040
[98,] 2.34683586 -0.20034770
[99,] 2.14448602 2.34683586
[100,] 2.79965230 2.14448602
[101,] -0.21265684 2.79965230
[102,] 0.96298859 -0.21265684
[103,] -2.26818263 0.96298859
[104,] -0.51140388 -2.26818263
[105,] -3.84520621 -0.51140388
[106,] 1.74507337 -3.84520621
[107,] 1.32149396 1.74507337
[108,] -2.36219868 1.32149396
[109,] -4.13560382 -2.36219868
[110,] -0.42131810 -4.13560382
[111,] -2.62366795 -0.42131810
[112,] -1.13560382 -2.62366795
[113,] 1.85208704 -1.13560382
[114,] 3.02773247 1.85208704
[115,] 2.79656125 3.02773247
[116,] -1.44666001 2.79656125
[117,] 0.38663983 -1.44666001
[118,] -0.19018275 0.38663983
[119,] -0.44666001 -0.19018275
[120,] -1.13035264 -0.44666001
[121,] -0.07085994 -1.13035264
[122,] -0.35657422 -0.07085994
[123,] 1.44107593 -0.35657422
[124,] 0.92914006 1.44107593
[125,] 0.08393307 0.92914006
[126,] 2.92537419 0.08393307
[127,] 3.02840728 2.92537419
[128,] 3.61808387 3.02840728
[129,] 1.45138371 3.61808387
[130,] -0.29254103 1.45138371
[131,] -4.54901828 -0.29254103
[132,] 1.93439124 -4.54901828
[133,] 1.82678179 1.93439124
[134,] 0.54106750 1.82678179
[135,] 2.50581981 0.54106750
[136,] -2.17321821 2.50581981
[137,] 1.98157480 -2.17321821
[138,] -3.84277977 1.98157480
[139,] 1.09315116 -3.84277977
[140,] -1.48427440 1.09315116
[141,] 1.51612759 -1.48427440
[142,] 2.77220285 1.51612759
[143,] -0.31717225 2.77220285
[144,] 2.83203296 -0.31717225
[145,] 2.05862782 2.83203296
[146,] 0.77291354 2.05862782
[147,] -1.59653847 0.77291354
[148,] -1.10847433 -1.59653847
[149,] -2.95368132 -1.10847433
[150,] 1.22196411 -2.95368132
[151,] -0.84210496 1.22196411
[152,] 1.58046948 -0.84210496
[153,] -1.41912853 1.58046948
[154,] -4.99595111 -1.41912853
[155,] -1.25242837 -4.99595111
[156,] 0.06387900 -1.25242837
[157,] 0.12337170 0.06387900
[158,] 3.83765742 0.12337170
[159,] -0.36469243 3.83765742
[160,] -1.87662830 -0.36469243
[161,] 0.27816471 -1.87662830
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.28170127 0.22220856
2 -5.00401302 3.28170127
3 -1.37346502 -5.00401302
4 1.28170127 -1.37346502
5 4.43649428 1.28170127
6 -1.55496245 4.43649428
7 -0.61903151 -1.55496245
8 -1.02935492 -0.61903151
9 0.80394491 -1.02935492
10 3.06002018 0.80394491
11 3.97064508 3.06002018
12 -2.88014971 3.97064508
13 1.34644515 -2.88014971
14 2.06073086 1.34644515
15 0.69127886 2.06073086
16 0.17934299 0.69127886
17 3.50123816 0.17934299
18 -0.65732073 3.50123816
19 1.44571237 -0.65732073
20 2.86828680 1.44571237
21 -3.13131121 2.86828680
22 -0.70813379 -3.13131121
23 -2.96461104 -0.70813379
24 4.18459417 -2.96461104
25 -5.58881097 4.18459417
26 0.95837258 -5.58881097
27 -0.07687511 0.95837258
28 0.41118903 -0.07687511
29 -1.60112012 0.41118903
30 0.57452531 -1.60112012
31 -0.65664591 0.57452531
32 1.10013284 -0.65664591
33 0.93343267 1.10013284
34 0.18950794 0.93343267
35 1.93303068 0.18950794
36 -3.75066195 1.93303068
37 1.30883075 -3.75066195
38 1.19021862 1.30883075
39 -0.17923338 1.19021862
40 1.30883075 -0.17923338
41 2.63072592 1.30883075
42 1.47216703 2.63072592
43 -1.59190203 1.47216703
44 -3.83512328 -1.59190203
45 -3.00182345 -3.83512328
46 0.42135397 -3.00182345
47 0.16487672 0.42135397
48 3.48118408 0.16487672
49 -0.62642537 3.48118408
50 0.25496250 -0.62642537
51 0.88551050 0.25496250
52 -2.62642537 0.88551050
53 -1.30453020 -2.62642537
54 -2.46308909 -1.30453020
55 0.63994401 -2.46308909
56 0.22962060 0.63994401
57 1.06292043 0.22962060
58 -1.68100430 1.06292043
59 -2.77037940 -1.68100430
60 -4.62117419 -2.77037940
61 -0.56168149 -4.62117419
62 -4.68029362 -0.56168149
63 0.11735653 -4.68029362
64 0.60542066 0.11735653
65 -2.40688848 0.60542066
66 -4.23124305 -2.40688848
67 -1.46241427 -4.23124305
68 -0.70563552 -1.46241427
69 1.96056215 -0.70563552
70 0.38373957 1.96056215
71 1.29436448 0.38373957
72 1.61067184 1.29436448
73 1.50306239 1.61067184
74 -1.78265190 1.50306239
75 -1.81789959 -1.78265190
76 2.67016454 -1.81789959
77 -0.17504244 2.67016454
78 0.66639867 -0.17504244
79 -0.39767039 0.66639867
80 0.19200620 -0.39767039
81 3.02530603 0.19200620
82 0.61558561 3.02530603
83 2.19200620 0.61558561
84 1.67541572 2.19200620
85 -0.26509158 1.67541572
86 0.28209198 -0.26509158
87 0.24684429 0.28209198
88 -1.26509158 0.24684429
89 -6.11029856 -1.26509158
90 1.89824471 -6.11029856
91 -1.16582436 1.89824471
92 -0.57614776 -1.16582436
93 0.25715207 -0.57614776
94 -1.31967051 0.25715207
95 1.42385224 -1.31967051
96 -1.25984040 1.42385224
97 -0.20034770 -1.25984040
98 2.34683586 -0.20034770
99 2.14448602 2.34683586
100 2.79965230 2.14448602
101 -0.21265684 2.79965230
102 0.96298859 -0.21265684
103 -2.26818263 0.96298859
104 -0.51140388 -2.26818263
105 -3.84520621 -0.51140388
106 1.74507337 -3.84520621
107 1.32149396 1.74507337
108 -2.36219868 1.32149396
109 -4.13560382 -2.36219868
110 -0.42131810 -4.13560382
111 -2.62366795 -0.42131810
112 -1.13560382 -2.62366795
113 1.85208704 -1.13560382
114 3.02773247 1.85208704
115 2.79656125 3.02773247
116 -1.44666001 2.79656125
117 0.38663983 -1.44666001
118 -0.19018275 0.38663983
119 -0.44666001 -0.19018275
120 -1.13035264 -0.44666001
121 -0.07085994 -1.13035264
122 -0.35657422 -0.07085994
123 1.44107593 -0.35657422
124 0.92914006 1.44107593
125 0.08393307 0.92914006
126 2.92537419 0.08393307
127 3.02840728 2.92537419
128 3.61808387 3.02840728
129 1.45138371 3.61808387
130 -0.29254103 1.45138371
131 -4.54901828 -0.29254103
132 1.93439124 -4.54901828
133 1.82678179 1.93439124
134 0.54106750 1.82678179
135 2.50581981 0.54106750
136 -2.17321821 2.50581981
137 1.98157480 -2.17321821
138 -3.84277977 1.98157480
139 1.09315116 -3.84277977
140 -1.48427440 1.09315116
141 1.51612759 -1.48427440
142 2.77220285 1.51612759
143 -0.31717225 2.77220285
144 2.83203296 -0.31717225
145 2.05862782 2.83203296
146 0.77291354 2.05862782
147 -1.59653847 0.77291354
148 -1.10847433 -1.59653847
149 -2.95368132 -1.10847433
150 1.22196411 -2.95368132
151 -0.84210496 1.22196411
152 1.58046948 -0.84210496
153 -1.41912853 1.58046948
154 -4.99595111 -1.41912853
155 -1.25242837 -4.99595111
156 0.06387900 -1.25242837
157 0.12337170 0.06387900
158 3.83765742 0.12337170
159 -0.36469243 3.83765742
160 -1.87662830 -0.36469243
161 0.27816471 -1.87662830
> 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/www/rcomp/tmp/7dikf1290776646.ps",horizontal=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/www/rcomp/tmp/8dikf1290776646.ps",horizontal=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/www/rcomp/tmp/9dikf1290776646.ps",horizontal=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/www/rcomp/tmp/10or1i1290776646.ps",horizontal=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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/www/rcomp/tmp/11990o1290776646.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/www/rcomp/tmp/12vsyt1290776646.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/www/rcomp/tmp/13jbd51290776646.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/www/rcomp/tmp/14ukvq1290776646.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/www/rcomp/tmp/15fkte1290776646.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/www/rcomp/tmp/166ohq1290776646.tab")
+ }
>
> try(system("convert tmp/1z8m61290776646.ps tmp/1z8m61290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/2z8m61290776646.ps tmp/2z8m61290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ahm91290776646.ps tmp/3ahm91290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ahm91290776646.ps tmp/4ahm91290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ahm91290776646.ps tmp/5ahm91290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k8lb1290776646.ps tmp/6k8lb1290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/7dikf1290776646.ps tmp/7dikf1290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dikf1290776646.ps tmp/8dikf1290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/9dikf1290776646.ps tmp/9dikf1290776646.png",intern=TRUE))
character(0)
> try(system("convert tmp/10or1i1290776646.ps tmp/10or1i1290776646.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.630 1.130 6.717