R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(13
+ ,14
+ ,13
+ ,3
+ ,25
+ ,55
+ ,147
+ ,12
+ ,8
+ ,13
+ ,5
+ ,158
+ ,7
+ ,71
+ ,10
+ ,12
+ ,16
+ ,6
+ ,0
+ ,0
+ ,0
+ ,9
+ ,7
+ ,12
+ ,6
+ ,143
+ ,10
+ ,0
+ ,10
+ ,10
+ ,11
+ ,5
+ ,67
+ ,74
+ ,43
+ ,12
+ ,7
+ ,12
+ ,3
+ ,0
+ ,0
+ ,0
+ ,13
+ ,16
+ ,18
+ ,8
+ ,148
+ ,138
+ ,8
+ ,12
+ ,11
+ ,11
+ ,4
+ ,28
+ ,12
+ ,14
+ ,14
+ ,4
+ ,114
+ ,113
+ ,34
+ ,6
+ ,6
+ ,9
+ ,4
+ ,0
+ ,0
+ ,0
+ ,5
+ ,16
+ ,14
+ ,6
+ ,123
+ ,115
+ ,103
+ ,12
+ ,11
+ ,12
+ ,6
+ ,145
+ ,9
+ ,11
+ ,16
+ ,11
+ ,5
+ ,113
+ ,114
+ ,73
+ ,14
+ ,12
+ ,12
+ ,4
+ ,152
+ ,59
+ ,159
+ ,14
+ ,7
+ ,13
+ ,6
+ ,0
+ ,0
+ ,0
+ ,12
+ ,13
+ ,11
+ ,4
+ ,36
+ ,114
+ ,113
+ ,12
+ ,11
+ ,12
+ ,6
+ ,0
+ ,0
+ ,0
+ ,11
+ ,15
+ ,16
+ ,6
+ ,8
+ ,102
+ ,44
+ ,11
+ ,7
+ ,9
+ ,4
+ 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
+ ,14
+ ,16
+ ,4
+ ,152
+ ,55
+ ,70
+ ,10
+ ,10
+ ,6
+ ,4
+ ,51
+ ,41
+ ,12
+ ,10
+ ,13
+ ,4
+ ,48
+ ,25
+ ,123
+ ,13
+ ,4
+ ,13
+ ,6
+ ,97
+ ,47
+ ,109
+ ,12
+ ,8
+ ,14
+ ,5
+ ,77
+ ,0
+ ,0
+ ,15
+ ,15
+ ,15
+ ,6
+ ,130
+ ,143
+ ,37
+ ,11
+ ,16
+ ,14
+ ,6
+ ,8
+ ,102
+ ,44
+ ,12
+ ,12
+ ,15
+ ,8
+ ,84
+ ,148
+ ,98
+ ,11
+ ,12
+ ,13
+ ,7
+ ,51
+ ,153
+ ,11
+ ,12
+ ,15
+ ,16
+ ,7
+ ,33
+ ,32
+ ,9
+ ,11
+ ,9
+ ,12
+ ,4
+ ,6
+ ,106
+ ,0
+ ,10
+ ,12
+ ,15
+ ,6
+ ,116
+ ,63
+ ,57
+ ,11
+ ,14
+ ,12
+ ,6
+ ,88
+ ,56
+ ,63
+ ,11
+ ,11
+ ,14
+ ,2
+ ,142
+ ,39
+ ,66)
+ ,dim=c(7
+ ,156)
+ ,dimnames=list(c('SocialInteraction'
+ ,'FindingFriends'
+ ,'KnowingPeople'
+ ,'Celebrity'
+ ,'Firstbestfriend'
+ ,'Secondbestfriend'
+ ,'Thirdbestfriend')
+ ,1:156))
> y <- array(NA,dim=c(7,156),dimnames=list(c('SocialInteraction','FindingFriends','KnowingPeople','Celebrity','Firstbestfriend','Secondbestfriend','Thirdbestfriend'),1:156))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'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
SocialInteraction FindingFriends KnowingPeople Celebrity Firstbestfriend
1 13 14 13 3 25
2 12 8 13 5 158
3 10 12 16 6 0
4 9 7 12 6 143
5 10 10 11 5 67
6 12 7 12 3 0
7 13 16 18 8 148
8 12 11 11 4 28
9 14 4 114 113 34
10 9 4 0 0 0
11 14 6 123 115 103
12 12 6 145 9 11
13 5 113 114 73 14
14 4 152 59 159 14
15 6 0 0 0 12
16 4 36 114 113 12
17 6 0 0 0 11
18 6 8 102 44 11
19 4 108 0 0 7
20 4 112 86 0 9
21 2 51 17 41 11
22 7 43 45 74 11
23 5 120 123 0 12
24 4 13 24 0 12
25 6 55 5 0 11
26 6 103 123 32 11
27 7 127 136 126 8
28 5 14 4 154 9
29 6 135 76 129 12
30 4 38 99 98 10
31 4 11 98 82 10
32 7 43 67 45 12
33 7 141 92 8 8
34 4 62 13 0 12
35 4 62 24 129 11
36 6 135 129 31 12
37 6 117 117 117 7
38 5 82 11 99 11
39 6 145 20 55 11
40 7 87 91 132 12
41 6 76 111 58 9
42 3 124 0 15 8
43 151 58 0 11 10
44 131 0 11 8 12
45 146 101 11 13 14
46 129 31 11 15 14
47 48 147 15 6 8
48 11 12 13 5 58
49 12 16 16 6 115
50 12 5 13 6 130
51 9 15 11 6 17
52 12 12 14 5 102
53 12 8 13 4 21
54 13 13 13 5 0
55 11 14 13 5 14
56 9 12 12 4 110
57 9 16 16 6 133
58 11 10 15 2 83
59 15 15 8 56 63
60 8 12 3 0 0
61 16 14 6 44 116
62 19 12 6 70 119
63 14 15 6 36 18
64 6 12 5 5 134
65 13 13 5 118 138
66 15 12 6 17 41
67 7 12 5 79 0
68 13 13 6 122 57
69 4 5 2 119 101
70 14 13 5 36 114
71 13 13 5 36 113
72 11 14 5 141 122
73 14 17 6 14 138
74 13 6 37 10 142
75 13 6 110 27 73
76 12 5 10 39 130
77 13 5 14 133 86
78 14 4 157 42 78
79 11 2 59 0 0
80 12 4 77 58 0
81 12 6 129 133 4
82 16 6 125 151 91
83 12 5 87 111 132
84 12 3 61 139 0
85 12 6 146 126 0
86 10 4 96 139 0
87 15 5 133 138 14
88 15 8 47 52 97
89 12 4 74 67 45
90 16 6 109 97 0
91 15 6 30 137 149
92 16 7 116 56 57
93 13 6 149 3 105
94 12 5 19 78 0
95 11 4 96 0 0
96 13 6 0 0 13
97 3 21 0 0 8
98 5 26 118 128 12
99 6 156 39 29 11
100 7 53 63 148 12
101 7 72 78 93 14
102 6 27 26 4 10
103 3 66 50 0 10
104 2 71 104 158 13
105 8 66 54 144 10
106 3 40 104 0 11
107 8 57 148 122 10
108 3 3 30 149 7
109 4 12 38 17 10
110 5 107 132 91 8
111 7 80 132 111 12
112 6 98 84 99 12
113 6 155 71 40 12
114 7 111 125 132 11
115 6 81 25 123 12
116 6 50 66 54 12
117 6 49 86 90 12
118 6 96 61 86 11
119 4 2 60 152 12
120 4 1 144 152 11
121 5 22 120 123 11
122 4 64 139 100 13
123 6 56 131 116 12
124 6 144 159 59 12
125 5 12 14 16 8
126 5 12 15 13 6
127 147 8 10 14 5
128 139 8 6 4 4
129 0 12 14 16 8
130 81 11 12 13 6
131 3 12 8 16 4
132 0 13 11 15 6
133 0 12 13 14 6
134 37 12 9 13 4
135 5 11 15 14 6
136 69 12 13 12 3
137 0 12 15 15 6
138 10 14 14 5 50
139 11 16 13 4 86
140 12 14 14 6 33
141 12 14 16 4 152
142 10 10 6 4 51
143 10 13 4 48 25
144 4 13 6 97 47
145 8 14 5 77 0
146 15 15 6 130 143
147 16 14 6 8 102
148 12 15 8 84 148
149 12 13 7 51 153
150 15 16 7 33 32
151 9 12 4 6 106
152 12 15 6 116 63
153 14 12 6 88 56
154 11 14 2 142 39
155 14 13 3 25 55
156 8 13 5 158 7
Secondbestfriend Thirdbestfriend
1 55 147
2 7 71
3 0 0
4 10 0
5 74 43
6 0 0
7 138 8
8 12 14
9 6 6
10 5 16
11 12 11
12 16 11
13 12 12
14 7 13
15 13 11
16 11 12
17 15 16
18 7 9
19 9 11
20 7 13
21 14 15
22 15 10
23 7 11
24 15 13
25 17 16
26 15 15
27 14 14
28 14 14
29 8 14
30 8 8
31 14 13
32 14 15
33 8 13
34 11 11
35 16 15
36 10 15
37 8 9
38 14 13
39 16 16
40 13 13
41 5 11
42 12 3
43 12 4
44 6 127
45 7 76
46 5 25
47 4 0
48 111 132
49 32 123
50 112 39
51 51 136
52 53 141
53 131 0
54 0 0
55 76 135
56 106 118
57 26 154
58 44 11
59 116 12
60 0 12
61 88 9
62 25 11
63 113 9
64 157 12
65 26 12
66 38 12
67 0 12
68 53 14
69 0 11
70 106 12
71 106 11
72 102 6
73 10 12
74 12 15
75 13 14
76 8 13
77 12 8
78 12 6
79 12 7
80 6 13
81 11 13
82 10 11
83 12 5
84 13 12
85 11 8
86 7 11
87 11 14
88 11 9
89 11 10
90 11 13
91 12 16
92 10 16
93 11 11
94 12 8
95 7 4
96 7 10
97 14 15
98 11 13
99 17 16
100 15 15
101 17 18
102 5 13
103 4 10
104 10 16
105 11 13
106 15 15
107 10 14
108 9 15
109 12 14
110 15 13
111 7 13
112 13 15
113 12 16
114 14 14
115 14 14
116 8 16
117 15 14
118 12 12
119 12 13
120 16 12
121 9 12
122 15 14
123 15 14
124 6 14
125 94 18
126 25 123
127 93 18
128 0 0
129 48 123
130 30 105
131 19 0
132 0 0
133 10 68
134 78 157
135 93 94
136 0 0
137 95 87
138 156 142
139 139 17
140 145 100
141 55 70
142 41 12
143 123 13
144 109 12
145 0 15
146 37 11
147 44 12
148 98 11
149 11 12
150 9 11
151 0 10
152 57 11
153 63 11
154 66 13
155 147 12
156 71 10
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) FindingFriends KnowingPeople Celebrity
27.94204 -0.02352 -0.10352 -0.06502
Firstbestfriend Secondbestfriend Thirdbestfriend
-0.05862 -0.08306 0.05005
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-27.625 -11.315 -3.707 2.243 128.308
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 27.94204 5.41304 5.162 7.69e-07 ***
FindingFriends -0.02352 0.05548 -0.424 0.6722
KnowingPeople -0.10352 0.05191 -1.994 0.0479 *
Celebrity -0.06502 0.04477 -1.452 0.1486
Firstbestfriend -0.05862 0.04904 -1.195 0.2339
Secondbestfriend -0.08306 0.06200 -1.340 0.1824
Thirdbestfriend 0.05005 0.06209 0.806 0.4215
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 26.24 on 149 degrees of freedom
Multiple R-squared: 0.0838, Adjusted R-squared: 0.0469
F-statistic: 2.271 on 6 and 149 DF, p-value: 0.03977
> 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,] 3.241671e-04 6.483342e-04 9.996758e-01
[2,] 2.182283e-05 4.364565e-05 9.999782e-01
[3,] 1.352159e-06 2.704318e-06 9.999986e-01
[4,] 1.901592e-07 3.803184e-07 9.999998e-01
[5,] 1.003278e-08 2.006555e-08 1.000000e+00
[6,] 1.452369e-08 2.904738e-08 1.000000e+00
[7,] 3.631681e-08 7.263363e-08 1.000000e+00
[8,] 7.898765e-09 1.579753e-08 1.000000e+00
[9,] 2.067106e-09 4.134213e-09 1.000000e+00
[10,] 2.290586e-10 4.581173e-10 1.000000e+00
[11,] 2.415076e-11 4.830153e-11 1.000000e+00
[12,] 9.238824e-12 1.847765e-11 1.000000e+00
[13,] 9.851701e-13 1.970340e-12 1.000000e+00
[14,] 1.014431e-13 2.028862e-13 1.000000e+00
[15,] 2.999135e-14 5.998269e-14 1.000000e+00
[16,] 3.240437e-15 6.480873e-15 1.000000e+00
[17,] 3.232050e-16 6.464101e-16 1.000000e+00
[18,] 3.826216e-17 7.652431e-17 1.000000e+00
[19,] 5.467736e-18 1.093547e-17 1.000000e+00
[20,] 7.086574e-19 1.417315e-18 1.000000e+00
[21,] 1.835325e-19 3.670650e-19 1.000000e+00
[22,] 6.761690e-20 1.352338e-19 1.000000e+00
[23,] 6.765532e-21 1.353106e-20 1.000000e+00
[24,] 9.269030e-22 1.853806e-21 1.000000e+00
[25,] 1.227095e-22 2.454190e-22 1.000000e+00
[26,] 1.292264e-23 2.584527e-23 1.000000e+00
[27,] 1.204804e-24 2.409607e-24 1.000000e+00
[28,] 1.154874e-25 2.309747e-25 1.000000e+00
[29,] 1.098560e-26 2.197121e-26 1.000000e+00
[30,] 1.603550e-27 3.207100e-27 1.000000e+00
[31,] 1.536182e-28 3.072363e-28 1.000000e+00
[32,] 1.389727e-29 2.779455e-29 1.000000e+00
[33,] 1.510890e-30 3.021781e-30 1.000000e+00
[34,] 1.478582e-01 2.957164e-01 8.521418e-01
[35,] 7.506559e-01 4.986882e-01 2.493441e-01
[36,] 9.960996e-01 7.800785e-03 3.900393e-03
[37,] 9.999949e-01 1.012999e-05 5.064993e-06
[38,] 9.999958e-01 8.382270e-06 4.191135e-06
[39,] 9.999947e-01 1.058997e-05 5.294983e-06
[40,] 9.999953e-01 9.474817e-06 4.737409e-06
[41,] 9.999926e-01 1.480707e-05 7.403534e-06
[42,] 9.999928e-01 1.432423e-05 7.162115e-06
[43,] 9.999904e-01 1.927758e-05 9.638790e-06
[44,] 9.999863e-01 2.749587e-05 1.374793e-05
[45,] 9.999792e-01 4.169650e-05 2.084825e-05
[46,] 9.999704e-01 5.921146e-05 2.960573e-05
[47,] 9.999515e-01 9.701238e-05 4.850619e-05
[48,] 9.999358e-01 1.283484e-04 6.417422e-05
[49,] 9.998983e-01 2.033245e-04 1.016622e-04
[50,] 9.998513e-01 2.973448e-04 1.486724e-04
[51,] 9.998169e-01 3.661831e-04 1.830916e-04
[52,] 9.997282e-01 5.435766e-04 2.717883e-04
[53,] 9.995892e-01 8.215398e-04 4.107699e-04
[54,] 9.993900e-01 1.220015e-03 6.100076e-04
[55,] 9.991352e-01 1.729518e-03 8.647591e-04
[56,] 9.987253e-01 2.549369e-03 1.274684e-03
[57,] 9.981552e-01 3.689655e-03 1.844828e-03
[58,] 9.975959e-01 4.808234e-03 2.404117e-03
[59,] 9.965424e-01 6.915277e-03 3.457638e-03
[60,] 9.952485e-01 9.503088e-03 4.751544e-03
[61,] 9.934483e-01 1.310343e-02 6.551713e-03
[62,] 9.910322e-01 1.793551e-02 8.967753e-03
[63,] 9.880900e-01 2.382003e-02 1.191002e-02
[64,] 9.838882e-01 3.222361e-02 1.611181e-02
[65,] 9.784367e-01 4.312666e-02 2.156333e-02
[66,] 9.719294e-01 5.614114e-02 2.807057e-02
[67,] 9.634849e-01 7.303013e-02 3.651507e-02
[68,] 9.529129e-01 9.417425e-02 4.708713e-02
[69,] 9.427472e-01 1.145056e-01 5.725280e-02
[70,] 9.310198e-01 1.379603e-01 6.898017e-02
[71,] 9.146578e-01 1.706844e-01 8.534220e-02
[72,] 8.962035e-01 2.075929e-01 1.037965e-01
[73,] 8.821139e-01 2.357723e-01 1.178861e-01
[74,] 8.596110e-01 2.807781e-01 1.403890e-01
[75,] 8.311217e-01 3.377566e-01 1.688783e-01
[76,] 8.013438e-01 3.973124e-01 1.986562e-01
[77,] 7.661517e-01 4.676966e-01 2.338483e-01
[78,] 7.326260e-01 5.347480e-01 2.673740e-01
[79,] 6.916057e-01 6.167886e-01 3.083943e-01
[80,] 6.481092e-01 7.037815e-01 3.518908e-01
[81,] 6.036198e-01 7.927604e-01 3.963802e-01
[82,] 5.657537e-01 8.684926e-01 4.342463e-01
[83,] 5.203512e-01 9.592976e-01 4.796488e-01
[84,] 4.746406e-01 9.492811e-01 5.253594e-01
[85,] 4.316041e-01 8.632083e-01 5.683959e-01
[86,] 3.920237e-01 7.840474e-01 6.079763e-01
[87,] 3.614957e-01 7.229915e-01 6.385043e-01
[88,] 3.578430e-01 7.156861e-01 6.421570e-01
[89,] 3.129841e-01 6.259681e-01 6.870159e-01
[90,] 2.753852e-01 5.507704e-01 7.246148e-01
[91,] 2.360202e-01 4.720404e-01 7.639798e-01
[92,] 1.999134e-01 3.998267e-01 8.000866e-01
[93,] 1.869856e-01 3.739712e-01 8.130144e-01
[94,] 1.744693e-01 3.489387e-01 8.255307e-01
[95,] 1.450553e-01 2.901107e-01 8.549447e-01
[96,] 1.185608e-01 2.371216e-01 8.814392e-01
[97,] 1.071504e-01 2.143009e-01 8.928496e-01
[98,] 8.613820e-02 1.722764e-01 9.138618e-01
[99,] 6.980126e-02 1.396025e-01 9.301987e-01
[100,] 6.806177e-02 1.361235e-01 9.319382e-01
[101,] 5.267135e-02 1.053427e-01 9.473287e-01
[102,] 4.029764e-02 8.059527e-02 9.597024e-01
[103,] 3.031041e-02 6.062082e-02 9.696896e-01
[104,] 2.262142e-02 4.524283e-02 9.773786e-01
[105,] 1.746834e-02 3.493668e-02 9.825317e-01
[106,] 1.265630e-02 2.531260e-02 9.873437e-01
[107,] 9.536781e-03 1.907356e-02 9.904632e-01
[108,] 6.684424e-03 1.336885e-02 9.933156e-01
[109,] 4.569696e-03 9.139392e-03 9.954303e-01
[110,] 3.091371e-03 6.182742e-03 9.969086e-01
[111,] 2.021426e-03 4.042853e-03 9.979786e-01
[112,] 1.331969e-03 2.663937e-03 9.986680e-01
[113,] 8.561678e-04 1.712336e-03 9.991438e-01
[114,] 1.037739e-03 2.075479e-03 9.989623e-01
[115,] 2.749171e-02 5.498343e-02 9.725083e-01
[116,] 2.809123e-02 5.618246e-02 9.719088e-01
[117,] 2.369009e-02 4.738017e-02 9.763099e-01
[118,] 3.196551e-01 6.393102e-01 6.803449e-01
[119,] 9.579704e-01 8.405914e-02 4.202957e-02
[120,] 9.617339e-01 7.653227e-02 3.826614e-02
[121,] 9.982680e-01 3.463973e-03 1.731986e-03
[122,] 9.975215e-01 4.957047e-03 2.478523e-03
[123,] 9.977476e-01 4.504776e-03 2.252388e-03
[124,] 9.984794e-01 3.041255e-03 1.520627e-03
[125,] 9.997345e-01 5.310012e-04 2.655006e-04
[126,] 9.995328e-01 9.344823e-04 4.672411e-04
[127,] 1.000000e+00 1.255457e-10 6.277287e-11
[128,] 1.000000e+00 2.482810e-10 1.241405e-10
[129,] 1.000000e+00 1.946341e-09 9.731704e-10
[130,] 1.000000e+00 1.647121e-08 8.235605e-09
[131,] 9.999999e-01 1.402037e-07 7.010185e-08
[132,] 9.999995e-01 1.078087e-06 5.390436e-07
[133,] 9.999962e-01 7.601820e-06 3.800910e-06
[134,] 9.999690e-01 6.197298e-05 3.098649e-05
[135,] 9.999498e-01 1.004569e-04 5.022846e-05
[136,] 9.998044e-01 3.912280e-04 1.956140e-04
[137,] 9.998502e-01 2.995487e-04 1.497743e-04
> postscript(file="/var/wessaorg/rcomp/tmp/1zsx51322162773.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/2ocfj1322162773.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/319xq1322162773.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/43w8o1322162773.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/5ku1i1322162773.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 = 156
Frequency = 1
1 2 3 4 5 6
-14.39562259 -7.79370826 -15.61333197 -7.93219442 -8.32135616 -14.34007069
7 8 9 10 11 12
7.55511831 -12.34721184 7.49166758 -19.23347374 12.89313172 1.21840428
13 14 15 16 17 18
-2.51973458 -3.17026856 -20.70940425 -2.93030820 -20.85215375 -7.55796160
19 20 21 22 23 24
-20.79471692 -11.94656620 -19.26012937 -9.07074816 -6.65207573 -19.85306520
25 26 27 28 29 30
-18.87488561 -3.56570010 5.24724537 -11.19645642 -1.84489471 -5.57759085
31 32 33 34 35 36
-7.10827101 -8.95339496 -7.09880540 -20.07155677 -10.38918684 -2.61366269
37 38 39 40 41 42
1.15322659 -12.28113932 -11.71250210 0.23947439 -4.50020351 -19.73496526
43 44 45 46 47 48
126.51992032 99.56216559 120.01552116 103.88572004 26.25934190 -8.97609785
49 50 51 52 53 54
-10.27662095 0.88249657 -18.63472188 -10.56141737 -2.03608374 -12.96540182
55 56 57 58 59 60
-14.56548732 -7.81115116 -14.27145841 -7.05463708 4.60716911 -19.94985325
61 62 63 64 65 66
5.52754984 5.01385498 -0.63699890 -0.52250180 3.20137043 -5.97439552
67 68 69 70 71 72
-15.60650583 0.95953192 -10.51069169 4.10808465 3.09951860 8.39532735
73 74 75 76 77 78
-3.69171525 -1.75080491 3.00027299 -4.61953977 0.90945605 10.40454190
79 80 81 82 83 84
-10.14071012 -4.25795680 6.69833509 16.57124722 8.88287815 -0.04005062
85 86 87 88 89 90
8.01891495 1.15849444 10.95011300 1.64164672 -0.78016293 6.05279492
91 92 93 94 95 96
8.14188335 7.24325787 7.33708704 -8.18988286 -6.52843578 -13.95798968
97 98 99 100 101 102
-23.56712262 -0.82620287 -11.09420724 -2.35254945 -3.79553628 -18.00453254
103 104 105 106 107 108
-17.79570238 -2.44130253 -2.58796438 -12.09485842 5.36815197 -11.67120840
109 110 111 112 113 114
-17.73843523 0.22031213 2.45561802 -3.47213298 -7.44646373 4.29813201
115 116 117 118 119 120
-8.28636091 -9.85555635 -4.78647475 -6.73696176 -6.75158826 2.24458813
121 122 123 124 125 126
-1.21299948 -0.23814041 1.72716441 2.24199381 -12.79447489 -23.98977384
127 128 129 130 131 132
128.30840990 112.36178794 -26.87061491 52.99235525 -20.97873566 -25.17058391
133 134 135 136 137 138
-27.62492095 9.97234452 -16.84866258 43.64204539 -21.24364972 -7.05724170
139 140 141 142 143 144
0.77578702 -4.80024603 -3.72177000 -11.03129497 -3.07016335 -5.50053850
145 146 147 148 149 150
-14.83965399 7.38893403 -1.43850948 6.96502249 -2.31434277 -7.62279998
151 152 153 154 155 156
-12.14273621 0.45056805 0.64759831 -0.05597890 3.13295318 -3.03894662
> postscript(file="/var/wessaorg/rcomp/tmp/6fsf71322162773.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 -14.39562259 NA
1 -7.79370826 -14.39562259
2 -15.61333197 -7.79370826
3 -7.93219442 -15.61333197
4 -8.32135616 -7.93219442
5 -14.34007069 -8.32135616
6 7.55511831 -14.34007069
7 -12.34721184 7.55511831
8 7.49166758 -12.34721184
9 -19.23347374 7.49166758
10 12.89313172 -19.23347374
11 1.21840428 12.89313172
12 -2.51973458 1.21840428
13 -3.17026856 -2.51973458
14 -20.70940425 -3.17026856
15 -2.93030820 -20.70940425
16 -20.85215375 -2.93030820
17 -7.55796160 -20.85215375
18 -20.79471692 -7.55796160
19 -11.94656620 -20.79471692
20 -19.26012937 -11.94656620
21 -9.07074816 -19.26012937
22 -6.65207573 -9.07074816
23 -19.85306520 -6.65207573
24 -18.87488561 -19.85306520
25 -3.56570010 -18.87488561
26 5.24724537 -3.56570010
27 -11.19645642 5.24724537
28 -1.84489471 -11.19645642
29 -5.57759085 -1.84489471
30 -7.10827101 -5.57759085
31 -8.95339496 -7.10827101
32 -7.09880540 -8.95339496
33 -20.07155677 -7.09880540
34 -10.38918684 -20.07155677
35 -2.61366269 -10.38918684
36 1.15322659 -2.61366269
37 -12.28113932 1.15322659
38 -11.71250210 -12.28113932
39 0.23947439 -11.71250210
40 -4.50020351 0.23947439
41 -19.73496526 -4.50020351
42 126.51992032 -19.73496526
43 99.56216559 126.51992032
44 120.01552116 99.56216559
45 103.88572004 120.01552116
46 26.25934190 103.88572004
47 -8.97609785 26.25934190
48 -10.27662095 -8.97609785
49 0.88249657 -10.27662095
50 -18.63472188 0.88249657
51 -10.56141737 -18.63472188
52 -2.03608374 -10.56141737
53 -12.96540182 -2.03608374
54 -14.56548732 -12.96540182
55 -7.81115116 -14.56548732
56 -14.27145841 -7.81115116
57 -7.05463708 -14.27145841
58 4.60716911 -7.05463708
59 -19.94985325 4.60716911
60 5.52754984 -19.94985325
61 5.01385498 5.52754984
62 -0.63699890 5.01385498
63 -0.52250180 -0.63699890
64 3.20137043 -0.52250180
65 -5.97439552 3.20137043
66 -15.60650583 -5.97439552
67 0.95953192 -15.60650583
68 -10.51069169 0.95953192
69 4.10808465 -10.51069169
70 3.09951860 4.10808465
71 8.39532735 3.09951860
72 -3.69171525 8.39532735
73 -1.75080491 -3.69171525
74 3.00027299 -1.75080491
75 -4.61953977 3.00027299
76 0.90945605 -4.61953977
77 10.40454190 0.90945605
78 -10.14071012 10.40454190
79 -4.25795680 -10.14071012
80 6.69833509 -4.25795680
81 16.57124722 6.69833509
82 8.88287815 16.57124722
83 -0.04005062 8.88287815
84 8.01891495 -0.04005062
85 1.15849444 8.01891495
86 10.95011300 1.15849444
87 1.64164672 10.95011300
88 -0.78016293 1.64164672
89 6.05279492 -0.78016293
90 8.14188335 6.05279492
91 7.24325787 8.14188335
92 7.33708704 7.24325787
93 -8.18988286 7.33708704
94 -6.52843578 -8.18988286
95 -13.95798968 -6.52843578
96 -23.56712262 -13.95798968
97 -0.82620287 -23.56712262
98 -11.09420724 -0.82620287
99 -2.35254945 -11.09420724
100 -3.79553628 -2.35254945
101 -18.00453254 -3.79553628
102 -17.79570238 -18.00453254
103 -2.44130253 -17.79570238
104 -2.58796438 -2.44130253
105 -12.09485842 -2.58796438
106 5.36815197 -12.09485842
107 -11.67120840 5.36815197
108 -17.73843523 -11.67120840
109 0.22031213 -17.73843523
110 2.45561802 0.22031213
111 -3.47213298 2.45561802
112 -7.44646373 -3.47213298
113 4.29813201 -7.44646373
114 -8.28636091 4.29813201
115 -9.85555635 -8.28636091
116 -4.78647475 -9.85555635
117 -6.73696176 -4.78647475
118 -6.75158826 -6.73696176
119 2.24458813 -6.75158826
120 -1.21299948 2.24458813
121 -0.23814041 -1.21299948
122 1.72716441 -0.23814041
123 2.24199381 1.72716441
124 -12.79447489 2.24199381
125 -23.98977384 -12.79447489
126 128.30840990 -23.98977384
127 112.36178794 128.30840990
128 -26.87061491 112.36178794
129 52.99235525 -26.87061491
130 -20.97873566 52.99235525
131 -25.17058391 -20.97873566
132 -27.62492095 -25.17058391
133 9.97234452 -27.62492095
134 -16.84866258 9.97234452
135 43.64204539 -16.84866258
136 -21.24364972 43.64204539
137 -7.05724170 -21.24364972
138 0.77578702 -7.05724170
139 -4.80024603 0.77578702
140 -3.72177000 -4.80024603
141 -11.03129497 -3.72177000
142 -3.07016335 -11.03129497
143 -5.50053850 -3.07016335
144 -14.83965399 -5.50053850
145 7.38893403 -14.83965399
146 -1.43850948 7.38893403
147 6.96502249 -1.43850948
148 -2.31434277 6.96502249
149 -7.62279998 -2.31434277
150 -12.14273621 -7.62279998
151 0.45056805 -12.14273621
152 0.64759831 0.45056805
153 -0.05597890 0.64759831
154 3.13295318 -0.05597890
155 -3.03894662 3.13295318
156 NA -3.03894662
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -7.79370826 -14.39562259
[2,] -15.61333197 -7.79370826
[3,] -7.93219442 -15.61333197
[4,] -8.32135616 -7.93219442
[5,] -14.34007069 -8.32135616
[6,] 7.55511831 -14.34007069
[7,] -12.34721184 7.55511831
[8,] 7.49166758 -12.34721184
[9,] -19.23347374 7.49166758
[10,] 12.89313172 -19.23347374
[11,] 1.21840428 12.89313172
[12,] -2.51973458 1.21840428
[13,] -3.17026856 -2.51973458
[14,] -20.70940425 -3.17026856
[15,] -2.93030820 -20.70940425
[16,] -20.85215375 -2.93030820
[17,] -7.55796160 -20.85215375
[18,] -20.79471692 -7.55796160
[19,] -11.94656620 -20.79471692
[20,] -19.26012937 -11.94656620
[21,] -9.07074816 -19.26012937
[22,] -6.65207573 -9.07074816
[23,] -19.85306520 -6.65207573
[24,] -18.87488561 -19.85306520
[25,] -3.56570010 -18.87488561
[26,] 5.24724537 -3.56570010
[27,] -11.19645642 5.24724537
[28,] -1.84489471 -11.19645642
[29,] -5.57759085 -1.84489471
[30,] -7.10827101 -5.57759085
[31,] -8.95339496 -7.10827101
[32,] -7.09880540 -8.95339496
[33,] -20.07155677 -7.09880540
[34,] -10.38918684 -20.07155677
[35,] -2.61366269 -10.38918684
[36,] 1.15322659 -2.61366269
[37,] -12.28113932 1.15322659
[38,] -11.71250210 -12.28113932
[39,] 0.23947439 -11.71250210
[40,] -4.50020351 0.23947439
[41,] -19.73496526 -4.50020351
[42,] 126.51992032 -19.73496526
[43,] 99.56216559 126.51992032
[44,] 120.01552116 99.56216559
[45,] 103.88572004 120.01552116
[46,] 26.25934190 103.88572004
[47,] -8.97609785 26.25934190
[48,] -10.27662095 -8.97609785
[49,] 0.88249657 -10.27662095
[50,] -18.63472188 0.88249657
[51,] -10.56141737 -18.63472188
[52,] -2.03608374 -10.56141737
[53,] -12.96540182 -2.03608374
[54,] -14.56548732 -12.96540182
[55,] -7.81115116 -14.56548732
[56,] -14.27145841 -7.81115116
[57,] -7.05463708 -14.27145841
[58,] 4.60716911 -7.05463708
[59,] -19.94985325 4.60716911
[60,] 5.52754984 -19.94985325
[61,] 5.01385498 5.52754984
[62,] -0.63699890 5.01385498
[63,] -0.52250180 -0.63699890
[64,] 3.20137043 -0.52250180
[65,] -5.97439552 3.20137043
[66,] -15.60650583 -5.97439552
[67,] 0.95953192 -15.60650583
[68,] -10.51069169 0.95953192
[69,] 4.10808465 -10.51069169
[70,] 3.09951860 4.10808465
[71,] 8.39532735 3.09951860
[72,] -3.69171525 8.39532735
[73,] -1.75080491 -3.69171525
[74,] 3.00027299 -1.75080491
[75,] -4.61953977 3.00027299
[76,] 0.90945605 -4.61953977
[77,] 10.40454190 0.90945605
[78,] -10.14071012 10.40454190
[79,] -4.25795680 -10.14071012
[80,] 6.69833509 -4.25795680
[81,] 16.57124722 6.69833509
[82,] 8.88287815 16.57124722
[83,] -0.04005062 8.88287815
[84,] 8.01891495 -0.04005062
[85,] 1.15849444 8.01891495
[86,] 10.95011300 1.15849444
[87,] 1.64164672 10.95011300
[88,] -0.78016293 1.64164672
[89,] 6.05279492 -0.78016293
[90,] 8.14188335 6.05279492
[91,] 7.24325787 8.14188335
[92,] 7.33708704 7.24325787
[93,] -8.18988286 7.33708704
[94,] -6.52843578 -8.18988286
[95,] -13.95798968 -6.52843578
[96,] -23.56712262 -13.95798968
[97,] -0.82620287 -23.56712262
[98,] -11.09420724 -0.82620287
[99,] -2.35254945 -11.09420724
[100,] -3.79553628 -2.35254945
[101,] -18.00453254 -3.79553628
[102,] -17.79570238 -18.00453254
[103,] -2.44130253 -17.79570238
[104,] -2.58796438 -2.44130253
[105,] -12.09485842 -2.58796438
[106,] 5.36815197 -12.09485842
[107,] -11.67120840 5.36815197
[108,] -17.73843523 -11.67120840
[109,] 0.22031213 -17.73843523
[110,] 2.45561802 0.22031213
[111,] -3.47213298 2.45561802
[112,] -7.44646373 -3.47213298
[113,] 4.29813201 -7.44646373
[114,] -8.28636091 4.29813201
[115,] -9.85555635 -8.28636091
[116,] -4.78647475 -9.85555635
[117,] -6.73696176 -4.78647475
[118,] -6.75158826 -6.73696176
[119,] 2.24458813 -6.75158826
[120,] -1.21299948 2.24458813
[121,] -0.23814041 -1.21299948
[122,] 1.72716441 -0.23814041
[123,] 2.24199381 1.72716441
[124,] -12.79447489 2.24199381
[125,] -23.98977384 -12.79447489
[126,] 128.30840990 -23.98977384
[127,] 112.36178794 128.30840990
[128,] -26.87061491 112.36178794
[129,] 52.99235525 -26.87061491
[130,] -20.97873566 52.99235525
[131,] -25.17058391 -20.97873566
[132,] -27.62492095 -25.17058391
[133,] 9.97234452 -27.62492095
[134,] -16.84866258 9.97234452
[135,] 43.64204539 -16.84866258
[136,] -21.24364972 43.64204539
[137,] -7.05724170 -21.24364972
[138,] 0.77578702 -7.05724170
[139,] -4.80024603 0.77578702
[140,] -3.72177000 -4.80024603
[141,] -11.03129497 -3.72177000
[142,] -3.07016335 -11.03129497
[143,] -5.50053850 -3.07016335
[144,] -14.83965399 -5.50053850
[145,] 7.38893403 -14.83965399
[146,] -1.43850948 7.38893403
[147,] 6.96502249 -1.43850948
[148,] -2.31434277 6.96502249
[149,] -7.62279998 -2.31434277
[150,] -12.14273621 -7.62279998
[151,] 0.45056805 -12.14273621
[152,] 0.64759831 0.45056805
[153,] -0.05597890 0.64759831
[154,] 3.13295318 -0.05597890
[155,] -3.03894662 3.13295318
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -7.79370826 -14.39562259
2 -15.61333197 -7.79370826
3 -7.93219442 -15.61333197
4 -8.32135616 -7.93219442
5 -14.34007069 -8.32135616
6 7.55511831 -14.34007069
7 -12.34721184 7.55511831
8 7.49166758 -12.34721184
9 -19.23347374 7.49166758
10 12.89313172 -19.23347374
11 1.21840428 12.89313172
12 -2.51973458 1.21840428
13 -3.17026856 -2.51973458
14 -20.70940425 -3.17026856
15 -2.93030820 -20.70940425
16 -20.85215375 -2.93030820
17 -7.55796160 -20.85215375
18 -20.79471692 -7.55796160
19 -11.94656620 -20.79471692
20 -19.26012937 -11.94656620
21 -9.07074816 -19.26012937
22 -6.65207573 -9.07074816
23 -19.85306520 -6.65207573
24 -18.87488561 -19.85306520
25 -3.56570010 -18.87488561
26 5.24724537 -3.56570010
27 -11.19645642 5.24724537
28 -1.84489471 -11.19645642
29 -5.57759085 -1.84489471
30 -7.10827101 -5.57759085
31 -8.95339496 -7.10827101
32 -7.09880540 -8.95339496
33 -20.07155677 -7.09880540
34 -10.38918684 -20.07155677
35 -2.61366269 -10.38918684
36 1.15322659 -2.61366269
37 -12.28113932 1.15322659
38 -11.71250210 -12.28113932
39 0.23947439 -11.71250210
40 -4.50020351 0.23947439
41 -19.73496526 -4.50020351
42 126.51992032 -19.73496526
43 99.56216559 126.51992032
44 120.01552116 99.56216559
45 103.88572004 120.01552116
46 26.25934190 103.88572004
47 -8.97609785 26.25934190
48 -10.27662095 -8.97609785
49 0.88249657 -10.27662095
50 -18.63472188 0.88249657
51 -10.56141737 -18.63472188
52 -2.03608374 -10.56141737
53 -12.96540182 -2.03608374
54 -14.56548732 -12.96540182
55 -7.81115116 -14.56548732
56 -14.27145841 -7.81115116
57 -7.05463708 -14.27145841
58 4.60716911 -7.05463708
59 -19.94985325 4.60716911
60 5.52754984 -19.94985325
61 5.01385498 5.52754984
62 -0.63699890 5.01385498
63 -0.52250180 -0.63699890
64 3.20137043 -0.52250180
65 -5.97439552 3.20137043
66 -15.60650583 -5.97439552
67 0.95953192 -15.60650583
68 -10.51069169 0.95953192
69 4.10808465 -10.51069169
70 3.09951860 4.10808465
71 8.39532735 3.09951860
72 -3.69171525 8.39532735
73 -1.75080491 -3.69171525
74 3.00027299 -1.75080491
75 -4.61953977 3.00027299
76 0.90945605 -4.61953977
77 10.40454190 0.90945605
78 -10.14071012 10.40454190
79 -4.25795680 -10.14071012
80 6.69833509 -4.25795680
81 16.57124722 6.69833509
82 8.88287815 16.57124722
83 -0.04005062 8.88287815
84 8.01891495 -0.04005062
85 1.15849444 8.01891495
86 10.95011300 1.15849444
87 1.64164672 10.95011300
88 -0.78016293 1.64164672
89 6.05279492 -0.78016293
90 8.14188335 6.05279492
91 7.24325787 8.14188335
92 7.33708704 7.24325787
93 -8.18988286 7.33708704
94 -6.52843578 -8.18988286
95 -13.95798968 -6.52843578
96 -23.56712262 -13.95798968
97 -0.82620287 -23.56712262
98 -11.09420724 -0.82620287
99 -2.35254945 -11.09420724
100 -3.79553628 -2.35254945
101 -18.00453254 -3.79553628
102 -17.79570238 -18.00453254
103 -2.44130253 -17.79570238
104 -2.58796438 -2.44130253
105 -12.09485842 -2.58796438
106 5.36815197 -12.09485842
107 -11.67120840 5.36815197
108 -17.73843523 -11.67120840
109 0.22031213 -17.73843523
110 2.45561802 0.22031213
111 -3.47213298 2.45561802
112 -7.44646373 -3.47213298
113 4.29813201 -7.44646373
114 -8.28636091 4.29813201
115 -9.85555635 -8.28636091
116 -4.78647475 -9.85555635
117 -6.73696176 -4.78647475
118 -6.75158826 -6.73696176
119 2.24458813 -6.75158826
120 -1.21299948 2.24458813
121 -0.23814041 -1.21299948
122 1.72716441 -0.23814041
123 2.24199381 1.72716441
124 -12.79447489 2.24199381
125 -23.98977384 -12.79447489
126 128.30840990 -23.98977384
127 112.36178794 128.30840990
128 -26.87061491 112.36178794
129 52.99235525 -26.87061491
130 -20.97873566 52.99235525
131 -25.17058391 -20.97873566
132 -27.62492095 -25.17058391
133 9.97234452 -27.62492095
134 -16.84866258 9.97234452
135 43.64204539 -16.84866258
136 -21.24364972 43.64204539
137 -7.05724170 -21.24364972
138 0.77578702 -7.05724170
139 -4.80024603 0.77578702
140 -3.72177000 -4.80024603
141 -11.03129497 -3.72177000
142 -3.07016335 -11.03129497
143 -5.50053850 -3.07016335
144 -14.83965399 -5.50053850
145 7.38893403 -14.83965399
146 -1.43850948 7.38893403
147 6.96502249 -1.43850948
148 -2.31434277 6.96502249
149 -7.62279998 -2.31434277
150 -12.14273621 -7.62279998
151 0.45056805 -12.14273621
152 0.64759831 0.45056805
153 -0.05597890 0.64759831
154 3.13295318 -0.05597890
155 -3.03894662 3.13295318
> 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/7bs4q1322162773.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/8cu8c1322162773.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/9m5hb1322162773.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/10hxuj1322162773.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/116s9a1322162773.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/12oiy91322162773.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/13c0sr1322162773.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/14s7z31322162773.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/1504ud1322162773.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/16y2pk1322162773.tab")
+ }
>
> try(system("convert tmp/1zsx51322162773.ps tmp/1zsx51322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ocfj1322162773.ps tmp/2ocfj1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/319xq1322162773.ps tmp/319xq1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/43w8o1322162773.ps tmp/43w8o1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ku1i1322162773.ps tmp/5ku1i1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/6fsf71322162773.ps tmp/6fsf71322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bs4q1322162773.ps tmp/7bs4q1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/8cu8c1322162773.ps tmp/8cu8c1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/9m5hb1322162773.ps tmp/9m5hb1322162773.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hxuj1322162773.ps tmp/10hxuj1322162773.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.173 0.561 5.843