R version 2.9.0 (2009-04-17)
Copyright (C) 2009 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(13
+ ,14
+ ,3
+ ,25
+ ,55
+ ,147
+ ,12
+ ,8
+ ,5
+ ,158
+ ,7
+ ,71
+ ,10
+ ,12
+ ,6
+ ,0
+ ,0
+ ,0
+ ,9
+ ,7
+ ,6
+ ,143
+ ,10
+ ,0
+ ,10
+ ,10
+ ,5
+ ,67
+ ,74
+ ,43
+ ,12
+ ,7
+ ,3
+ ,0
+ ,0
+ ,0
+ ,13
+ ,16
+ ,8
+ ,148
+ ,138
+ ,8
+ ,12
+ ,11
+ ,4
+ ,28
+ ,0
+ ,0
+ ,12
+ ,14
+ ,4
+ ,114
+ ,113
+ ,34
+ ,6
+ ,6
+ ,4
+ ,0
+ ,0
+ ,0
+ ,5
+ ,16
+ ,6
+ ,123
+ ,115
+ ,103
+ ,12
+ ,11
+ ,6
+ ,145
+ ,9
+ ,0
+ ,11
+ ,16
+ ,5
+ ,113
+ ,114
+ ,73
+ ,14
+ ,12
+ ,4
+ ,152
+ ,59
+ ,159
+ ,14
+ ,7
+ ,6
+ ,0
+ ,0
+ ,0
+ ,12
+ ,13
+ ,4
+ ,36
+ ,114
+ ,113
+ ,12
+ ,11
+ ,6
+ ,0
+ ,0
+ ,0
+ ,11
+ ,15
+ ,6
+ ,8
+ ,102
+ ,44
+ ,11
+ ,7
+ ,4
+ ,108
+ ,0
+ ,0
+ ,7
+ ,9
+ ,4
+ ,112
+ ,86
+ ,0
+ ,9
+ ,7
+ ,2
+ ,51
+ ,17
+ ,41
+ ,11
+ ,14
+ ,7
+ ,43
+ ,45
+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+ ,5
+ ,11
+ ,15
+ ,6
+ ,93
+ ,94
+ ,69
+ ,12
+ ,13
+ ,3
+ ,0
+ ,0
+ ,0
+ ,12
+ ,15
+ ,6
+ ,95
+ ,87
+ ,0
+ ,10
+ ,14
+ ,5
+ ,50
+ ,156
+ ,142
+ ,11
+ ,16
+ ,4
+ ,86
+ ,139
+ ,17
+ ,12
+ ,14
+ ,6
+ ,33
+ ,145
+ ,100
+ ,12
+ ,14
+ ,4
+ ,152
+ ,55
+ ,70
+ ,10
+ ,10
+ ,4
+ ,51
+ ,41
+ ,0
+ ,12
+ ,10
+ ,4
+ ,48
+ ,25
+ ,123
+ ,13
+ ,4
+ ,6
+ ,97
+ ,47
+ ,109
+ ,12
+ ,8
+ ,5
+ ,77
+ ,0
+ ,0
+ ,15
+ ,15
+ ,6
+ ,130
+ ,143
+ ,37
+ ,11
+ ,16
+ ,6
+ ,8
+ ,102
+ ,44
+ ,12
+ ,12
+ ,8
+ ,84
+ ,148
+ ,98
+ ,11
+ ,12
+ ,7
+ ,51
+ ,153
+ ,11
+ ,12
+ ,15
+ ,7
+ ,33
+ ,32
+ ,9
+ ,11
+ ,9
+ ,4
+ ,6
+ ,106
+ ,0
+ ,10
+ ,12
+ ,6
+ ,116
+ ,63
+ ,57
+ ,11
+ ,14
+ ,6
+ ,88
+ ,56
+ ,63
+ ,11
+ ,11
+ ,2
+ ,142
+ ,39
+ ,66)
+ ,dim=c(6
+ ,156)
+ ,dimnames=list(c('FindingFriends'
+ ,'KnowingPeople'
+ ,'Celebrity'
+ ,'firstbestfriend'
+ ,'secondbestfriend'
+ ,'thirdbestfriend')
+ ,1:156))
> y <- array(NA,dim=c(6,156),dimnames=list(c('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
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
FindingFriends KnowingPeople Celebrity firstbestfriend secondbestfriend
1 13 14 3 25 55
2 12 8 5 158 7
3 10 12 6 0 0
4 9 7 6 143 10
5 10 10 5 67 74
6 12 7 3 0 0
7 13 16 8 148 138
8 12 11 4 28 0
9 12 14 4 114 113
10 6 6 4 0 0
11 5 16 6 123 115
12 12 11 6 145 9
13 11 16 5 113 114
14 14 12 4 152 59
15 14 7 6 0 0
16 12 13 4 36 114
17 12 11 6 0 0
18 11 15 6 8 102
19 11 7 4 108 0
20 7 9 4 112 86
21 9 7 2 51 17
22 11 14 7 43 45
23 11 15 5 120 123
24 12 7 4 13 24
25 12 15 6 55 5
26 11 17 6 103 123
27 11 15 7 127 136
28 8 14 5 14 4
29 9 14 6 135 76
30 12 8 4 38 99
31 10 8 4 11 98
32 10 14 7 43 67
33 12 14 7 141 92
34 8 8 4 62 13
35 12 11 4 62 24
36 11 16 6 135 129
37 12 10 6 117 117
38 7 8 5 82 11
39 11 14 6 145 20
40 11 16 7 87 91
41 12 13 6 76 111
42 9 5 3 124 0
43 15 8 3 151 58
44 11 10 4 131 0
45 11 8 6 127 146
46 11 13 7 76 129
47 11 15 5 25 48
48 15 6 4 0 0
49 11 12 5 58 111
50 12 16 6 115 32
51 12 5 6 130 112
52 9 15 6 17 51
53 12 12 5 102 53
54 12 8 4 21 131
55 13 13 5 0 0
56 11 14 5 14 76
57 9 12 4 110 106
58 9 16 6 133 26
59 11 10 2 83 44
60 15 8 56 63 116
61 8 3 0 0 0
62 16 6 44 116 88
63 19 6 70 119 25
64 14 6 36 18 113
65 6 5 5 134 157
66 13 5 118 138 26
67 15 6 17 41 38
68 7 5 79 0 0
69 13 6 122 57 53
70 4 2 119 101 0
71 14 5 36 114 106
72 13 5 36 113 106
73 11 5 141 122 102
74 14 6 0 14 138
75 12 6 37 10 142
76 15 6 110 27 73
77 14 5 10 39 130
78 13 5 14 133 86
79 8 4 157 42 78
80 6 2 59 0 0
81 7 4 77 58 0
82 13 6 129 133 4
83 13 6 125 151 91
84 11 5 87 111 132
85 5 3 61 139 0
86 12 6 146 126 0
87 8 4 96 139 0
88 11 5 133 138 14
89 14 8 47 52 97
90 9 4 74 67 45
91 10 6 109 97 0
92 13 6 30 137 149
93 16 7 116 56 57
94 16 6 149 3 105
95 11 5 19 78 0
96 8 4 96 0 0
97 4 6 0 0 0
98 7 3 21 0 0
99 14 5 26 118 128
100 11 6 156 39 29
101 17 7 53 63 148
102 15 7 72 78 93
103 17 6 27 26 4
104 5 3 66 50 0
105 4 2 71 104 158
106 10 8 66 54 144
107 11 3 40 104 0
108 15 8 57 148 122
109 10 3 3 30 149
110 9 4 12 38 17
111 12 5 107 132 91
112 15 7 80 132 111
113 7 6 98 84 99
114 13 6 155 71 40
115 12 7 111 125 132
116 14 6 81 25 123
117 14 6 50 66 54
118 8 6 49 86 90
119 15 6 96 61 86
120 12 4 2 60 152
121 12 4 1 144 152
122 16 5 22 120 123
123 9 4 64 139 100
124 15 6 56 131 116
125 15 6 144 159 59
126 6 5 0 0 0
127 14 8 94 18 5
128 15 6 25 123 147
129 10 5 93 18 139
130 6 4 0 0 0
131 14 8 48 123 81
132 12 6 30 105 3
133 8 4 19 0 0
134 11 6 0 0 0
135 13 6 10 68 37
136 9 4 78 157 5
137 15 6 93 94 69
138 13 3 0 0 0
139 15 6 95 87 0
140 14 5 50 156 142
141 16 4 86 139 17
142 14 6 33 145 100
143 14 4 152 55 70
144 10 4 51 41 0
145 10 4 48 25 123
146 4 6 97 47 109
147 8 5 77 0 0
148 15 6 130 143 37
149 16 6 8 102 44
150 12 8 84 148 98
151 12 7 51 153 11
152 15 7 33 32 9
153 9 4 6 106 0
154 12 6 116 63 57
155 14 6 88 56 63
156 11 2 142 39 66
thirdbestfriend
1 147
2 71
3 0
4 0
5 43
6 0
7 8
8 0
9 34
10 0
11 103
12 0
13 73
14 159
15 0
16 113
17 0
18 44
19 0
20 0
21 41
22 74
23 0
24 0
25 0
26 32
27 126
28 154
29 129
30 98
31 82
32 45
33 8
34 0
35 129
36 31
37 117
38 99
39 55
40 132
41 58
42 0
43 0
44 0
45 101
46 31
47 147
48 0
49 132
50 123
51 39
52 136
53 141
54 0
55 0
56 135
57 118
58 154
59 11
60 12
61 12
62 9
63 11
64 9
65 12
66 12
67 12
68 12
69 14
70 11
71 12
72 11
73 6
74 10
75 12
76 13
77 8
78 12
79 12
80 12
81 6
82 11
83 10
84 12
85 13
86 11
87 7
88 11
89 11
90 11
91 11
92 12
93 10
94 11
95 12
96 7
97 13
98 8
99 12
100 11
101 12
102 14
103 10
104 10
105 13
106 10
107 11
108 10
109 7
110 10
111 8
112 12
113 12
114 12
115 11
116 12
117 12
118 12
119 11
120 12
121 11
122 11
123 13
124 12
125 12
126 12
127 12
128 8
129 8
130 12
131 11
132 12
133 13
134 12
135 12
136 11
137 12
138 12
139 10
140 11
141 12
142 12
143 10
144 12
145 13
146 12
147 15
148 11
149 12
150 11
151 12
152 11
153 10
154 11
155 11
156 13
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) KnowingPeople Celebrity firstbestfriend
9.015082 0.173745 0.009351 0.005599
secondbestfriend thirdbestfriend
0.010639 -0.015693
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.19915 -1.61725 0.05869 2.01341 7.52825
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.015082 0.762899 11.817 <2e-16 ***
KnowingPeople 0.173745 0.082966 2.094 0.0379 *
Celebrity 0.009351 0.005716 1.636 0.1040
firstbestfriend 0.005599 0.004705 1.190 0.2360
secondbestfriend 0.010639 0.004580 2.323 0.0215 *
thirdbestfriend -0.015693 0.007084 -2.215 0.0283 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.888 on 150 degrees of freedom
Multiple R-squared: 0.1107, Adjusted R-squared: 0.0811
F-statistic: 3.736 on 5 and 150 DF, p-value: 0.003238
> 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.176701688 0.353403377 0.8232983
[2,] 0.216214434 0.432428868 0.7837856
[3,] 0.750496926 0.499006149 0.2495031
[4,] 0.643970793 0.712058413 0.3560292
[5,] 0.537939453 0.924121094 0.4620605
[6,] 0.517503249 0.964993501 0.4824968
[7,] 0.722396890 0.555206221 0.2776031
[8,] 0.656073426 0.687853148 0.3439266
[9,] 0.577160749 0.845678502 0.4228393
[10,] 0.491164895 0.982329790 0.5088351
[11,] 0.405436520 0.810873040 0.5945635
[12,] 0.413262041 0.826524081 0.5867380
[13,] 0.350108160 0.700216319 0.6498918
[14,] 0.291390173 0.582780346 0.7086098
[15,] 0.245201350 0.490402700 0.7547986
[16,] 0.217776917 0.435553835 0.7822231
[17,] 0.168770753 0.337541505 0.8312292
[18,] 0.136162987 0.272325974 0.8638370
[19,] 0.101400054 0.202800109 0.8985999
[20,] 0.142960008 0.285920016 0.8570400
[21,] 0.123844789 0.247689579 0.8761552
[22,] 0.109001926 0.218003852 0.8909981
[23,] 0.081471584 0.162943169 0.9185284
[24,] 0.064822087 0.129644173 0.9351779
[25,] 0.053655936 0.107311871 0.9463441
[26,] 0.058028420 0.116056840 0.9419716
[27,] 0.048287095 0.096574190 0.9517129
[28,] 0.045319391 0.090638783 0.9546806
[29,] 0.036856457 0.073712914 0.9631435
[30,] 0.045993034 0.091986068 0.9540070
[31,] 0.036394242 0.072788484 0.9636058
[32,] 0.026437287 0.052874575 0.9735627
[33,] 0.020899983 0.041799965 0.9791000
[34,] 0.016084532 0.032169063 0.9839155
[35,] 0.027528219 0.055056439 0.9724718
[36,] 0.022653462 0.045306924 0.9773465
[37,] 0.016565498 0.033130997 0.9834345
[38,] 0.016205000 0.032410000 0.9837950
[39,] 0.011538358 0.023076715 0.9884616
[40,] 0.022886229 0.045772457 0.9771138
[41,] 0.016955326 0.033910651 0.9830447
[42,] 0.013071463 0.026142925 0.9869285
[43,] 0.010180494 0.020360989 0.9898195
[44,] 0.008292192 0.016584383 0.9917078
[45,] 0.007366942 0.014733884 0.9926331
[46,] 0.005683743 0.011367486 0.9943163
[47,] 0.007169164 0.014338329 0.9928308
[48,] 0.005332247 0.010664493 0.9946678
[49,] 0.004388784 0.008777567 0.9956112
[50,] 0.003305620 0.006611241 0.9966944
[51,] 0.003878848 0.007757697 0.9961212
[52,] 0.002771888 0.005543777 0.9972281
[53,] 0.002664063 0.005328125 0.9973359
[54,] 0.002329893 0.004659787 0.9976701
[55,] 0.003487818 0.006975636 0.9965122
[56,] 0.002507909 0.005015818 0.9974921
[57,] 0.009982985 0.019965971 0.9900170
[58,] 0.038925390 0.077850780 0.9610746
[59,] 0.047209788 0.094419576 0.9527902
[60,] 0.141034173 0.282068345 0.8589658
[61,] 0.124604685 0.249209370 0.8753953
[62,] 0.342274584 0.684549169 0.6577254
[63,] 0.329796594 0.659593188 0.6702034
[64,] 0.295919121 0.591838242 0.7040809
[65,] 0.267830919 0.535661839 0.7321691
[66,] 0.249338987 0.498677973 0.7506610
[67,] 0.213390524 0.426781048 0.7866095
[68,] 0.220541584 0.441083168 0.7794584
[69,] 0.209199356 0.418398712 0.7908006
[70,] 0.184316223 0.368632447 0.8156838
[71,] 0.202701872 0.405403745 0.7972981
[72,] 0.226418524 0.452837048 0.7735815
[73,] 0.242423020 0.484846040 0.7575770
[74,] 0.219765910 0.439531819 0.7802341
[75,] 0.190151579 0.380303159 0.8098484
[76,] 0.164105746 0.328211491 0.8358943
[77,] 0.234310599 0.468621199 0.7656894
[78,] 0.204790842 0.409581683 0.7952092
[79,] 0.211676271 0.423352541 0.7883237
[80,] 0.184028437 0.368056874 0.8159716
[81,] 0.162548154 0.325096307 0.8374518
[82,] 0.144164294 0.288328588 0.8558357
[83,] 0.132409171 0.264818341 0.8675908
[84,] 0.109627944 0.219255888 0.8903721
[85,] 0.124195316 0.248390632 0.8758047
[86,] 0.152096994 0.304193987 0.8479030
[87,] 0.126465041 0.252930081 0.8735350
[88,] 0.118967756 0.237935513 0.8810322
[89,] 0.250098341 0.500196682 0.7499017
[90,] 0.238640285 0.477280570 0.7613597
[91,] 0.221739376 0.443478751 0.7782606
[92,] 0.190474616 0.380949232 0.8095254
[93,] 0.237942603 0.475885206 0.7620574
[94,] 0.237328965 0.474657930 0.7626710
[95,] 0.372484086 0.744968172 0.6275159
[96,] 0.492550213 0.985100427 0.5074498
[97,] 0.701656489 0.596687023 0.2983435
[98,] 0.706432513 0.587134974 0.2935675
[99,] 0.663066037 0.673867926 0.3369340
[100,] 0.626758928 0.746482145 0.3732411
[101,] 0.581498533 0.837002934 0.4185015
[102,] 0.545177852 0.909644296 0.4548221
[103,] 0.517586551 0.964826899 0.4824134
[104,] 0.488651586 0.977303171 0.5113484
[105,] 0.620336749 0.759326502 0.3796633
[106,] 0.570353683 0.859292633 0.4296463
[107,] 0.545781278 0.908437443 0.4542187
[108,] 0.529415614 0.941168771 0.4705844
[109,] 0.512449668 0.975100664 0.4875503
[110,] 0.572549390 0.854901221 0.4274506
[111,] 0.564685037 0.870629925 0.4353150
[112,] 0.522849188 0.954301623 0.4771508
[113,] 0.465063025 0.930126049 0.5349370
[114,] 0.513536584 0.972926831 0.4864634
[115,] 0.509994750 0.980010500 0.4900053
[116,] 0.486809003 0.973618005 0.5131910
[117,] 0.438353004 0.876706009 0.5616470
[118,] 0.488772538 0.977545076 0.5112275
[119,] 0.456280665 0.912561330 0.5437193
[120,] 0.412379974 0.824759947 0.5876200
[121,] 0.380576877 0.761153754 0.6194231
[122,] 0.447283654 0.894567308 0.5527163
[123,] 0.385074956 0.770149912 0.6149250
[124,] 0.324817360 0.649634720 0.6751826
[125,] 0.296360066 0.592720132 0.7036399
[126,] 0.240635594 0.481271189 0.7593644
[127,] 0.193995744 0.387991488 0.8060043
[128,] 0.294244310 0.588488620 0.7057557
[129,] 0.291118719 0.582237438 0.7088813
[130,] 0.265104972 0.530209945 0.7348950
[131,] 0.217103749 0.434207497 0.7828963
[132,] 0.164034117 0.328068234 0.8359659
[133,] 0.158622409 0.317244818 0.8413776
[134,] 0.134328126 0.268656252 0.8656719
[135,] 0.100297039 0.200594078 0.8997030
[136,] 0.065500638 0.131001277 0.9344994
[137,] 0.050081565 0.100163129 0.9499184
[138,] 0.291558152 0.583116304 0.7084418
[139,] 0.423915611 0.847831221 0.5760844
> postscript(file="/var/www/html/rcomp/tmp/1bphk1291285428.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/rcomp/tmp/23gg51291285428.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/rcomp/tmp/33gg51291285428.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/rcomp/tmp/43gg51291285428.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/rcomp/tmp/5wpx81291285428.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
3.10616142 1.70333577 -1.15613526 -2.19440691 -1.28691477 1.74064592
7 8 9 10 11 12
-1.04109978 0.87955102 -0.79185055 -4.09496009 -7.14689806 0.11005355
13 14 15 16 17 18
-1.54170898 3.87903150 3.71259171 1.04769126 1.01761013 -1.11688116
19 20 21 22 23 24
0.12664140 -5.15822468 -1.07299129 -0.07121082 -2.64849207 1.40316874
25 26 27 28 29 30
-0.03849319 -2.40798348 -0.86738667 -1.19850096 -2.04364153 1.82941659
31 32 33 34 35 36
-0.25986777 -1.76037075 -1.15565881 -2.92787759 2.45824233 -2.49292336
37 38 39 40 41 42
1.12758860 -2.47432268 -0.66510367 -0.24425987 -0.02615060 -1.60609464
43 44 45 46 47 48
3.10442587 -0.52336350 -0.14053398 -1.65071883 0.98818839 4.90503991
49 50 51 52 53 54
0.41899885 1.09481255 0.75268093 -1.18091410 1.93097514 0.04622796
55 56 57 58 59 60
1.67947075 0.73730291 -2.02928354 -1.45564614 -0.53143337 2.67271694
61 62 63 64 65 66
-1.34800308 4.08651857 7.52824859 2.44401374 -6.16284045 1.15180605
67 68 69 70 71 72
4.33794882 -3.43425479 1.13826935 -6.86823034 2.20184368 1.19174939
73 74 75 76 77 78
-1.87644323 2.55276901 0.21799024 3.18996625 2.54676298 1.51398663
79 80 81 82 83 84
-4.05492804 -3.72599053 -3.66068531 1.12156032 0.11687744 -1.53490409
85 86 87 88 89 90
-5.68095675 0.04433417 -3.27615889 -0.87648621 2.00491859 -2.08332318
91 92 93 94 95 96
-1.44730332 0.49794763 3.92090204 3.58778503 0.69013554 -2.49794794
97 98 99 100 101 102
-5.85354633 -2.60715430 2.03889832 -0.87063821 4.53405860 2.88895029
103 104 105 106 107 108
6.65876508 -5.27651362 -8.08578411 -2.69969591 0.67998927 2.09225941
109 110 111 112 113 114
-1.20773848 -1.05896779 -0.46606361 2.28891904 -5.30925439 0.85821723
115 116 117 118 119 120
-1.20090247 1.92469577 2.71915751 -3.76647908 2.96083524 0.50645507
121 122 123 124 125 126
0.02982779 4.10261028 -2.94668744 2.63950022 2.26625546 -3.69549387
127 128 129 130 131 132
2.75026589 2.58159249 -2.20758592 -3.52174847 1.76829273 1.23044349
133 134 135 136 137 138
-1.68373222 1.13076074 2.26288468 -2.19903395 3.00069555 3.65199692
139 140 141 142 143 144
3.72390981 1.43707302 4.71495154 1.94643053 1.97277528 -0.22821432
145 146 147 148 149 150
-1.40352417 -8.19914642 -2.36847318 2.70512526 5.01675855 -0.88919210
151 152 153 154 155 156
0.50646941 4.35781580 -1.20269860 0.07114989 2.30834382 -0.40700561
> postscript(file="/var/www/html/rcomp/tmp/6wpx81291285428.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 3.10616142 NA
1 1.70333577 3.10616142
2 -1.15613526 1.70333577
3 -2.19440691 -1.15613526
4 -1.28691477 -2.19440691
5 1.74064592 -1.28691477
6 -1.04109978 1.74064592
7 0.87955102 -1.04109978
8 -0.79185055 0.87955102
9 -4.09496009 -0.79185055
10 -7.14689806 -4.09496009
11 0.11005355 -7.14689806
12 -1.54170898 0.11005355
13 3.87903150 -1.54170898
14 3.71259171 3.87903150
15 1.04769126 3.71259171
16 1.01761013 1.04769126
17 -1.11688116 1.01761013
18 0.12664140 -1.11688116
19 -5.15822468 0.12664140
20 -1.07299129 -5.15822468
21 -0.07121082 -1.07299129
22 -2.64849207 -0.07121082
23 1.40316874 -2.64849207
24 -0.03849319 1.40316874
25 -2.40798348 -0.03849319
26 -0.86738667 -2.40798348
27 -1.19850096 -0.86738667
28 -2.04364153 -1.19850096
29 1.82941659 -2.04364153
30 -0.25986777 1.82941659
31 -1.76037075 -0.25986777
32 -1.15565881 -1.76037075
33 -2.92787759 -1.15565881
34 2.45824233 -2.92787759
35 -2.49292336 2.45824233
36 1.12758860 -2.49292336
37 -2.47432268 1.12758860
38 -0.66510367 -2.47432268
39 -0.24425987 -0.66510367
40 -0.02615060 -0.24425987
41 -1.60609464 -0.02615060
42 3.10442587 -1.60609464
43 -0.52336350 3.10442587
44 -0.14053398 -0.52336350
45 -1.65071883 -0.14053398
46 0.98818839 -1.65071883
47 4.90503991 0.98818839
48 0.41899885 4.90503991
49 1.09481255 0.41899885
50 0.75268093 1.09481255
51 -1.18091410 0.75268093
52 1.93097514 -1.18091410
53 0.04622796 1.93097514
54 1.67947075 0.04622796
55 0.73730291 1.67947075
56 -2.02928354 0.73730291
57 -1.45564614 -2.02928354
58 -0.53143337 -1.45564614
59 2.67271694 -0.53143337
60 -1.34800308 2.67271694
61 4.08651857 -1.34800308
62 7.52824859 4.08651857
63 2.44401374 7.52824859
64 -6.16284045 2.44401374
65 1.15180605 -6.16284045
66 4.33794882 1.15180605
67 -3.43425479 4.33794882
68 1.13826935 -3.43425479
69 -6.86823034 1.13826935
70 2.20184368 -6.86823034
71 1.19174939 2.20184368
72 -1.87644323 1.19174939
73 2.55276901 -1.87644323
74 0.21799024 2.55276901
75 3.18996625 0.21799024
76 2.54676298 3.18996625
77 1.51398663 2.54676298
78 -4.05492804 1.51398663
79 -3.72599053 -4.05492804
80 -3.66068531 -3.72599053
81 1.12156032 -3.66068531
82 0.11687744 1.12156032
83 -1.53490409 0.11687744
84 -5.68095675 -1.53490409
85 0.04433417 -5.68095675
86 -3.27615889 0.04433417
87 -0.87648621 -3.27615889
88 2.00491859 -0.87648621
89 -2.08332318 2.00491859
90 -1.44730332 -2.08332318
91 0.49794763 -1.44730332
92 3.92090204 0.49794763
93 3.58778503 3.92090204
94 0.69013554 3.58778503
95 -2.49794794 0.69013554
96 -5.85354633 -2.49794794
97 -2.60715430 -5.85354633
98 2.03889832 -2.60715430
99 -0.87063821 2.03889832
100 4.53405860 -0.87063821
101 2.88895029 4.53405860
102 6.65876508 2.88895029
103 -5.27651362 6.65876508
104 -8.08578411 -5.27651362
105 -2.69969591 -8.08578411
106 0.67998927 -2.69969591
107 2.09225941 0.67998927
108 -1.20773848 2.09225941
109 -1.05896779 -1.20773848
110 -0.46606361 -1.05896779
111 2.28891904 -0.46606361
112 -5.30925439 2.28891904
113 0.85821723 -5.30925439
114 -1.20090247 0.85821723
115 1.92469577 -1.20090247
116 2.71915751 1.92469577
117 -3.76647908 2.71915751
118 2.96083524 -3.76647908
119 0.50645507 2.96083524
120 0.02982779 0.50645507
121 4.10261028 0.02982779
122 -2.94668744 4.10261028
123 2.63950022 -2.94668744
124 2.26625546 2.63950022
125 -3.69549387 2.26625546
126 2.75026589 -3.69549387
127 2.58159249 2.75026589
128 -2.20758592 2.58159249
129 -3.52174847 -2.20758592
130 1.76829273 -3.52174847
131 1.23044349 1.76829273
132 -1.68373222 1.23044349
133 1.13076074 -1.68373222
134 2.26288468 1.13076074
135 -2.19903395 2.26288468
136 3.00069555 -2.19903395
137 3.65199692 3.00069555
138 3.72390981 3.65199692
139 1.43707302 3.72390981
140 4.71495154 1.43707302
141 1.94643053 4.71495154
142 1.97277528 1.94643053
143 -0.22821432 1.97277528
144 -1.40352417 -0.22821432
145 -8.19914642 -1.40352417
146 -2.36847318 -8.19914642
147 2.70512526 -2.36847318
148 5.01675855 2.70512526
149 -0.88919210 5.01675855
150 0.50646941 -0.88919210
151 4.35781580 0.50646941
152 -1.20269860 4.35781580
153 0.07114989 -1.20269860
154 2.30834382 0.07114989
155 -0.40700561 2.30834382
156 NA -0.40700561
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.70333577 3.10616142
[2,] -1.15613526 1.70333577
[3,] -2.19440691 -1.15613526
[4,] -1.28691477 -2.19440691
[5,] 1.74064592 -1.28691477
[6,] -1.04109978 1.74064592
[7,] 0.87955102 -1.04109978
[8,] -0.79185055 0.87955102
[9,] -4.09496009 -0.79185055
[10,] -7.14689806 -4.09496009
[11,] 0.11005355 -7.14689806
[12,] -1.54170898 0.11005355
[13,] 3.87903150 -1.54170898
[14,] 3.71259171 3.87903150
[15,] 1.04769126 3.71259171
[16,] 1.01761013 1.04769126
[17,] -1.11688116 1.01761013
[18,] 0.12664140 -1.11688116
[19,] -5.15822468 0.12664140
[20,] -1.07299129 -5.15822468
[21,] -0.07121082 -1.07299129
[22,] -2.64849207 -0.07121082
[23,] 1.40316874 -2.64849207
[24,] -0.03849319 1.40316874
[25,] -2.40798348 -0.03849319
[26,] -0.86738667 -2.40798348
[27,] -1.19850096 -0.86738667
[28,] -2.04364153 -1.19850096
[29,] 1.82941659 -2.04364153
[30,] -0.25986777 1.82941659
[31,] -1.76037075 -0.25986777
[32,] -1.15565881 -1.76037075
[33,] -2.92787759 -1.15565881
[34,] 2.45824233 -2.92787759
[35,] -2.49292336 2.45824233
[36,] 1.12758860 -2.49292336
[37,] -2.47432268 1.12758860
[38,] -0.66510367 -2.47432268
[39,] -0.24425987 -0.66510367
[40,] -0.02615060 -0.24425987
[41,] -1.60609464 -0.02615060
[42,] 3.10442587 -1.60609464
[43,] -0.52336350 3.10442587
[44,] -0.14053398 -0.52336350
[45,] -1.65071883 -0.14053398
[46,] 0.98818839 -1.65071883
[47,] 4.90503991 0.98818839
[48,] 0.41899885 4.90503991
[49,] 1.09481255 0.41899885
[50,] 0.75268093 1.09481255
[51,] -1.18091410 0.75268093
[52,] 1.93097514 -1.18091410
[53,] 0.04622796 1.93097514
[54,] 1.67947075 0.04622796
[55,] 0.73730291 1.67947075
[56,] -2.02928354 0.73730291
[57,] -1.45564614 -2.02928354
[58,] -0.53143337 -1.45564614
[59,] 2.67271694 -0.53143337
[60,] -1.34800308 2.67271694
[61,] 4.08651857 -1.34800308
[62,] 7.52824859 4.08651857
[63,] 2.44401374 7.52824859
[64,] -6.16284045 2.44401374
[65,] 1.15180605 -6.16284045
[66,] 4.33794882 1.15180605
[67,] -3.43425479 4.33794882
[68,] 1.13826935 -3.43425479
[69,] -6.86823034 1.13826935
[70,] 2.20184368 -6.86823034
[71,] 1.19174939 2.20184368
[72,] -1.87644323 1.19174939
[73,] 2.55276901 -1.87644323
[74,] 0.21799024 2.55276901
[75,] 3.18996625 0.21799024
[76,] 2.54676298 3.18996625
[77,] 1.51398663 2.54676298
[78,] -4.05492804 1.51398663
[79,] -3.72599053 -4.05492804
[80,] -3.66068531 -3.72599053
[81,] 1.12156032 -3.66068531
[82,] 0.11687744 1.12156032
[83,] -1.53490409 0.11687744
[84,] -5.68095675 -1.53490409
[85,] 0.04433417 -5.68095675
[86,] -3.27615889 0.04433417
[87,] -0.87648621 -3.27615889
[88,] 2.00491859 -0.87648621
[89,] -2.08332318 2.00491859
[90,] -1.44730332 -2.08332318
[91,] 0.49794763 -1.44730332
[92,] 3.92090204 0.49794763
[93,] 3.58778503 3.92090204
[94,] 0.69013554 3.58778503
[95,] -2.49794794 0.69013554
[96,] -5.85354633 -2.49794794
[97,] -2.60715430 -5.85354633
[98,] 2.03889832 -2.60715430
[99,] -0.87063821 2.03889832
[100,] 4.53405860 -0.87063821
[101,] 2.88895029 4.53405860
[102,] 6.65876508 2.88895029
[103,] -5.27651362 6.65876508
[104,] -8.08578411 -5.27651362
[105,] -2.69969591 -8.08578411
[106,] 0.67998927 -2.69969591
[107,] 2.09225941 0.67998927
[108,] -1.20773848 2.09225941
[109,] -1.05896779 -1.20773848
[110,] -0.46606361 -1.05896779
[111,] 2.28891904 -0.46606361
[112,] -5.30925439 2.28891904
[113,] 0.85821723 -5.30925439
[114,] -1.20090247 0.85821723
[115,] 1.92469577 -1.20090247
[116,] 2.71915751 1.92469577
[117,] -3.76647908 2.71915751
[118,] 2.96083524 -3.76647908
[119,] 0.50645507 2.96083524
[120,] 0.02982779 0.50645507
[121,] 4.10261028 0.02982779
[122,] -2.94668744 4.10261028
[123,] 2.63950022 -2.94668744
[124,] 2.26625546 2.63950022
[125,] -3.69549387 2.26625546
[126,] 2.75026589 -3.69549387
[127,] 2.58159249 2.75026589
[128,] -2.20758592 2.58159249
[129,] -3.52174847 -2.20758592
[130,] 1.76829273 -3.52174847
[131,] 1.23044349 1.76829273
[132,] -1.68373222 1.23044349
[133,] 1.13076074 -1.68373222
[134,] 2.26288468 1.13076074
[135,] -2.19903395 2.26288468
[136,] 3.00069555 -2.19903395
[137,] 3.65199692 3.00069555
[138,] 3.72390981 3.65199692
[139,] 1.43707302 3.72390981
[140,] 4.71495154 1.43707302
[141,] 1.94643053 4.71495154
[142,] 1.97277528 1.94643053
[143,] -0.22821432 1.97277528
[144,] -1.40352417 -0.22821432
[145,] -8.19914642 -1.40352417
[146,] -2.36847318 -8.19914642
[147,] 2.70512526 -2.36847318
[148,] 5.01675855 2.70512526
[149,] -0.88919210 5.01675855
[150,] 0.50646941 -0.88919210
[151,] 4.35781580 0.50646941
[152,] -1.20269860 4.35781580
[153,] 0.07114989 -1.20269860
[154,] 2.30834382 0.07114989
[155,] -0.40700561 2.30834382
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.70333577 3.10616142
2 -1.15613526 1.70333577
3 -2.19440691 -1.15613526
4 -1.28691477 -2.19440691
5 1.74064592 -1.28691477
6 -1.04109978 1.74064592
7 0.87955102 -1.04109978
8 -0.79185055 0.87955102
9 -4.09496009 -0.79185055
10 -7.14689806 -4.09496009
11 0.11005355 -7.14689806
12 -1.54170898 0.11005355
13 3.87903150 -1.54170898
14 3.71259171 3.87903150
15 1.04769126 3.71259171
16 1.01761013 1.04769126
17 -1.11688116 1.01761013
18 0.12664140 -1.11688116
19 -5.15822468 0.12664140
20 -1.07299129 -5.15822468
21 -0.07121082 -1.07299129
22 -2.64849207 -0.07121082
23 1.40316874 -2.64849207
24 -0.03849319 1.40316874
25 -2.40798348 -0.03849319
26 -0.86738667 -2.40798348
27 -1.19850096 -0.86738667
28 -2.04364153 -1.19850096
29 1.82941659 -2.04364153
30 -0.25986777 1.82941659
31 -1.76037075 -0.25986777
32 -1.15565881 -1.76037075
33 -2.92787759 -1.15565881
34 2.45824233 -2.92787759
35 -2.49292336 2.45824233
36 1.12758860 -2.49292336
37 -2.47432268 1.12758860
38 -0.66510367 -2.47432268
39 -0.24425987 -0.66510367
40 -0.02615060 -0.24425987
41 -1.60609464 -0.02615060
42 3.10442587 -1.60609464
43 -0.52336350 3.10442587
44 -0.14053398 -0.52336350
45 -1.65071883 -0.14053398
46 0.98818839 -1.65071883
47 4.90503991 0.98818839
48 0.41899885 4.90503991
49 1.09481255 0.41899885
50 0.75268093 1.09481255
51 -1.18091410 0.75268093
52 1.93097514 -1.18091410
53 0.04622796 1.93097514
54 1.67947075 0.04622796
55 0.73730291 1.67947075
56 -2.02928354 0.73730291
57 -1.45564614 -2.02928354
58 -0.53143337 -1.45564614
59 2.67271694 -0.53143337
60 -1.34800308 2.67271694
61 4.08651857 -1.34800308
62 7.52824859 4.08651857
63 2.44401374 7.52824859
64 -6.16284045 2.44401374
65 1.15180605 -6.16284045
66 4.33794882 1.15180605
67 -3.43425479 4.33794882
68 1.13826935 -3.43425479
69 -6.86823034 1.13826935
70 2.20184368 -6.86823034
71 1.19174939 2.20184368
72 -1.87644323 1.19174939
73 2.55276901 -1.87644323
74 0.21799024 2.55276901
75 3.18996625 0.21799024
76 2.54676298 3.18996625
77 1.51398663 2.54676298
78 -4.05492804 1.51398663
79 -3.72599053 -4.05492804
80 -3.66068531 -3.72599053
81 1.12156032 -3.66068531
82 0.11687744 1.12156032
83 -1.53490409 0.11687744
84 -5.68095675 -1.53490409
85 0.04433417 -5.68095675
86 -3.27615889 0.04433417
87 -0.87648621 -3.27615889
88 2.00491859 -0.87648621
89 -2.08332318 2.00491859
90 -1.44730332 -2.08332318
91 0.49794763 -1.44730332
92 3.92090204 0.49794763
93 3.58778503 3.92090204
94 0.69013554 3.58778503
95 -2.49794794 0.69013554
96 -5.85354633 -2.49794794
97 -2.60715430 -5.85354633
98 2.03889832 -2.60715430
99 -0.87063821 2.03889832
100 4.53405860 -0.87063821
101 2.88895029 4.53405860
102 6.65876508 2.88895029
103 -5.27651362 6.65876508
104 -8.08578411 -5.27651362
105 -2.69969591 -8.08578411
106 0.67998927 -2.69969591
107 2.09225941 0.67998927
108 -1.20773848 2.09225941
109 -1.05896779 -1.20773848
110 -0.46606361 -1.05896779
111 2.28891904 -0.46606361
112 -5.30925439 2.28891904
113 0.85821723 -5.30925439
114 -1.20090247 0.85821723
115 1.92469577 -1.20090247
116 2.71915751 1.92469577
117 -3.76647908 2.71915751
118 2.96083524 -3.76647908
119 0.50645507 2.96083524
120 0.02982779 0.50645507
121 4.10261028 0.02982779
122 -2.94668744 4.10261028
123 2.63950022 -2.94668744
124 2.26625546 2.63950022
125 -3.69549387 2.26625546
126 2.75026589 -3.69549387
127 2.58159249 2.75026589
128 -2.20758592 2.58159249
129 -3.52174847 -2.20758592
130 1.76829273 -3.52174847
131 1.23044349 1.76829273
132 -1.68373222 1.23044349
133 1.13076074 -1.68373222
134 2.26288468 1.13076074
135 -2.19903395 2.26288468
136 3.00069555 -2.19903395
137 3.65199692 3.00069555
138 3.72390981 3.65199692
139 1.43707302 3.72390981
140 4.71495154 1.43707302
141 1.94643053 4.71495154
142 1.97277528 1.94643053
143 -0.22821432 1.97277528
144 -1.40352417 -0.22821432
145 -8.19914642 -1.40352417
146 -2.36847318 -8.19914642
147 2.70512526 -2.36847318
148 5.01675855 2.70512526
149 -0.88919210 5.01675855
150 0.50646941 -0.88919210
151 4.35781580 0.50646941
152 -1.20269860 4.35781580
153 0.07114989 -1.20269860
154 2.30834382 0.07114989
155 -0.40700561 2.30834382
> 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/rcomp/tmp/76yxb1291285428.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/rcomp/tmp/86yxb1291285428.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/rcomp/tmp/9z7ew1291285428.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/rcomp/tmp/10z7ew1291285428.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/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/rcomp/tmp/11d0fx1291285429.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/rcomp/tmp/12y1e31291285429.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/rcomp/tmp/135ktw1291285429.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/rcomp/tmp/14gbah1291285429.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/rcomp/tmp/15jb9n1291285429.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/rcomp/tmp/16xl6e1291285429.tab")
+ }
>
> try(system("convert tmp/1bphk1291285428.ps tmp/1bphk1291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/23gg51291285428.ps tmp/23gg51291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/33gg51291285428.ps tmp/33gg51291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/43gg51291285428.ps tmp/43gg51291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/5wpx81291285428.ps tmp/5wpx81291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/6wpx81291285428.ps tmp/6wpx81291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/76yxb1291285428.ps tmp/76yxb1291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/86yxb1291285428.ps tmp/86yxb1291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/9z7ew1291285428.ps tmp/9z7ew1291285428.png",intern=TRUE))
character(0)
> try(system("convert tmp/10z7ew1291285428.ps tmp/10z7ew1291285428.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.938 1.706 10.753