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(14
+ ,3
+ ,2
+ ,3
+ ,3
+ ,7
+ ,8
+ ,5
+ ,6
+ ,0
+ ,7
+ ,2
+ ,12
+ ,6
+ ,6
+ ,0
+ ,6
+ ,3
+ ,7
+ ,6
+ ,6
+ ,6
+ ,6
+ ,8
+ ,10
+ ,7
+ ,8
+ ,5
+ ,5
+ ,7
+ ,9
+ ,3
+ ,1
+ ,0
+ ,7
+ ,7
+ ,16
+ ,8
+ ,9
+ ,8
+ ,8
+ ,9
+ ,7
+ ,4
+ ,4
+ ,0
+ ,2
+ ,2
+ ,14
+ ,7
+ ,7
+ ,0
+ ,4
+ ,4
+ ,6
+ ,4
+ ,4
+ ,9
+ ,9
+ ,4
+ ,16
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,11
+ ,6
+ ,5
+ ,6
+ ,6
+ ,4
+ ,17
+ ,7
+ ,7
+ ,5
+ ,5
+ ,9
+ ,12
+ ,4
+ ,5
+ ,4
+ ,4
+ ,8
+ ,7
+ ,6
+ ,6
+ ,0
+ ,2
+ ,7
+ ,13
+ ,5
+ ,5
+ ,0
+ ,4
+ ,4
+ ,9
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,15
+ ,9
+ ,9
+ ,6
+ ,6
+ ,8
+ ,7
+ ,4
+ ,4
+ ,0
+ ,4
+ ,4
+ ,9
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,7
+ ,2
+ ,5
+ ,5
+ ,5
+ ,2
+ ,14
+ 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dummies'
> par1 = '1'
> 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
Schoolprestaties Sport Goingout Relation Family Coach t
1 14 3 2 3 3 7 1
2 8 5 6 0 7 2 2
3 12 6 6 0 6 3 3
4 7 6 6 6 6 8 4
5 10 7 8 5 5 7 5
6 9 3 1 0 7 7 6
7 16 8 9 8 8 9 7
8 7 4 4 0 2 2 8
9 14 7 7 0 4 4 9
10 6 4 4 9 9 4 10
11 16 6 6 6 6 6 11
12 11 6 5 6 6 4 12
13 17 7 7 5 5 9 13
14 12 4 5 4 4 8 14
15 7 6 6 0 2 7 15
16 13 5 5 0 4 4 16
17 9 0 2 2 2 2 17
18 15 9 9 6 6 8 18
19 7 4 4 0 4 4 19
20 9 4 4 4 4 4 20
21 7 2 5 5 5 2 21
22 14 7 7 7 7 9 22
23 15 5 5 5 5 3 23
24 7 9 9 4 4 4 24
25 13 6 6 6 6 6 25
26 17 6 6 6 6 6 26
27 15 7 3 0 7 7 27
28 14 3 3 1 2 2 28
29 14 6 5 0 6 6 29
30 8 6 5 4 4 4 30
31 8 4 4 4 4 2 31
32 12 7 7 7 7 9 32
33 14 7 6 7 7 7 33
34 8 7 7 0 4 4 34
35 11 4 4 4 4 4 35
36 16 5 5 5 5 7 36
37 11 6 6 0 6 6 37
38 8 5 5 5 5 5 38
39 14 6 0 1 6 6 39
40 16 6 6 2 2 2 40
41 14 6 5 0 6 2 41
42 5 3 3 9 9 7 42
43 8 3 3 3 3 3 43
44 10 3 3 0 4 4 44
45 8 6 7 6 6 6 45
46 13 7 7 1 5 5 46
47 15 5 1 5 5 7 47
48 6 5 5 0 4 4 48
49 12 5 5 0 2 2 49
50 14 6 6 0 6 6 50
51 5 6 2 6 6 9 51
52 15 6 6 7 7 8 52
53 11 5 5 0 5 5 53
54 8 4 2 4 4 4 54
55 13 7 7 5 5 2 55
56 14 5 5 1 5 9 56
57 12 3 3 4 4 4 57
58 16 6 6 9 9 6 58
59 10 2 2 2 2 2 59
60 15 8 8 8 8 8 60
61 8 3 5 3 3 3 61
62 16 0 2 1 6 3 62
63 19 6 6 0 6 7 63
64 14 8 2 6 6 2 64
65 7 4 1 0 5 9 65
66 13 5 5 0 5 5 66
67 15 6 6 6 6 4 67
68 7 5 2 2 2 2 68
69 13 6 6 1 6 6 69
70 4 2 2 5 5 5 70
71 14 6 6 5 5 5 71
72 13 5 5 5 5 9 72
73 11 5 0 5 5 2 73
74 14 6 2 6 6 6 74
75 12 4 4 6 6 6 75
76 15 6 1 0 9 6 76
77 14 5 5 0 5 5 77
78 13 5 5 1 5 3 78
79 7 4 2 7 7 2 79
80 5 2 2 2 2 2 80
81 7 7 7 4 4 4 81
82 13 5 5 0 6 8 82
83 13 6 2 5 5 5 83
84 11 5 5 5 5 9 84
85 6 3 3 3 3 2 85
86 12 6 6 0 6 6 86
87 8 4 1 4 4 4 87
88 11 5 5 9 9 5 88
89 12 7 7 0 8 8 89
90 9 4 2 4 4 3 90
91 12 6 6 2 2 2 91
92 13 8 8 7 7 7 92
93 16 7 7 7 7 7 93
94 16 6 6 6 6 9 94
95 11 7 7 0 5 5 95
96 8 4 4 5 5 5 96
97 4 0 5 6 6 2 97
98 7 3 2 0 3 3 98
99 14 5 5 5 5 5 99
100 11 6 2 9 9 2 100
101 17 5 5 0 7 7 101
102 15 7 7 7 7 7 102
103 14 6 5 1 6 6 103
104 5 8 8 3 3 3 104
105 4 7 2 7 7 3 105
106 19 8 8 8 8 2 106
107 11 3 3 0 3 3 107
108 15 8 2 5 5 5 108
109 10 3 3 3 3 3 109
110 9 4 5 0 4 4 110
111 12 2 2 5 5 5 111
112 15 7 2 7 7 7 112
113 7 6 6 0 6 6 113
114 13 2 2 0 7 7 114
115 14 7 7 0 9 2 115
116 14 6 6 6 6 6 116
117 14 6 2 0 6 9 117
118 8 6 2 6 6 4 118
119 15 6 5 6 6 6 119
120 15 6 6 2 2 2 120
121 9 4 4 5 5 2 121
122 16 5 5 0 5 5 122
123 9 7 7 4 4 4 123
124 15 6 6 0 7 7 124
125 15 6 6 6 6 6 125
126 6 5 5 5 5 7 126
127 8 8 2 8 8 8 127
128 15 6 6 6 6 6 128
129 10 0 3 5 5 3 129
130 9 4 2 0 4 4 130
131 14 8 8 8 8 8 131
132 12 6 6 0 6 9 132
133 8 4 4 9 9 2 133
134 11 6 6 5 5 5 134
135 13 2 5 0 6 6 135
136 9 4 4 0 4 4 136
137 15 6 2 0 6 6 137
138 13 3 3 3 3 3 138
139 15 6 6 6 6 6 139
140 14 5 5 0 5 5 140
141 16 4 4 4 4 8 141
142 12 6 6 6 6 6 142
143 14 1 1 0 5 5 143
144 10 4 5 4 4 3 144
145 10 4 2 7 7 2 145
146 4 6 6 0 6 6 146
147 8 5 5 5 5 5 147
148 17 9 2 6 6 6 148
149 16 6 6 6 6 6 149
150 12 8 8 8 8 9 150
151 12 7 7 2 2 4 151
152 15 7 7 7 7 7 152
153 9 0 9 0 4 4 153
154 13 6 2 0 6 7 154
155 14 6 6 5 5 5 155
156 11 5 5 0 2 2 156
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Sport Goingout Relation Family Coach
5.944512 0.431702 0.096186 -0.134927 0.260355 0.312539
t
0.005587
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.3649 -2.1367 0.5614 2.0830 7.1519
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.944512 1.099974 5.404 2.53e-07 ***
Sport 0.431702 0.171964 2.510 0.0131 *
Goingout 0.096186 0.142764 0.674 0.5015
Relation -0.134927 0.099817 -1.352 0.1785
Family 0.260355 0.185270 1.405 0.1620
Coach 0.312539 0.136615 2.288 0.0236 *
t 0.005587 0.005743 0.973 0.3322
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.207 on 149 degrees of freedom
Multiple R-squared: 0.1897, Adjusted R-squared: 0.1571
F-statistic: 5.815 on 6 and 149 DF, p-value: 1.813e-05
> 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.8719442 0.2561115 0.12805577
[2,] 0.9039689 0.1920623 0.09603114
[3,] 0.8468079 0.3063842 0.15319209
[4,] 0.7787362 0.4425276 0.22126378
[5,] 0.6857938 0.6284125 0.31420624
[6,] 0.8774082 0.2451836 0.12259181
[7,] 0.8585268 0.2829464 0.14147322
[8,] 0.8339695 0.3320609 0.16603046
[9,] 0.7731394 0.4537213 0.22686065
[10,] 0.7647241 0.4705518 0.23527590
[11,] 0.7018476 0.5963048 0.29815240
[12,] 0.6330874 0.7338251 0.36691257
[13,] 0.5582165 0.8835669 0.44178345
[14,] 0.6107153 0.7785694 0.38928468
[15,] 0.7539765 0.4920470 0.24602352
[16,] 0.7006950 0.5986101 0.29930505
[17,] 0.7499470 0.5001059 0.25005297
[18,] 0.6951286 0.6097427 0.30487137
[19,] 0.7262449 0.5475102 0.27375508
[20,] 0.6711115 0.6577769 0.32888847
[21,] 0.7094392 0.5811217 0.29056085
[22,] 0.6756546 0.6486909 0.32434545
[23,] 0.6533805 0.6932391 0.34661954
[24,] 0.5964711 0.8070579 0.40352893
[25,] 0.6135991 0.7728017 0.38640087
[26,] 0.5557927 0.8884146 0.44420732
[27,] 0.5601280 0.8797440 0.43987200
[28,] 0.5145182 0.9709637 0.48548184
[29,] 0.5284061 0.9431878 0.47159388
[30,] 0.4755383 0.9510766 0.52446170
[31,] 0.5783235 0.8433530 0.42167652
[32,] 0.5642498 0.8715003 0.43575017
[33,] 0.6941632 0.6116736 0.30583679
[34,] 0.6611258 0.6777483 0.33887416
[35,] 0.6100859 0.7798281 0.38991406
[36,] 0.6224343 0.7551315 0.37756573
[37,] 0.5739238 0.8521524 0.42607619
[38,] 0.5498209 0.9003582 0.45017908
[39,] 0.6130709 0.7738583 0.38692914
[40,] 0.5758056 0.8483889 0.42419443
[41,] 0.5521301 0.8957399 0.44786994
[42,] 0.8000514 0.3998973 0.19994864
[43,] 0.7928581 0.4142837 0.20714186
[44,] 0.7565533 0.4868934 0.24344671
[45,] 0.7343179 0.5313642 0.26568208
[46,] 0.7034107 0.5931786 0.29658929
[47,] 0.6688742 0.6622517 0.33112584
[48,] 0.6459713 0.7080575 0.35402875
[49,] 0.6648529 0.6702941 0.33514705
[50,] 0.6280660 0.7438679 0.37193397
[51,] 0.5840542 0.8318917 0.41594585
[52,] 0.5475696 0.9048607 0.45243035
[53,] 0.7159859 0.5680282 0.28401410
[54,] 0.7811107 0.4377786 0.21888932
[55,] 0.7658619 0.4682762 0.23413810
[56,] 0.8295144 0.3409712 0.17048562
[57,] 0.8011961 0.3976077 0.19880387
[58,] 0.8006238 0.3987524 0.19937619
[59,] 0.7942051 0.4115897 0.20579486
[60,] 0.7600643 0.4798714 0.23993569
[61,] 0.8333111 0.3333779 0.16668894
[62,] 0.8165272 0.3669455 0.18347275
[63,] 0.7835219 0.4329562 0.21647809
[64,] 0.7529926 0.4940149 0.24700743
[65,] 0.7310264 0.5379473 0.26897363
[66,] 0.6932259 0.6135481 0.30677406
[67,] 0.6635957 0.6728086 0.33640428
[68,] 0.6418463 0.7163074 0.35815371
[69,] 0.6212339 0.7575321 0.37876605
[70,] 0.6139720 0.7720560 0.38602801
[71,] 0.6156303 0.7687395 0.38436974
[72,] 0.6688876 0.6622249 0.33111243
[73,] 0.6254603 0.7490793 0.37453966
[74,] 0.5929925 0.8140151 0.40700753
[75,] 0.5569943 0.8860114 0.44300572
[76,] 0.5465146 0.9069708 0.45348541
[77,] 0.5035846 0.9928309 0.49641543
[78,] 0.4737242 0.9474484 0.52627581
[79,] 0.4287519 0.8575039 0.57124806
[80,] 0.4096478 0.8192957 0.59035217
[81,] 0.3662070 0.7324139 0.63379303
[82,] 0.3339514 0.6679029 0.66604857
[83,] 0.2930308 0.5860615 0.70696924
[84,] 0.2811354 0.5622709 0.71886456
[85,] 0.2693209 0.5386418 0.73067912
[86,] 0.2413363 0.4826727 0.75866365
[87,] 0.2295208 0.4590416 0.77047918
[88,] 0.2651720 0.5303441 0.73482796
[89,] 0.2564589 0.5129178 0.74354110
[90,] 0.2393168 0.4786337 0.76068316
[91,] 0.2026606 0.4053212 0.79733940
[92,] 0.2200787 0.4401573 0.77992134
[93,] 0.1963110 0.3926219 0.80368905
[94,] 0.1709813 0.3419626 0.82901868
[95,] 0.2979585 0.5959170 0.70204149
[96,] 0.5343351 0.9313298 0.46566490
[97,] 0.7057841 0.5884317 0.29421586
[98,] 0.6624174 0.6751653 0.33758263
[99,] 0.6396991 0.7206019 0.36030094
[100,] 0.5925387 0.8149227 0.40746134
[101,] 0.5655426 0.8689149 0.43445743
[102,] 0.5231890 0.9536220 0.47681099
[103,] 0.4918590 0.9837180 0.50814101
[104,] 0.6143850 0.7712299 0.38561496
[105,] 0.5668966 0.8662068 0.43310342
[106,] 0.5571239 0.8857522 0.44287611
[107,] 0.5170689 0.9658622 0.48293108
[108,] 0.4603357 0.9206714 0.53966431
[109,] 0.4715546 0.9431093 0.52844535
[110,] 0.4509402 0.9018805 0.54905975
[111,] 0.4871722 0.9743443 0.51282784
[112,] 0.4310078 0.8620157 0.56899217
[113,] 0.5070308 0.9859384 0.49296920
[114,] 0.4669253 0.9338506 0.53307469
[115,] 0.5042332 0.9915336 0.49576678
[116,] 0.5364682 0.9270635 0.46353176
[117,] 0.7304761 0.5390479 0.26952393
[118,] 0.9117921 0.1764159 0.08820793
[119,] 0.9062295 0.1875409 0.09377046
[120,] 0.8809826 0.2380347 0.11901735
[121,] 0.8755123 0.2489755 0.12448774
[122,] 0.8462217 0.3075565 0.15377826
[123,] 0.8027163 0.3945674 0.19728372
[124,] 0.7492870 0.5014259 0.25071297
[125,] 0.6906547 0.6186907 0.30934534
[126,] 0.6605825 0.6788349 0.33941746
[127,] 0.6152685 0.7694630 0.38473148
[128,] 0.5952192 0.8095616 0.40478078
[129,] 0.5156080 0.9687840 0.48439199
[130,] 0.4920124 0.9840247 0.50798763
[131,] 0.8283364 0.3433272 0.17166359
[132,] 0.7841967 0.4316066 0.21580330
[133,] 0.7151132 0.5697736 0.28488680
[134,] 0.6801173 0.6397654 0.31988269
[135,] 0.5713282 0.8573436 0.42867180
[136,] 0.4267282 0.8534564 0.57327180
[137,] 0.3886525 0.7773051 0.61134745
> postscript(file="/var/wessaorg/rcomp/tmp/16b251321990957.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/23x241321990957.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/30b271321990957.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/4j7z51321990957.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/5nz0i1321990957.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.99836622 -3.13887671 0.37164960 -5.38706762 -2.57876358 -2.37958175
7 8 9 10 11 12
1.88081456 -2.24654916 2.01841021 -4.49093574 4.19890303 -0.08541927
13 14 15 16 17 18
3.84765068 0.76751033 -4.90412941 2.03508064 1.89220755 0.95105092
19 20 21 22 23 24
-3.45379076 -0.91966778 -1.65838515 0.54651552 4.72279490 -5.58145937
25 26 27 28 29 30
1.12068829 5.11510152 1.58391339 5.30453183 1.38496303 -2.93512683
31 32 33 34 35 36
-1.35604420 -1.50935216 1.20632554 -4.12125898 0.99653070 4.40001086
37 38 39 40 41 42
-1.75591754 -2.98608464 1.94495497 5.78875134 2.56807788 -6.07944045
43 44 45 46 47 48
-1.08230839 -0.06557105 -4.08723350 0.37373366 3.72330216 -5.14369592
49 50 51 52 53 54
1.99650447 1.17145448 -7.57743897 2.21934041 -0.74452334 -1.91724501
55 56 57 58 59 60
1.80077954 1.12348773 2.40151072 3.56004357 1.79415837 0.99344133
61 62 63 64 65 66
-1.37524308 7.15191830 5.78628749 2.67430121 -5.24527240 1.18284868
67 68 69 70 71 72
3.51112208 -2.55122994 0.20023333 -5.58119450 2.30166312 0.57380920
73 74 75 76 77 78
1.23692771 2.23168242 0.89712771 1.72606700 2.12139424 1.87581293
79 80 81 82 83 84
-2.80811755 -3.32316375 -4.84412732 -0.10451121 1.61936765 -1.49323201
85 86 87 88 89 90
-3.00441362 -1.02966915 -2.00542191 -0.76713154 -2.72010552 -0.80582963
91 92 93 94 95 96
1.50382620 -0.74736909 2.77493305 2.79758428 -2.03494539 -2.78222826
97 98 99 100 101 102
-4.34500168 -2.69817648 2.67312253 -0.03969887 3.84152466 1.72465214
103 104 105 106 107 108
1.10646967 -7.06254573 -7.56101993 6.61168411 1.15535617 2.61629352
109 110 111 112 113 114
0.54896495 -2.05837305 2.18974803 2.14971664 -6.18051188 1.35256339
115 116 117 118 119 120
0.74951805 1.61229244 0.24426975 -3.38905733 2.69171857 4.34180994
121 122 123 124 125 126
-0.98428041 3.86998969 -3.07877155 1.18514010 2.56201153 -6.10279822
127 128 129 130 131 132
-5.80375349 2.54525123 1.48148274 -1.88154909 -0.40321917 -2.22427751
133 134 135 136 137 138
-2.55303013 -1.05030324 1.51957554 -2.10744257 2.07015144 3.38694869
139 140 141 142 143 144
2.48379678 1.76942788 4.15417728 -0.53296352 3.86422319 -0.39607438
145 146 147 148 149 150
-0.17684422 -9.36487521 -3.59504231 3.52315421 3.42792911 -2.82190677
151 152 153 154 155 156
0.01565321 1.44531376 -0.95653992 -0.33736263 1.83237464 0.39872033
> postscript(file="/var/wessaorg/rcomp/tmp/6v8b91321990957.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.99836622 NA
1 -3.13887671 3.99836622
2 0.37164960 -3.13887671
3 -5.38706762 0.37164960
4 -2.57876358 -5.38706762
5 -2.37958175 -2.57876358
6 1.88081456 -2.37958175
7 -2.24654916 1.88081456
8 2.01841021 -2.24654916
9 -4.49093574 2.01841021
10 4.19890303 -4.49093574
11 -0.08541927 4.19890303
12 3.84765068 -0.08541927
13 0.76751033 3.84765068
14 -4.90412941 0.76751033
15 2.03508064 -4.90412941
16 1.89220755 2.03508064
17 0.95105092 1.89220755
18 -3.45379076 0.95105092
19 -0.91966778 -3.45379076
20 -1.65838515 -0.91966778
21 0.54651552 -1.65838515
22 4.72279490 0.54651552
23 -5.58145937 4.72279490
24 1.12068829 -5.58145937
25 5.11510152 1.12068829
26 1.58391339 5.11510152
27 5.30453183 1.58391339
28 1.38496303 5.30453183
29 -2.93512683 1.38496303
30 -1.35604420 -2.93512683
31 -1.50935216 -1.35604420
32 1.20632554 -1.50935216
33 -4.12125898 1.20632554
34 0.99653070 -4.12125898
35 4.40001086 0.99653070
36 -1.75591754 4.40001086
37 -2.98608464 -1.75591754
38 1.94495497 -2.98608464
39 5.78875134 1.94495497
40 2.56807788 5.78875134
41 -6.07944045 2.56807788
42 -1.08230839 -6.07944045
43 -0.06557105 -1.08230839
44 -4.08723350 -0.06557105
45 0.37373366 -4.08723350
46 3.72330216 0.37373366
47 -5.14369592 3.72330216
48 1.99650447 -5.14369592
49 1.17145448 1.99650447
50 -7.57743897 1.17145448
51 2.21934041 -7.57743897
52 -0.74452334 2.21934041
53 -1.91724501 -0.74452334
54 1.80077954 -1.91724501
55 1.12348773 1.80077954
56 2.40151072 1.12348773
57 3.56004357 2.40151072
58 1.79415837 3.56004357
59 0.99344133 1.79415837
60 -1.37524308 0.99344133
61 7.15191830 -1.37524308
62 5.78628749 7.15191830
63 2.67430121 5.78628749
64 -5.24527240 2.67430121
65 1.18284868 -5.24527240
66 3.51112208 1.18284868
67 -2.55122994 3.51112208
68 0.20023333 -2.55122994
69 -5.58119450 0.20023333
70 2.30166312 -5.58119450
71 0.57380920 2.30166312
72 1.23692771 0.57380920
73 2.23168242 1.23692771
74 0.89712771 2.23168242
75 1.72606700 0.89712771
76 2.12139424 1.72606700
77 1.87581293 2.12139424
78 -2.80811755 1.87581293
79 -3.32316375 -2.80811755
80 -4.84412732 -3.32316375
81 -0.10451121 -4.84412732
82 1.61936765 -0.10451121
83 -1.49323201 1.61936765
84 -3.00441362 -1.49323201
85 -1.02966915 -3.00441362
86 -2.00542191 -1.02966915
87 -0.76713154 -2.00542191
88 -2.72010552 -0.76713154
89 -0.80582963 -2.72010552
90 1.50382620 -0.80582963
91 -0.74736909 1.50382620
92 2.77493305 -0.74736909
93 2.79758428 2.77493305
94 -2.03494539 2.79758428
95 -2.78222826 -2.03494539
96 -4.34500168 -2.78222826
97 -2.69817648 -4.34500168
98 2.67312253 -2.69817648
99 -0.03969887 2.67312253
100 3.84152466 -0.03969887
101 1.72465214 3.84152466
102 1.10646967 1.72465214
103 -7.06254573 1.10646967
104 -7.56101993 -7.06254573
105 6.61168411 -7.56101993
106 1.15535617 6.61168411
107 2.61629352 1.15535617
108 0.54896495 2.61629352
109 -2.05837305 0.54896495
110 2.18974803 -2.05837305
111 2.14971664 2.18974803
112 -6.18051188 2.14971664
113 1.35256339 -6.18051188
114 0.74951805 1.35256339
115 1.61229244 0.74951805
116 0.24426975 1.61229244
117 -3.38905733 0.24426975
118 2.69171857 -3.38905733
119 4.34180994 2.69171857
120 -0.98428041 4.34180994
121 3.86998969 -0.98428041
122 -3.07877155 3.86998969
123 1.18514010 -3.07877155
124 2.56201153 1.18514010
125 -6.10279822 2.56201153
126 -5.80375349 -6.10279822
127 2.54525123 -5.80375349
128 1.48148274 2.54525123
129 -1.88154909 1.48148274
130 -0.40321917 -1.88154909
131 -2.22427751 -0.40321917
132 -2.55303013 -2.22427751
133 -1.05030324 -2.55303013
134 1.51957554 -1.05030324
135 -2.10744257 1.51957554
136 2.07015144 -2.10744257
137 3.38694869 2.07015144
138 2.48379678 3.38694869
139 1.76942788 2.48379678
140 4.15417728 1.76942788
141 -0.53296352 4.15417728
142 3.86422319 -0.53296352
143 -0.39607438 3.86422319
144 -0.17684422 -0.39607438
145 -9.36487521 -0.17684422
146 -3.59504231 -9.36487521
147 3.52315421 -3.59504231
148 3.42792911 3.52315421
149 -2.82190677 3.42792911
150 0.01565321 -2.82190677
151 1.44531376 0.01565321
152 -0.95653992 1.44531376
153 -0.33736263 -0.95653992
154 1.83237464 -0.33736263
155 0.39872033 1.83237464
156 NA 0.39872033
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.13887671 3.99836622
[2,] 0.37164960 -3.13887671
[3,] -5.38706762 0.37164960
[4,] -2.57876358 -5.38706762
[5,] -2.37958175 -2.57876358
[6,] 1.88081456 -2.37958175
[7,] -2.24654916 1.88081456
[8,] 2.01841021 -2.24654916
[9,] -4.49093574 2.01841021
[10,] 4.19890303 -4.49093574
[11,] -0.08541927 4.19890303
[12,] 3.84765068 -0.08541927
[13,] 0.76751033 3.84765068
[14,] -4.90412941 0.76751033
[15,] 2.03508064 -4.90412941
[16,] 1.89220755 2.03508064
[17,] 0.95105092 1.89220755
[18,] -3.45379076 0.95105092
[19,] -0.91966778 -3.45379076
[20,] -1.65838515 -0.91966778
[21,] 0.54651552 -1.65838515
[22,] 4.72279490 0.54651552
[23,] -5.58145937 4.72279490
[24,] 1.12068829 -5.58145937
[25,] 5.11510152 1.12068829
[26,] 1.58391339 5.11510152
[27,] 5.30453183 1.58391339
[28,] 1.38496303 5.30453183
[29,] -2.93512683 1.38496303
[30,] -1.35604420 -2.93512683
[31,] -1.50935216 -1.35604420
[32,] 1.20632554 -1.50935216
[33,] -4.12125898 1.20632554
[34,] 0.99653070 -4.12125898
[35,] 4.40001086 0.99653070
[36,] -1.75591754 4.40001086
[37,] -2.98608464 -1.75591754
[38,] 1.94495497 -2.98608464
[39,] 5.78875134 1.94495497
[40,] 2.56807788 5.78875134
[41,] -6.07944045 2.56807788
[42,] -1.08230839 -6.07944045
[43,] -0.06557105 -1.08230839
[44,] -4.08723350 -0.06557105
[45,] 0.37373366 -4.08723350
[46,] 3.72330216 0.37373366
[47,] -5.14369592 3.72330216
[48,] 1.99650447 -5.14369592
[49,] 1.17145448 1.99650447
[50,] -7.57743897 1.17145448
[51,] 2.21934041 -7.57743897
[52,] -0.74452334 2.21934041
[53,] -1.91724501 -0.74452334
[54,] 1.80077954 -1.91724501
[55,] 1.12348773 1.80077954
[56,] 2.40151072 1.12348773
[57,] 3.56004357 2.40151072
[58,] 1.79415837 3.56004357
[59,] 0.99344133 1.79415837
[60,] -1.37524308 0.99344133
[61,] 7.15191830 -1.37524308
[62,] 5.78628749 7.15191830
[63,] 2.67430121 5.78628749
[64,] -5.24527240 2.67430121
[65,] 1.18284868 -5.24527240
[66,] 3.51112208 1.18284868
[67,] -2.55122994 3.51112208
[68,] 0.20023333 -2.55122994
[69,] -5.58119450 0.20023333
[70,] 2.30166312 -5.58119450
[71,] 0.57380920 2.30166312
[72,] 1.23692771 0.57380920
[73,] 2.23168242 1.23692771
[74,] 0.89712771 2.23168242
[75,] 1.72606700 0.89712771
[76,] 2.12139424 1.72606700
[77,] 1.87581293 2.12139424
[78,] -2.80811755 1.87581293
[79,] -3.32316375 -2.80811755
[80,] -4.84412732 -3.32316375
[81,] -0.10451121 -4.84412732
[82,] 1.61936765 -0.10451121
[83,] -1.49323201 1.61936765
[84,] -3.00441362 -1.49323201
[85,] -1.02966915 -3.00441362
[86,] -2.00542191 -1.02966915
[87,] -0.76713154 -2.00542191
[88,] -2.72010552 -0.76713154
[89,] -0.80582963 -2.72010552
[90,] 1.50382620 -0.80582963
[91,] -0.74736909 1.50382620
[92,] 2.77493305 -0.74736909
[93,] 2.79758428 2.77493305
[94,] -2.03494539 2.79758428
[95,] -2.78222826 -2.03494539
[96,] -4.34500168 -2.78222826
[97,] -2.69817648 -4.34500168
[98,] 2.67312253 -2.69817648
[99,] -0.03969887 2.67312253
[100,] 3.84152466 -0.03969887
[101,] 1.72465214 3.84152466
[102,] 1.10646967 1.72465214
[103,] -7.06254573 1.10646967
[104,] -7.56101993 -7.06254573
[105,] 6.61168411 -7.56101993
[106,] 1.15535617 6.61168411
[107,] 2.61629352 1.15535617
[108,] 0.54896495 2.61629352
[109,] -2.05837305 0.54896495
[110,] 2.18974803 -2.05837305
[111,] 2.14971664 2.18974803
[112,] -6.18051188 2.14971664
[113,] 1.35256339 -6.18051188
[114,] 0.74951805 1.35256339
[115,] 1.61229244 0.74951805
[116,] 0.24426975 1.61229244
[117,] -3.38905733 0.24426975
[118,] 2.69171857 -3.38905733
[119,] 4.34180994 2.69171857
[120,] -0.98428041 4.34180994
[121,] 3.86998969 -0.98428041
[122,] -3.07877155 3.86998969
[123,] 1.18514010 -3.07877155
[124,] 2.56201153 1.18514010
[125,] -6.10279822 2.56201153
[126,] -5.80375349 -6.10279822
[127,] 2.54525123 -5.80375349
[128,] 1.48148274 2.54525123
[129,] -1.88154909 1.48148274
[130,] -0.40321917 -1.88154909
[131,] -2.22427751 -0.40321917
[132,] -2.55303013 -2.22427751
[133,] -1.05030324 -2.55303013
[134,] 1.51957554 -1.05030324
[135,] -2.10744257 1.51957554
[136,] 2.07015144 -2.10744257
[137,] 3.38694869 2.07015144
[138,] 2.48379678 3.38694869
[139,] 1.76942788 2.48379678
[140,] 4.15417728 1.76942788
[141,] -0.53296352 4.15417728
[142,] 3.86422319 -0.53296352
[143,] -0.39607438 3.86422319
[144,] -0.17684422 -0.39607438
[145,] -9.36487521 -0.17684422
[146,] -3.59504231 -9.36487521
[147,] 3.52315421 -3.59504231
[148,] 3.42792911 3.52315421
[149,] -2.82190677 3.42792911
[150,] 0.01565321 -2.82190677
[151,] 1.44531376 0.01565321
[152,] -0.95653992 1.44531376
[153,] -0.33736263 -0.95653992
[154,] 1.83237464 -0.33736263
[155,] 0.39872033 1.83237464
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.13887671 3.99836622
2 0.37164960 -3.13887671
3 -5.38706762 0.37164960
4 -2.57876358 -5.38706762
5 -2.37958175 -2.57876358
6 1.88081456 -2.37958175
7 -2.24654916 1.88081456
8 2.01841021 -2.24654916
9 -4.49093574 2.01841021
10 4.19890303 -4.49093574
11 -0.08541927 4.19890303
12 3.84765068 -0.08541927
13 0.76751033 3.84765068
14 -4.90412941 0.76751033
15 2.03508064 -4.90412941
16 1.89220755 2.03508064
17 0.95105092 1.89220755
18 -3.45379076 0.95105092
19 -0.91966778 -3.45379076
20 -1.65838515 -0.91966778
21 0.54651552 -1.65838515
22 4.72279490 0.54651552
23 -5.58145937 4.72279490
24 1.12068829 -5.58145937
25 5.11510152 1.12068829
26 1.58391339 5.11510152
27 5.30453183 1.58391339
28 1.38496303 5.30453183
29 -2.93512683 1.38496303
30 -1.35604420 -2.93512683
31 -1.50935216 -1.35604420
32 1.20632554 -1.50935216
33 -4.12125898 1.20632554
34 0.99653070 -4.12125898
35 4.40001086 0.99653070
36 -1.75591754 4.40001086
37 -2.98608464 -1.75591754
38 1.94495497 -2.98608464
39 5.78875134 1.94495497
40 2.56807788 5.78875134
41 -6.07944045 2.56807788
42 -1.08230839 -6.07944045
43 -0.06557105 -1.08230839
44 -4.08723350 -0.06557105
45 0.37373366 -4.08723350
46 3.72330216 0.37373366
47 -5.14369592 3.72330216
48 1.99650447 -5.14369592
49 1.17145448 1.99650447
50 -7.57743897 1.17145448
51 2.21934041 -7.57743897
52 -0.74452334 2.21934041
53 -1.91724501 -0.74452334
54 1.80077954 -1.91724501
55 1.12348773 1.80077954
56 2.40151072 1.12348773
57 3.56004357 2.40151072
58 1.79415837 3.56004357
59 0.99344133 1.79415837
60 -1.37524308 0.99344133
61 7.15191830 -1.37524308
62 5.78628749 7.15191830
63 2.67430121 5.78628749
64 -5.24527240 2.67430121
65 1.18284868 -5.24527240
66 3.51112208 1.18284868
67 -2.55122994 3.51112208
68 0.20023333 -2.55122994
69 -5.58119450 0.20023333
70 2.30166312 -5.58119450
71 0.57380920 2.30166312
72 1.23692771 0.57380920
73 2.23168242 1.23692771
74 0.89712771 2.23168242
75 1.72606700 0.89712771
76 2.12139424 1.72606700
77 1.87581293 2.12139424
78 -2.80811755 1.87581293
79 -3.32316375 -2.80811755
80 -4.84412732 -3.32316375
81 -0.10451121 -4.84412732
82 1.61936765 -0.10451121
83 -1.49323201 1.61936765
84 -3.00441362 -1.49323201
85 -1.02966915 -3.00441362
86 -2.00542191 -1.02966915
87 -0.76713154 -2.00542191
88 -2.72010552 -0.76713154
89 -0.80582963 -2.72010552
90 1.50382620 -0.80582963
91 -0.74736909 1.50382620
92 2.77493305 -0.74736909
93 2.79758428 2.77493305
94 -2.03494539 2.79758428
95 -2.78222826 -2.03494539
96 -4.34500168 -2.78222826
97 -2.69817648 -4.34500168
98 2.67312253 -2.69817648
99 -0.03969887 2.67312253
100 3.84152466 -0.03969887
101 1.72465214 3.84152466
102 1.10646967 1.72465214
103 -7.06254573 1.10646967
104 -7.56101993 -7.06254573
105 6.61168411 -7.56101993
106 1.15535617 6.61168411
107 2.61629352 1.15535617
108 0.54896495 2.61629352
109 -2.05837305 0.54896495
110 2.18974803 -2.05837305
111 2.14971664 2.18974803
112 -6.18051188 2.14971664
113 1.35256339 -6.18051188
114 0.74951805 1.35256339
115 1.61229244 0.74951805
116 0.24426975 1.61229244
117 -3.38905733 0.24426975
118 2.69171857 -3.38905733
119 4.34180994 2.69171857
120 -0.98428041 4.34180994
121 3.86998969 -0.98428041
122 -3.07877155 3.86998969
123 1.18514010 -3.07877155
124 2.56201153 1.18514010
125 -6.10279822 2.56201153
126 -5.80375349 -6.10279822
127 2.54525123 -5.80375349
128 1.48148274 2.54525123
129 -1.88154909 1.48148274
130 -0.40321917 -1.88154909
131 -2.22427751 -0.40321917
132 -2.55303013 -2.22427751
133 -1.05030324 -2.55303013
134 1.51957554 -1.05030324
135 -2.10744257 1.51957554
136 2.07015144 -2.10744257
137 3.38694869 2.07015144
138 2.48379678 3.38694869
139 1.76942788 2.48379678
140 4.15417728 1.76942788
141 -0.53296352 4.15417728
142 3.86422319 -0.53296352
143 -0.39607438 3.86422319
144 -0.17684422 -0.39607438
145 -9.36487521 -0.17684422
146 -3.59504231 -9.36487521
147 3.52315421 -3.59504231
148 3.42792911 3.52315421
149 -2.82190677 3.42792911
150 0.01565321 -2.82190677
151 1.44531376 0.01565321
152 -0.95653992 1.44531376
153 -0.33736263 -0.95653992
154 1.83237464 -0.33736263
155 0.39872033 1.83237464
> 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/7islv1321990957.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/890af1321990957.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/9cclg1321990957.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/10aoka1321990957.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/11zmii1321990957.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/12uioh1321990957.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/13ho0d1321990957.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/14wbnf1321990957.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/1548ad1321990958.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/168ktl1321990958.tab")
+ }
>
> try(system("convert tmp/16b251321990957.ps tmp/16b251321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/23x241321990957.ps tmp/23x241321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/30b271321990957.ps tmp/30b271321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/4j7z51321990957.ps tmp/4j7z51321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/5nz0i1321990957.ps tmp/5nz0i1321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/6v8b91321990957.ps tmp/6v8b91321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/7islv1321990957.ps tmp/7islv1321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/890af1321990957.ps tmp/890af1321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/9cclg1321990957.ps tmp/9cclg1321990957.png",intern=TRUE))
character(0)
> try(system("convert tmp/10aoka1321990957.ps tmp/10aoka1321990957.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.863 0.514 5.448