R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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.
Natural language support but running in an English locale
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,12,2,11,2,14,1,12,2,21,2,12,2,22,2,11,2,10,2,13,1,10,2,8,1,15,2,14,2,10,1,14,1,14,2,11,1,10,2,13,1,7,2,14,2,12,2,14,1,11,2,9,1,11,2,15,2,14,1,13,2,9,1,15,2,10,2,11,1,13,1,8,1,20,1,12,2,10,1,10,1,9,2,14,1,8,1,14,2,11,2,13,2,9,2,11,2,15,1,11,2,10,1,14,1,18,2,14,1,11,2,12,2,13,2,9,1,10,2,15,1,20,1,12,2,12,2,14,2,13,1,11,2,17,1,12,2,13,1,14,1,13,2,15,2,13,1,10,1,11,2,19,2,13,2,17,1,13,1,9,1,11,1,10,2,9,1,12,2,12,2,13,1,13,2,12,2,15,2,22,2,13,2,15,2,13,2,15,2,10,2,11,2,16,2,11,1,11,1,10,2,10,1,16,2,12,1,11,2,16,1,19,2,11,1,16,1,15,2,24,2,14,2,15,2,11,1,15,2,12,1,10,2,14,2,13,2,9,2,15,2,15,2,14,2,11,2,8,2,11,2,11,1,8,2,10,2,11,2,13,1,11,1,20,2,10,1,15,1,12,2,14,1,23,1,14,2,16,2,11,1,12,2,10,1,14,2,12,1,12,2,11,2,12,1,13,1,11,1,19,2,12,2,17,1,9,2,12,2,19,2,18,2,15,2,14,2,11,2,9,2,18,2,16),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
Attaching package: 'zoo'
The following object(s) are masked from package:base :
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
y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 12 2 1 0 0 0 0 0 0 0 0 0 0 1
2 11 2 0 1 0 0 0 0 0 0 0 0 0 2
3 14 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 21 2 0 0 0 0 1 0 0 0 0 0 0 5
6 12 2 0 0 0 0 0 1 0 0 0 0 0 6
7 22 2 0 0 0 0 0 0 1 0 0 0 0 7
8 11 2 0 0 0 0 0 0 0 1 0 0 0 8
9 10 2 0 0 0 0 0 0 0 0 1 0 0 9
10 13 2 0 0 0 0 0 0 0 0 0 1 0 10
11 10 1 0 0 0 0 0 0 0 0 0 0 1 11
12 8 2 0 0 0 0 0 0 0 0 0 0 0 12
13 15 1 1 0 0 0 0 0 0 0 0 0 0 13
14 14 2 0 1 0 0 0 0 0 0 0 0 0 14
15 10 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 11 2 0 0 0 0 0 1 0 0 0 0 0 18
19 10 1 0 0 0 0 0 0 1 0 0 0 0 19
20 13 2 0 0 0 0 0 0 0 1 0 0 0 20
21 7 1 0 0 0 0 0 0 0 0 1 0 0 21
22 14 2 0 0 0 0 0 0 0 0 0 1 0 22
23 12 2 0 0 0 0 0 0 0 0 0 0 1 23
24 14 2 0 0 0 0 0 0 0 0 0 0 0 24
25 11 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 11 1 0 0 1 0 0 0 0 0 0 0 0 27
28 15 2 0 0 0 1 0 0 0 0 0 0 0 28
29 14 2 0 0 0 0 1 0 0 0 0 0 0 29
30 13 1 0 0 0 0 0 1 0 0 0 0 0 30
31 9 2 0 0 0 0 0 0 1 0 0 0 0 31
32 15 1 0 0 0 0 0 0 0 1 0 0 0 32
33 10 2 0 0 0 0 0 0 0 0 1 0 0 33
34 11 2 0 0 0 0 0 0 0 0 0 1 0 34
35 13 1 0 0 0 0 0 0 0 0 0 0 1 35
36 8 1 0 0 0 0 0 0 0 0 0 0 0 36
37 20 1 1 0 0 0 0 0 0 0 0 0 0 37
38 12 1 0 1 0 0 0 0 0 0 0 0 0 38
39 10 2 0 0 1 0 0 0 0 0 0 0 0 39
40 10 1 0 0 0 1 0 0 0 0 0 0 0 40
41 9 1 0 0 0 0 1 0 0 0 0 0 0 41
42 14 2 0 0 0 0 0 1 0 0 0 0 0 42
43 8 1 0 0 0 0 0 0 1 0 0 0 0 43
44 14 1 0 0 0 0 0 0 0 1 0 0 0 44
45 11 2 0 0 0 0 0 0 0 0 1 0 0 45
46 13 2 0 0 0 0 0 0 0 0 0 1 0 46
47 9 2 0 0 0 0 0 0 0 0 0 0 1 47
48 11 2 0 0 0 0 0 0 0 0 0 0 0 48
49 15 2 1 0 0 0 0 0 0 0 0 0 0 49
50 11 1 0 1 0 0 0 0 0 0 0 0 0 50
51 10 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 18 1 0 0 0 0 1 0 0 0 0 0 0 53
54 14 2 0 0 0 0 0 1 0 0 0 0 0 54
55 11 1 0 0 0 0 0 0 1 0 0 0 0 55
56 12 2 0 0 0 0 0 0 0 1 0 0 0 56
57 13 2 0 0 0 0 0 0 0 0 1 0 0 57
58 9 2 0 0 0 0 0 0 0 0 0 1 0 58
59 10 1 0 0 0 0 0 0 0 0 0 0 1 59
60 15 2 0 0 0 0 0 0 0 0 0 0 0 60
61 20 1 1 0 0 0 0 0 0 0 0 0 0 61
62 12 1 0 1 0 0 0 0 0 0 0 0 0 62
63 12 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 13 2 0 0 0 0 1 0 0 0 0 0 0 65
66 11 1 0 0 0 0 0 1 0 0 0 0 0 66
67 17 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 13 2 0 0 0 0 0 0 0 0 1 0 0 69
70 14 1 0 0 0 0 0 0 0 0 0 1 0 70
71 13 1 0 0 0 0 0 0 0 0 0 0 1 71
72 15 2 0 0 0 0 0 0 0 0 0 0 0 72
73 13 2 1 0 0 0 0 0 0 0 0 0 0 73
74 10 1 0 1 0 0 0 0 0 0 0 0 0 74
75 11 1 0 0 1 0 0 0 0 0 0 0 0 75
76 19 2 0 0 0 1 0 0 0 0 0 0 0 76
77 13 2 0 0 0 0 1 0 0 0 0 0 0 77
78 17 2 0 0 0 0 0 1 0 0 0 0 0 78
79 13 1 0 0 0 0 0 0 1 0 0 0 0 79
80 9 1 0 0 0 0 0 0 0 1 0 0 0 80
81 11 1 0 0 0 0 0 0 0 0 1 0 0 81
82 10 1 0 0 0 0 0 0 0 0 0 1 0 82
83 9 2 0 0 0 0 0 0 0 0 0 0 1 83
84 12 1 0 0 0 0 0 0 0 0 0 0 0 84
85 12 2 1 0 0 0 0 0 0 0 0 0 0 85
86 13 2 0 1 0 0 0 0 0 0 0 0 0 86
87 13 1 0 0 1 0 0 0 0 0 0 0 0 87
88 12 2 0 0 0 1 0 0 0 0 0 0 0 88
89 15 2 0 0 0 0 1 0 0 0 0 0 0 89
90 22 2 0 0 0 0 0 1 0 0 0 0 0 90
91 13 2 0 0 0 0 0 0 1 0 0 0 0 91
92 15 2 0 0 0 0 0 0 0 1 0 0 0 92
93 13 2 0 0 0 0 0 0 0 0 1 0 0 93
94 15 2 0 0 0 0 0 0 0 0 0 1 0 94
95 10 2 0 0 0 0 0 0 0 0 0 0 1 95
96 11 2 0 0 0 0 0 0 0 0 0 0 0 96
97 16 2 1 0 0 0 0 0 0 0 0 0 0 97
98 11 2 0 1 0 0 0 0 0 0 0 0 0 98
99 11 1 0 0 1 0 0 0 0 0 0 0 0 99
100 10 1 0 0 0 1 0 0 0 0 0 0 0 100
101 10 2 0 0 0 0 1 0 0 0 0 0 0 101
102 16 1 0 0 0 0 0 1 0 0 0 0 0 102
103 12 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 16 2 0 0 0 0 0 0 0 0 1 0 0 105
106 19 1 0 0 0 0 0 0 0 0 0 1 0 106
107 11 2 0 0 0 0 0 0 0 0 0 0 1 107
108 16 1 0 0 0 0 0 0 0 0 0 0 0 108
109 15 1 1 0 0 0 0 0 0 0 0 0 0 109
110 24 2 0 1 0 0 0 0 0 0 0 0 0 110
111 14 2 0 0 1 0 0 0 0 0 0 0 0 111
112 15 2 0 0 0 1 0 0 0 0 0 0 0 112
113 11 2 0 0 0 0 1 0 0 0 0 0 0 113
114 15 1 0 0 0 0 0 1 0 0 0 0 0 114
115 12 2 0 0 0 0 0 0 1 0 0 0 0 115
116 10 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 13 2 0 0 0 0 0 0 0 0 0 1 0 118
119 9 2 0 0 0 0 0 0 0 0 0 0 1 119
120 15 2 0 0 0 0 0 0 0 0 0 0 0 120
121 15 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 11 2 0 0 1 0 0 0 0 0 0 0 0 123
124 8 2 0 0 0 1 0 0 0 0 0 0 0 124
125 11 2 0 0 0 0 1 0 0 0 0 0 0 125
126 11 2 0 0 0 0 0 1 0 0 0 0 0 126
127 8 1 0 0 0 0 0 0 1 0 0 0 0 127
128 10 2 0 0 0 0 0 0 0 1 0 0 0 128
129 11 2 0 0 0 0 0 0 0 0 1 0 0 129
130 13 2 0 0 0 0 0 0 0 0 0 1 0 130
131 11 1 0 0 0 0 0 0 0 0 0 0 1 131
132 20 1 0 0 0 0 0 0 0 0 0 0 0 132
133 10 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 12 1 0 0 1 0 0 0 0 0 0 0 0 135
136 14 2 0 0 0 1 0 0 0 0 0 0 0 136
137 23 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 16 2 0 0 0 0 0 0 1 0 0 0 0 139
140 11 2 0 0 0 0 0 0 0 1 0 0 0 140
141 12 1 0 0 0 0 0 0 0 0 1 0 0 141
142 10 2 0 0 0 0 0 0 0 0 0 1 0 142
143 14 1 0 0 0 0 0 0 0 0 0 0 1 143
144 12 2 0 0 0 0 0 0 0 0 0 0 0 144
145 12 1 1 0 0 0 0 0 0 0 0 0 0 145
146 11 2 0 1 0 0 0 0 0 0 0 0 0 146
147 12 2 0 0 1 0 0 0 0 0 0 0 0 147
148 13 1 0 0 0 1 0 0 0 0 0 0 0 148
149 11 1 0 0 0 0 1 0 0 0 0 0 0 149
150 19 1 0 0 0 0 0 1 0 0 0 0 0 150
151 12 2 0 0 0 0 0 0 1 0 0 0 0 151
152 17 2 0 0 0 0 0 0 0 1 0 0 0 152
153 9 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 19 2 0 0 0 0 0 0 0 0 0 0 1 155
156 18 2 0 0 0 0 0 0 0 0 0 0 0 156
157 15 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 11 2 0 0 1 0 0 0 0 0 0 0 0 159
160 9 2 0 0 0 1 0 0 0 0 0 0 0 160
161 18 2 0 0 0 0 1 0 0 0 0 0 0 161
162 16 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
12.290745 0.276580 0.970867 -0.485826 -1.851335 -0.625660
M5 M6 M7 M8 M9 M10
0.917647 1.214751 -0.859972 -1.077832 -1.897979 -0.696851
M11 t
-1.872160 0.008366
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.2556 -1.9195 -0.2785 1.5513 10.7217
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.290745 1.265789 9.710 <2e-16 ***
x 0.276580 0.504304 0.548 0.584
M1 0.970867 1.186296 0.818 0.414
M2 -0.485826 1.184941 -0.410 0.682
M3 -1.851335 1.184868 -1.562 0.120
M4 -0.625660 1.186105 -0.527 0.599
M5 0.917647 1.184790 0.775 0.440
M6 1.214751 1.186090 1.024 0.307
M7 -0.859972 1.207112 -0.712 0.477
M8 -1.077832 1.208852 -0.892 0.374
M9 -1.897979 1.206359 -1.573 0.118
M10 -0.696851 1.206946 -0.577 0.565
M11 -1.872160 1.208743 -1.549 0.124
t 0.008366 0.005179 1.615 0.108
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.075 on 148 degrees of freedom
Multiple R-squared: 0.1327, Adjusted R-squared: 0.05653
F-statistic: 1.742 on 13 and 148 DF, p-value: 0.05789
> 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.77270607 0.45458785 0.2272939
[2,] 0.64915840 0.70168321 0.3508416
[3,] 0.84300167 0.31399666 0.1569983
[4,] 0.77159339 0.45681322 0.2284066
[5,] 0.70368930 0.59262141 0.2963107
[6,] 0.60835857 0.78328285 0.3916414
[7,] 0.54432496 0.91135008 0.4556750
[8,] 0.60653896 0.78692209 0.3934610
[9,] 0.52526961 0.94946077 0.4747304
[10,] 0.52045641 0.95908719 0.4795436
[11,] 0.48452818 0.96905636 0.5154718
[12,] 0.41711099 0.83422198 0.5828890
[13,] 0.43821493 0.87642986 0.5617851
[14,] 0.47079670 0.94159341 0.5292033
[15,] 0.61541033 0.76917933 0.3845897
[16,] 0.66766364 0.66467272 0.3323364
[17,] 0.61826804 0.76346393 0.3817320
[18,] 0.56150454 0.87699092 0.4384955
[19,] 0.54171130 0.91657740 0.4582887
[20,] 0.51486098 0.97027803 0.4851390
[21,] 0.75232771 0.49534458 0.2476723
[22,] 0.70832442 0.58335116 0.2916756
[23,] 0.66458406 0.67083187 0.3354159
[24,] 0.64409174 0.71181651 0.3559083
[25,] 0.73007391 0.53985218 0.2699261
[26,] 0.69734883 0.60530234 0.3026512
[27,] 0.71452904 0.57094191 0.2854710
[28,] 0.69036209 0.61927582 0.3096379
[29,] 0.65414246 0.69171509 0.3458575
[30,] 0.60239415 0.79521169 0.3976058
[31,] 0.58003944 0.83992112 0.4199606
[32,] 0.54724348 0.90551305 0.4527565
[33,] 0.49303555 0.98607111 0.5069644
[34,] 0.44995488 0.89990976 0.5500451
[35,] 0.40183193 0.80366385 0.5981681
[36,] 0.36878521 0.73757042 0.6312148
[37,] 0.41073368 0.82146736 0.5892663
[38,] 0.36975245 0.73950490 0.6302475
[39,] 0.32328285 0.64656569 0.6767172
[40,] 0.28236427 0.56472854 0.7176357
[41,] 0.27269838 0.54539675 0.7273016
[42,] 0.28275762 0.56551524 0.7172424
[43,] 0.24336978 0.48673957 0.7566302
[44,] 0.25759654 0.51519307 0.7424035
[45,] 0.37330389 0.74660778 0.6266961
[46,] 0.33150873 0.66301745 0.6684913
[47,] 0.28696996 0.57393992 0.7130300
[48,] 0.24837709 0.49675418 0.7516229
[49,] 0.23040290 0.46080579 0.7695971
[50,] 0.22476672 0.44953344 0.7752333
[51,] 0.25629745 0.51259490 0.7437025
[52,] 0.21829142 0.43658284 0.7817086
[53,] 0.19410004 0.38820008 0.8059000
[54,] 0.17758770 0.35517540 0.8224123
[55,] 0.15775111 0.31550222 0.8422489
[56,] 0.14391008 0.28782015 0.8560899
[57,] 0.13932224 0.27864449 0.8606778
[58,] 0.13159846 0.26319692 0.8684015
[59,] 0.10734749 0.21469499 0.8926525
[60,] 0.17319756 0.34639511 0.8268024
[61,] 0.15837433 0.31674866 0.8416257
[62,] 0.15087970 0.30175940 0.8491203
[63,] 0.12557728 0.25115455 0.8744227
[64,] 0.12875796 0.25751593 0.8712420
[65,] 0.10652420 0.21304840 0.8934758
[66,] 0.09910172 0.19820345 0.9008983
[67,] 0.09905599 0.19811198 0.9009440
[68,] 0.08878450 0.17756901 0.9112155
[69,] 0.08908127 0.17816255 0.9109187
[70,] 0.07406108 0.14812216 0.9259389
[71,] 0.06238676 0.12477351 0.9376132
[72,] 0.05407952 0.10815905 0.9459205
[73,] 0.04231831 0.08463662 0.9576817
[74,] 0.11985444 0.23970889 0.8801456
[75,] 0.09956039 0.19912078 0.9004396
[76,] 0.09418146 0.18836292 0.9058185
[77,] 0.07798937 0.15597873 0.9220106
[78,] 0.06800598 0.13601196 0.9319940
[79,] 0.05827357 0.11654715 0.9417264
[80,] 0.05922728 0.11845455 0.9407727
[81,] 0.05173256 0.10346513 0.9482674
[82,] 0.05047330 0.10094659 0.9495267
[83,] 0.03951189 0.07902378 0.9604881
[84,] 0.03784632 0.07569264 0.9621537
[85,] 0.05242743 0.10485486 0.9475726
[86,] 0.04239671 0.08479342 0.9576033
[87,] 0.03311020 0.06622040 0.9668898
[88,] 0.02625144 0.05250288 0.9737486
[89,] 0.03323342 0.06646684 0.9667666
[90,] 0.07023856 0.14047712 0.9297614
[91,] 0.05694826 0.11389653 0.9430517
[92,] 0.05127380 0.10254759 0.9487262
[93,] 0.04141534 0.08283067 0.9585847
[94,] 0.32564500 0.65129000 0.6743550
[95,] 0.31751286 0.63502571 0.6824871
[96,] 0.35842581 0.71685163 0.6415742
[97,] 0.36115650 0.72231300 0.6388435
[98,] 0.31523991 0.63047982 0.6847601
[99,] 0.27710066 0.55420133 0.7228993
[100,] 0.25011706 0.50023412 0.7498829
[101,] 0.27429802 0.54859605 0.7257020
[102,] 0.25160000 0.50320000 0.7484000
[103,] 0.24984629 0.49969259 0.7501537
[104,] 0.20808915 0.41617831 0.7919108
[105,] 0.21633337 0.43266674 0.7836666
[106,] 0.19361875 0.38723749 0.8063813
[107,] 0.16351709 0.32703418 0.8364829
[108,] 0.16481945 0.32963891 0.8351805
[109,] 0.17349586 0.34699171 0.8265041
[110,] 0.18693553 0.37387107 0.8130645
[111,] 0.23814304 0.47628609 0.7618570
[112,] 0.23446307 0.46892614 0.7655369
[113,] 0.18794554 0.37589107 0.8120545
[114,] 0.15572076 0.31144151 0.8442792
[115,] 0.18590455 0.37180910 0.8140955
[116,] 0.23608867 0.47217734 0.7639113
[117,] 0.24992117 0.49984233 0.7500788
[118,] 0.21958240 0.43916481 0.7804176
[119,] 0.16964798 0.33929596 0.8303520
[120,] 0.13382585 0.26765170 0.8661741
[121,] 0.51773997 0.96452006 0.4822600
[122,] 0.43418534 0.86837068 0.5658147
[123,] 0.49278851 0.98557703 0.5072115
[124,] 0.47968024 0.95936047 0.5203198
[125,] 0.50167467 0.99665066 0.4983253
[126,] 0.39325219 0.78650438 0.6067478
[127,] 0.35552152 0.71104304 0.6444785
[128,] 0.32271553 0.64543107 0.6772845
[129,] 0.23001401 0.46002802 0.7699860
> postscript(file="/var/www/html/freestat/rcomp/tmp/188om1291126451.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/www/html/freestat/rcomp/tmp/288om1291126451.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/www/html/freestat/rcomp/tmp/3jz671291126451.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/www/html/freestat/rcomp/tmp/4jz671291126451.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/www/html/freestat/rcomp/tmp/5jz671291126451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 162
Frequency = 1
1 2 3 4 5 6
-1.823137925 -1.374810772 2.982332085 0.024870790 7.196617799 -2.108852211
7 8 9 10 11 12
9.957505433 -0.833000732 -1.021219171 0.769286994 -0.787189819 -4.944296094
13 14 15 16 17 18
1.353051560 1.524798570 -1.118058573 1.924480131 0.372807284 -3.209242869
19 20 21 22 23 24
-1.866305082 1.066608610 -3.845029686 1.668896335 0.835839379 0.955313248
25 26 27 28 29 30
-2.747339099 -3.575592089 0.058130912 2.547509330 -0.004163517 -1.033053384
31 32 33 34 35 36
-3.243275883 3.242798095 -1.222000488 -1.431494323 2.012028864 -4.868497268
37 38 39 40 41 42
6.152270243 -0.399402604 -1.318839890 -2.276301185 -4.827974032 -0.410024186
43 44 45 46 47 48
-4.067086398 2.142407437 -0.322391146 0.468115019 -2.364941937 -2.245468069
49 50 51 52 53 54
0.775299442 -1.499793262 -1.419230548 1.623308156 4.071635309 -0.510414844
55 56 57 58 59 60
-1.167477057 -0.234563365 1.577218196 -3.632275640 -1.188752452 1.654141273
61 62 63 64 65 66
5.951488927 -0.600183920 0.480378793 1.246337355 -1.305335492 -3.334225359
67 68 69 70 71 72
4.455552142 -0.058373880 1.476827537 1.543913845 1.710856889 1.553750614
73 74 75 76 77 78
-1.425481875 -2.700574579 -0.343431722 6.145946696 -1.405726151 2.288803839
79 80 81 82 83 84
0.631741627 -3.158764538 -0.346982978 -2.556476813 -2.666113912 -1.270059901
85 86 87 88 89 90
-2.525872533 -0.077545380 1.556177620 -0.954443962 0.493883191 7.188413181
91 92 93 94 95 96
0.254770825 2.464264660 1.276046221 2.066552386 -1.766504571 -2.647030702
97 98 99 100 101 102
1.373736808 -2.177936039 -0.544213038 -2.778254477 -4.606507467 1.364602666
103 104 105 106 107 108
-0.845619833 -1.359545855 4.175655562 6.242741871 -0.866895229 2.529158783
109 110 111 112 113 114
0.549926293 10.721673303 2.078816160 1.844774721 -3.706898126 0.264212008
115 116 117 118 119 120
-0.946010492 -2.459936513 2.075264904 -0.134228931 -2.967285887 1.152187981
121 122 123 124 125 126
0.172955492 0.621282645 -1.021574498 -5.255615937 -3.807288784 -4.112758794
127 128 129 130 131 132
-4.769821007 -2.836907315 -1.025125754 -0.234619589 -0.791096402 6.328377466
133 134 135 136 137 138
-4.927435167 1.797472130 0.154614987 0.643993405 8.368900701 -0.936569309
139 140 141 142 143 144
2.853208192 -1.937297973 0.151063731 -3.335010248 2.108512939 -2.048593336
145 146 147 148 149 150
-2.751245682 -2.579498672 -0.222355815 -0.179817110 -3.731489957 3.963040033
151 152 153 154 155 156
-1.247182467 3.962311369 -2.949326928 -1.435400906 6.731542138 3.851016006
157 158 159 160 161 162
-0.128216483 0.320110670 -1.322746473 -4.556787912 2.891539241 0.586069231
> postscript(file="/var/www/html/freestat/rcomp/tmp/6bq5s1291126451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.823137925 NA
1 -1.374810772 -1.823137925
2 2.982332085 -1.374810772
3 0.024870790 2.982332085
4 7.196617799 0.024870790
5 -2.108852211 7.196617799
6 9.957505433 -2.108852211
7 -0.833000732 9.957505433
8 -1.021219171 -0.833000732
9 0.769286994 -1.021219171
10 -0.787189819 0.769286994
11 -4.944296094 -0.787189819
12 1.353051560 -4.944296094
13 1.524798570 1.353051560
14 -1.118058573 1.524798570
15 1.924480131 -1.118058573
16 0.372807284 1.924480131
17 -3.209242869 0.372807284
18 -1.866305082 -3.209242869
19 1.066608610 -1.866305082
20 -3.845029686 1.066608610
21 1.668896335 -3.845029686
22 0.835839379 1.668896335
23 0.955313248 0.835839379
24 -2.747339099 0.955313248
25 -3.575592089 -2.747339099
26 0.058130912 -3.575592089
27 2.547509330 0.058130912
28 -0.004163517 2.547509330
29 -1.033053384 -0.004163517
30 -3.243275883 -1.033053384
31 3.242798095 -3.243275883
32 -1.222000488 3.242798095
33 -1.431494323 -1.222000488
34 2.012028864 -1.431494323
35 -4.868497268 2.012028864
36 6.152270243 -4.868497268
37 -0.399402604 6.152270243
38 -1.318839890 -0.399402604
39 -2.276301185 -1.318839890
40 -4.827974032 -2.276301185
41 -0.410024186 -4.827974032
42 -4.067086398 -0.410024186
43 2.142407437 -4.067086398
44 -0.322391146 2.142407437
45 0.468115019 -0.322391146
46 -2.364941937 0.468115019
47 -2.245468069 -2.364941937
48 0.775299442 -2.245468069
49 -1.499793262 0.775299442
50 -1.419230548 -1.499793262
51 1.623308156 -1.419230548
52 4.071635309 1.623308156
53 -0.510414844 4.071635309
54 -1.167477057 -0.510414844
55 -0.234563365 -1.167477057
56 1.577218196 -0.234563365
57 -3.632275640 1.577218196
58 -1.188752452 -3.632275640
59 1.654141273 -1.188752452
60 5.951488927 1.654141273
61 -0.600183920 5.951488927
62 0.480378793 -0.600183920
63 1.246337355 0.480378793
64 -1.305335492 1.246337355
65 -3.334225359 -1.305335492
66 4.455552142 -3.334225359
67 -0.058373880 4.455552142
68 1.476827537 -0.058373880
69 1.543913845 1.476827537
70 1.710856889 1.543913845
71 1.553750614 1.710856889
72 -1.425481875 1.553750614
73 -2.700574579 -1.425481875
74 -0.343431722 -2.700574579
75 6.145946696 -0.343431722
76 -1.405726151 6.145946696
77 2.288803839 -1.405726151
78 0.631741627 2.288803839
79 -3.158764538 0.631741627
80 -0.346982978 -3.158764538
81 -2.556476813 -0.346982978
82 -2.666113912 -2.556476813
83 -1.270059901 -2.666113912
84 -2.525872533 -1.270059901
85 -0.077545380 -2.525872533
86 1.556177620 -0.077545380
87 -0.954443962 1.556177620
88 0.493883191 -0.954443962
89 7.188413181 0.493883191
90 0.254770825 7.188413181
91 2.464264660 0.254770825
92 1.276046221 2.464264660
93 2.066552386 1.276046221
94 -1.766504571 2.066552386
95 -2.647030702 -1.766504571
96 1.373736808 -2.647030702
97 -2.177936039 1.373736808
98 -0.544213038 -2.177936039
99 -2.778254477 -0.544213038
100 -4.606507467 -2.778254477
101 1.364602666 -4.606507467
102 -0.845619833 1.364602666
103 -1.359545855 -0.845619833
104 4.175655562 -1.359545855
105 6.242741871 4.175655562
106 -0.866895229 6.242741871
107 2.529158783 -0.866895229
108 0.549926293 2.529158783
109 10.721673303 0.549926293
110 2.078816160 10.721673303
111 1.844774721 2.078816160
112 -3.706898126 1.844774721
113 0.264212008 -3.706898126
114 -0.946010492 0.264212008
115 -2.459936513 -0.946010492
116 2.075264904 -2.459936513
117 -0.134228931 2.075264904
118 -2.967285887 -0.134228931
119 1.152187981 -2.967285887
120 0.172955492 1.152187981
121 0.621282645 0.172955492
122 -1.021574498 0.621282645
123 -5.255615937 -1.021574498
124 -3.807288784 -5.255615937
125 -4.112758794 -3.807288784
126 -4.769821007 -4.112758794
127 -2.836907315 -4.769821007
128 -1.025125754 -2.836907315
129 -0.234619589 -1.025125754
130 -0.791096402 -0.234619589
131 6.328377466 -0.791096402
132 -4.927435167 6.328377466
133 1.797472130 -4.927435167
134 0.154614987 1.797472130
135 0.643993405 0.154614987
136 8.368900701 0.643993405
137 -0.936569309 8.368900701
138 2.853208192 -0.936569309
139 -1.937297973 2.853208192
140 0.151063731 -1.937297973
141 -3.335010248 0.151063731
142 2.108512939 -3.335010248
143 -2.048593336 2.108512939
144 -2.751245682 -2.048593336
145 -2.579498672 -2.751245682
146 -0.222355815 -2.579498672
147 -0.179817110 -0.222355815
148 -3.731489957 -0.179817110
149 3.963040033 -3.731489957
150 -1.247182467 3.963040033
151 3.962311369 -1.247182467
152 -2.949326928 3.962311369
153 -1.435400906 -2.949326928
154 6.731542138 -1.435400906
155 3.851016006 6.731542138
156 -0.128216483 3.851016006
157 0.320110670 -0.128216483
158 -1.322746473 0.320110670
159 -4.556787912 -1.322746473
160 2.891539241 -4.556787912
161 0.586069231 2.891539241
162 NA 0.586069231
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.374810772 -1.823137925
[2,] 2.982332085 -1.374810772
[3,] 0.024870790 2.982332085
[4,] 7.196617799 0.024870790
[5,] -2.108852211 7.196617799
[6,] 9.957505433 -2.108852211
[7,] -0.833000732 9.957505433
[8,] -1.021219171 -0.833000732
[9,] 0.769286994 -1.021219171
[10,] -0.787189819 0.769286994
[11,] -4.944296094 -0.787189819
[12,] 1.353051560 -4.944296094
[13,] 1.524798570 1.353051560
[14,] -1.118058573 1.524798570
[15,] 1.924480131 -1.118058573
[16,] 0.372807284 1.924480131
[17,] -3.209242869 0.372807284
[18,] -1.866305082 -3.209242869
[19,] 1.066608610 -1.866305082
[20,] -3.845029686 1.066608610
[21,] 1.668896335 -3.845029686
[22,] 0.835839379 1.668896335
[23,] 0.955313248 0.835839379
[24,] -2.747339099 0.955313248
[25,] -3.575592089 -2.747339099
[26,] 0.058130912 -3.575592089
[27,] 2.547509330 0.058130912
[28,] -0.004163517 2.547509330
[29,] -1.033053384 -0.004163517
[30,] -3.243275883 -1.033053384
[31,] 3.242798095 -3.243275883
[32,] -1.222000488 3.242798095
[33,] -1.431494323 -1.222000488
[34,] 2.012028864 -1.431494323
[35,] -4.868497268 2.012028864
[36,] 6.152270243 -4.868497268
[37,] -0.399402604 6.152270243
[38,] -1.318839890 -0.399402604
[39,] -2.276301185 -1.318839890
[40,] -4.827974032 -2.276301185
[41,] -0.410024186 -4.827974032
[42,] -4.067086398 -0.410024186
[43,] 2.142407437 -4.067086398
[44,] -0.322391146 2.142407437
[45,] 0.468115019 -0.322391146
[46,] -2.364941937 0.468115019
[47,] -2.245468069 -2.364941937
[48,] 0.775299442 -2.245468069
[49,] -1.499793262 0.775299442
[50,] -1.419230548 -1.499793262
[51,] 1.623308156 -1.419230548
[52,] 4.071635309 1.623308156
[53,] -0.510414844 4.071635309
[54,] -1.167477057 -0.510414844
[55,] -0.234563365 -1.167477057
[56,] 1.577218196 -0.234563365
[57,] -3.632275640 1.577218196
[58,] -1.188752452 -3.632275640
[59,] 1.654141273 -1.188752452
[60,] 5.951488927 1.654141273
[61,] -0.600183920 5.951488927
[62,] 0.480378793 -0.600183920
[63,] 1.246337355 0.480378793
[64,] -1.305335492 1.246337355
[65,] -3.334225359 -1.305335492
[66,] 4.455552142 -3.334225359
[67,] -0.058373880 4.455552142
[68,] 1.476827537 -0.058373880
[69,] 1.543913845 1.476827537
[70,] 1.710856889 1.543913845
[71,] 1.553750614 1.710856889
[72,] -1.425481875 1.553750614
[73,] -2.700574579 -1.425481875
[74,] -0.343431722 -2.700574579
[75,] 6.145946696 -0.343431722
[76,] -1.405726151 6.145946696
[77,] 2.288803839 -1.405726151
[78,] 0.631741627 2.288803839
[79,] -3.158764538 0.631741627
[80,] -0.346982978 -3.158764538
[81,] -2.556476813 -0.346982978
[82,] -2.666113912 -2.556476813
[83,] -1.270059901 -2.666113912
[84,] -2.525872533 -1.270059901
[85,] -0.077545380 -2.525872533
[86,] 1.556177620 -0.077545380
[87,] -0.954443962 1.556177620
[88,] 0.493883191 -0.954443962
[89,] 7.188413181 0.493883191
[90,] 0.254770825 7.188413181
[91,] 2.464264660 0.254770825
[92,] 1.276046221 2.464264660
[93,] 2.066552386 1.276046221
[94,] -1.766504571 2.066552386
[95,] -2.647030702 -1.766504571
[96,] 1.373736808 -2.647030702
[97,] -2.177936039 1.373736808
[98,] -0.544213038 -2.177936039
[99,] -2.778254477 -0.544213038
[100,] -4.606507467 -2.778254477
[101,] 1.364602666 -4.606507467
[102,] -0.845619833 1.364602666
[103,] -1.359545855 -0.845619833
[104,] 4.175655562 -1.359545855
[105,] 6.242741871 4.175655562
[106,] -0.866895229 6.242741871
[107,] 2.529158783 -0.866895229
[108,] 0.549926293 2.529158783
[109,] 10.721673303 0.549926293
[110,] 2.078816160 10.721673303
[111,] 1.844774721 2.078816160
[112,] -3.706898126 1.844774721
[113,] 0.264212008 -3.706898126
[114,] -0.946010492 0.264212008
[115,] -2.459936513 -0.946010492
[116,] 2.075264904 -2.459936513
[117,] -0.134228931 2.075264904
[118,] -2.967285887 -0.134228931
[119,] 1.152187981 -2.967285887
[120,] 0.172955492 1.152187981
[121,] 0.621282645 0.172955492
[122,] -1.021574498 0.621282645
[123,] -5.255615937 -1.021574498
[124,] -3.807288784 -5.255615937
[125,] -4.112758794 -3.807288784
[126,] -4.769821007 -4.112758794
[127,] -2.836907315 -4.769821007
[128,] -1.025125754 -2.836907315
[129,] -0.234619589 -1.025125754
[130,] -0.791096402 -0.234619589
[131,] 6.328377466 -0.791096402
[132,] -4.927435167 6.328377466
[133,] 1.797472130 -4.927435167
[134,] 0.154614987 1.797472130
[135,] 0.643993405 0.154614987
[136,] 8.368900701 0.643993405
[137,] -0.936569309 8.368900701
[138,] 2.853208192 -0.936569309
[139,] -1.937297973 2.853208192
[140,] 0.151063731 -1.937297973
[141,] -3.335010248 0.151063731
[142,] 2.108512939 -3.335010248
[143,] -2.048593336 2.108512939
[144,] -2.751245682 -2.048593336
[145,] -2.579498672 -2.751245682
[146,] -0.222355815 -2.579498672
[147,] -0.179817110 -0.222355815
[148,] -3.731489957 -0.179817110
[149,] 3.963040033 -3.731489957
[150,] -1.247182467 3.963040033
[151,] 3.962311369 -1.247182467
[152,] -2.949326928 3.962311369
[153,] -1.435400906 -2.949326928
[154,] 6.731542138 -1.435400906
[155,] 3.851016006 6.731542138
[156,] -0.128216483 3.851016006
[157,] 0.320110670 -0.128216483
[158,] -1.322746473 0.320110670
[159,] -4.556787912 -1.322746473
[160,] 2.891539241 -4.556787912
[161,] 0.586069231 2.891539241
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.374810772 -1.823137925
2 2.982332085 -1.374810772
3 0.024870790 2.982332085
4 7.196617799 0.024870790
5 -2.108852211 7.196617799
6 9.957505433 -2.108852211
7 -0.833000732 9.957505433
8 -1.021219171 -0.833000732
9 0.769286994 -1.021219171
10 -0.787189819 0.769286994
11 -4.944296094 -0.787189819
12 1.353051560 -4.944296094
13 1.524798570 1.353051560
14 -1.118058573 1.524798570
15 1.924480131 -1.118058573
16 0.372807284 1.924480131
17 -3.209242869 0.372807284
18 -1.866305082 -3.209242869
19 1.066608610 -1.866305082
20 -3.845029686 1.066608610
21 1.668896335 -3.845029686
22 0.835839379 1.668896335
23 0.955313248 0.835839379
24 -2.747339099 0.955313248
25 -3.575592089 -2.747339099
26 0.058130912 -3.575592089
27 2.547509330 0.058130912
28 -0.004163517 2.547509330
29 -1.033053384 -0.004163517
30 -3.243275883 -1.033053384
31 3.242798095 -3.243275883
32 -1.222000488 3.242798095
33 -1.431494323 -1.222000488
34 2.012028864 -1.431494323
35 -4.868497268 2.012028864
36 6.152270243 -4.868497268
37 -0.399402604 6.152270243
38 -1.318839890 -0.399402604
39 -2.276301185 -1.318839890
40 -4.827974032 -2.276301185
41 -0.410024186 -4.827974032
42 -4.067086398 -0.410024186
43 2.142407437 -4.067086398
44 -0.322391146 2.142407437
45 0.468115019 -0.322391146
46 -2.364941937 0.468115019
47 -2.245468069 -2.364941937
48 0.775299442 -2.245468069
49 -1.499793262 0.775299442
50 -1.419230548 -1.499793262
51 1.623308156 -1.419230548
52 4.071635309 1.623308156
53 -0.510414844 4.071635309
54 -1.167477057 -0.510414844
55 -0.234563365 -1.167477057
56 1.577218196 -0.234563365
57 -3.632275640 1.577218196
58 -1.188752452 -3.632275640
59 1.654141273 -1.188752452
60 5.951488927 1.654141273
61 -0.600183920 5.951488927
62 0.480378793 -0.600183920
63 1.246337355 0.480378793
64 -1.305335492 1.246337355
65 -3.334225359 -1.305335492
66 4.455552142 -3.334225359
67 -0.058373880 4.455552142
68 1.476827537 -0.058373880
69 1.543913845 1.476827537
70 1.710856889 1.543913845
71 1.553750614 1.710856889
72 -1.425481875 1.553750614
73 -2.700574579 -1.425481875
74 -0.343431722 -2.700574579
75 6.145946696 -0.343431722
76 -1.405726151 6.145946696
77 2.288803839 -1.405726151
78 0.631741627 2.288803839
79 -3.158764538 0.631741627
80 -0.346982978 -3.158764538
81 -2.556476813 -0.346982978
82 -2.666113912 -2.556476813
83 -1.270059901 -2.666113912
84 -2.525872533 -1.270059901
85 -0.077545380 -2.525872533
86 1.556177620 -0.077545380
87 -0.954443962 1.556177620
88 0.493883191 -0.954443962
89 7.188413181 0.493883191
90 0.254770825 7.188413181
91 2.464264660 0.254770825
92 1.276046221 2.464264660
93 2.066552386 1.276046221
94 -1.766504571 2.066552386
95 -2.647030702 -1.766504571
96 1.373736808 -2.647030702
97 -2.177936039 1.373736808
98 -0.544213038 -2.177936039
99 -2.778254477 -0.544213038
100 -4.606507467 -2.778254477
101 1.364602666 -4.606507467
102 -0.845619833 1.364602666
103 -1.359545855 -0.845619833
104 4.175655562 -1.359545855
105 6.242741871 4.175655562
106 -0.866895229 6.242741871
107 2.529158783 -0.866895229
108 0.549926293 2.529158783
109 10.721673303 0.549926293
110 2.078816160 10.721673303
111 1.844774721 2.078816160
112 -3.706898126 1.844774721
113 0.264212008 -3.706898126
114 -0.946010492 0.264212008
115 -2.459936513 -0.946010492
116 2.075264904 -2.459936513
117 -0.134228931 2.075264904
118 -2.967285887 -0.134228931
119 1.152187981 -2.967285887
120 0.172955492 1.152187981
121 0.621282645 0.172955492
122 -1.021574498 0.621282645
123 -5.255615937 -1.021574498
124 -3.807288784 -5.255615937
125 -4.112758794 -3.807288784
126 -4.769821007 -4.112758794
127 -2.836907315 -4.769821007
128 -1.025125754 -2.836907315
129 -0.234619589 -1.025125754
130 -0.791096402 -0.234619589
131 6.328377466 -0.791096402
132 -4.927435167 6.328377466
133 1.797472130 -4.927435167
134 0.154614987 1.797472130
135 0.643993405 0.154614987
136 8.368900701 0.643993405
137 -0.936569309 8.368900701
138 2.853208192 -0.936569309
139 -1.937297973 2.853208192
140 0.151063731 -1.937297973
141 -3.335010248 0.151063731
142 2.108512939 -3.335010248
143 -2.048593336 2.108512939
144 -2.751245682 -2.048593336
145 -2.579498672 -2.751245682
146 -0.222355815 -2.579498672
147 -0.179817110 -0.222355815
148 -3.731489957 -0.179817110
149 3.963040033 -3.731489957
150 -1.247182467 3.963040033
151 3.962311369 -1.247182467
152 -2.949326928 3.962311369
153 -1.435400906 -2.949326928
154 6.731542138 -1.435400906
155 3.851016006 6.731542138
156 -0.128216483 3.851016006
157 0.320110670 -0.128216483
158 -1.322746473 0.320110670
159 -4.556787912 -1.322746473
160 2.891539241 -4.556787912
161 0.586069231 2.891539241
> 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/html/freestat/rcomp/tmp/7bq5s1291126451.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/www/html/freestat/rcomp/tmp/84i4d1291126451.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/www/html/freestat/rcomp/tmp/94i4d1291126451.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/www/html/freestat/rcomp/tmp/10xr3f1291126451.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/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/html/freestat/rcomp/tmp/11i9231291126451.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/html/freestat/rcomp/tmp/12ma0r1291126451.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/html/freestat/rcomp/tmp/13ikg01291126451.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/html/freestat/rcomp/tmp/143kf61291126451.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/html/freestat/rcomp/tmp/15o3vu1291126451.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/html/freestat/rcomp/tmp/16a3ui1291126451.tab")
+ }
>
> try(system("convert tmp/188om1291126451.ps tmp/188om1291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/288om1291126451.ps tmp/288om1291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/3jz671291126451.ps tmp/3jz671291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/4jz671291126451.ps tmp/4jz671291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/5jz671291126451.ps tmp/5jz671291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/6bq5s1291126451.ps tmp/6bq5s1291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bq5s1291126451.ps tmp/7bq5s1291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/84i4d1291126451.ps tmp/84i4d1291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/94i4d1291126451.ps tmp/94i4d1291126451.png",intern=TRUE))
character(0)
> try(system("convert tmp/10xr3f1291126451.ps tmp/10xr3f1291126451.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.599 2.606 5.994