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(9
+ ,68
+ ,63
+ ,4
+ ,12
+ ,9
+ ,51
+ ,61
+ ,4
+ ,11
+ ,9
+ ,56
+ ,60
+ ,6
+ ,14
+ ,9
+ ,48
+ ,62
+ ,8
+ ,12
+ ,9
+ ,44
+ ,68
+ ,8
+ ,21
+ ,9
+ ,67
+ ,77
+ ,4
+ ,12
+ ,9
+ ,46
+ ,70
+ ,4
+ ,22
+ ,9
+ ,54
+ ,69
+ ,8
+ ,11
+ ,9
+ ,61
+ ,65
+ ,5
+ ,10
+ ,9
+ ,52
+ ,64
+ ,4
+ ,13
+ ,9
+ ,46
+ ,76
+ ,4
+ ,10
+ ,9
+ ,55
+ ,71
+ ,4
+ ,8
+ ,9
+ ,46
+ ,63
+ ,4
+ ,15
+ ,9
+ ,52
+ ,63
+ ,4
+ ,14
+ ,9
+ ,76
+ ,79
+ ,4
+ ,10
+ ,9
+ ,49
+ ,65
+ ,8
+ ,14
+ ,9
+ ,30
+ ,74
+ ,4
+ ,14
+ ,9
+ ,75
+ ,78
+ ,4
+ ,11
+ ,9
+ ,51
+ ,75
+ ,4
+ ,10
+ ,9
+ ,50
+ ,73
+ ,8
+ ,13
+ ,9
+ ,38
+ ,52
+ ,4
+ ,7
+ ,9
+ ,55
+ ,76
+ ,7
+ ,14
+ ,9
+ ,18
+ ,55
+ ,4
+ ,12
+ ,9
+ ,52
+ ,69
+ ,4
+ ,14
+ ,9
+ ,42
+ ,76
+ ,5
+ ,11
+ ,9
+ ,66
+ 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+ ,dim=c(5
+ ,162)
+ ,dimnames=list(c('month'
+ ,'extrinsic'
+ ,'intrinsic'
+ ,'amotivation'
+ ,'depression')
+ ,1:162))
> y <- array(NA,dim=c(5,162),dimnames=list(c('month','extrinsic','intrinsic','amotivation','depression'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '5'
> 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
depression month extrinsic intrinsic amotivation
1 12 9 68 63 4
2 11 9 51 61 4
3 14 9 56 60 6
4 12 9 48 62 8
5 21 9 44 68 8
6 12 9 67 77 4
7 22 9 46 70 4
8 11 9 54 69 8
9 10 9 61 65 5
10 13 9 52 64 4
11 10 9 46 76 4
12 8 9 55 71 4
13 15 9 46 63 4
14 14 9 52 63 4
15 10 9 76 79 4
16 14 9 49 65 8
17 14 9 30 74 4
18 11 9 75 78 4
19 10 9 51 75 4
20 13 9 50 73 8
21 7 9 38 52 4
22 14 9 55 76 7
23 12 9 18 55 4
24 14 9 52 69 4
25 11 9 42 76 5
26 9 9 66 61 4
27 11 9 66 61 4
28 15 9 33 55 4
29 14 9 48 53 4
30 13 9 57 68 4
31 9 9 64 72 4
32 15 9 58 65 4
33 10 9 59 54 15
34 11 10 42 55 10
35 13 10 39 66 4
36 8 10 59 64 8
37 20 10 37 76 4
38 12 10 49 64 4
39 10 10 80 83 4
40 10 10 62 71 4
41 9 10 52 74 7
42 14 10 53 70 4
43 8 10 58 70 6
44 14 10 69 67 5
45 11 10 63 61 4
46 13 10 36 62 16
47 9 10 38 53 5
48 11 10 46 71 12
49 15 10 56 64 6
50 11 10 37 72 9
51 10 10 51 58 9
52 14 10 44 59 4
53 18 10 58 79 5
54 14 10 37 49 4
55 11 10 65 71 4
56 12 10 48 64 5
57 13 10 53 65 4
58 9 10 51 63 4
59 10 10 39 70 4
60 15 10 64 62 5
61 20 10 51 62 4
62 12 10 47 65 6
63 12 10 64 64 4
64 14 10 59 65 4
65 13 10 54 55 18
66 11 10 55 75 4
67 17 10 72 72 6
68 12 10 58 64 4
69 13 10 59 73 4
70 14 10 36 67 5
71 13 10 62 75 4
72 15 10 63 71 4
73 13 10 50 58 5
74 10 10 67 67 10
75 11 10 70 77 5
76 19 10 46 58 8
77 13 10 46 55 8
78 17 10 59 75 5
79 13 10 73 81 4
80 9 10 38 54 4
81 11 10 62 67 4
82 10 10 41 56 5
83 9 10 56 64 4
84 12 10 52 69 4
85 12 10 54 66 8
86 13 10 73 75 4
87 13 10 60 75 5
88 12 10 40 61 14
89 15 10 41 59 8
90 22 10 54 68 8
91 13 10 42 43 4
92 15 10 70 61 4
93 13 10 51 70 6
94 15 10 60 67 4
95 10 10 49 73 7
96 11 10 52 72 7
97 16 10 57 64 4
98 11 10 50 59 6
99 11 10 47 65 4
100 10 11 74 72 7
101 10 11 47 70 4
102 16 11 47 54 4
103 12 11 59 66 8
104 11 11 64 73 4
105 16 11 55 64 4
106 19 11 52 61 10
107 11 11 44 59 8
108 16 11 60 63 6
109 15 11 51 66 4
110 24 11 63 68 4
111 14 11 49 81 4
112 15 11 52 72 5
113 11 11 48 53 4
114 15 11 50 61 6
115 12 11 67 77 4
116 10 11 42 54 5
117 14 11 44 75 7
118 13 11 51 70 8
119 9 11 47 60 5
120 15 11 37 63 8
121 15 11 51 57 10
122 14 11 60 70 8
123 11 11 38 67 5
124 8 11 52 44 12
125 11 11 65 81 4
126 11 11 60 69 5
127 8 11 70 71 4
128 10 11 44 67 6
129 11 11 50 60 4
130 13 11 63 66 4
131 11 11 50 61 7
132 20 11 68 69 7
133 10 11 32 57 10
134 15 11 47 65 4
135 12 11 67 74 5
136 14 11 50 56 8
137 23 11 57 74 11
138 14 11 46 69 7
139 16 11 67 76 4
140 11 11 63 68 8
141 12 11 36 60 6
142 10 11 54 72 7
143 14 11 36 74 5
144 12 11 57 57 4
145 12 11 70 73 8
146 11 11 47 58 4
147 12 11 51 71 8
148 13 11 62 62 6
149 11 11 60 64 4
150 19 11 59 58 9
151 12 11 52 67 5
152 17 11 52 76 6
153 9 11 69 67 4
154 12 11 56 78 4
155 19 11 62 72 4
156 18 11 55 62 5
157 15 11 52 68 6
158 14 11 48 71 16
159 11 11 51 70 6
160 9 11 53 61 6
161 18 11 48 50 4
162 16 11 55 54 4
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) month extrinsic intrinsic amotivation
6.58798 0.48865 -0.01669 0.03201 0.02307
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.1592 -2.2524 -0.4803 1.5881 10.8200
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.58798 4.12089 1.599 0.112
month 0.48865 0.33746 1.448 0.150
extrinsic -0.01669 0.02658 -0.628 0.531
intrinsic 0.03201 0.03605 0.888 0.376
amotivation 0.02307 0.09811 0.235 0.814
Residual standard error: 3.176 on 157 degrees of freedom
Multiple R-squared: 0.01862, Adjusted R-squared: -0.006383
F-statistic: 0.7447 on 4 and 157 DF, p-value: 0.5629
> 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.91460866 0.17078268 0.08539134
[2,] 0.85767203 0.28465594 0.14232797
[3,] 0.80945167 0.38109665 0.19054833
[4,] 0.96553322 0.06893357 0.03446678
[5,] 0.97517616 0.04964767 0.02482384
[6,] 0.95887061 0.08225877 0.04112939
[7,] 0.93561968 0.12876065 0.06438032
[8,] 0.91098428 0.17803144 0.08901572
[9,] 0.87326389 0.25347222 0.12673611
[10,] 0.85371482 0.29257036 0.14628518
[11,] 0.81025150 0.37949700 0.18974850
[12,] 0.79218242 0.41563516 0.20781758
[13,] 0.73688610 0.52622780 0.26311390
[14,] 0.86692563 0.26614874 0.13307437
[15,] 0.82597572 0.34804856 0.17402428
[16,] 0.78968509 0.42062981 0.21031491
[17,] 0.75343171 0.49313659 0.24656829
[18,] 0.73174561 0.53650879 0.26825439
[19,] 0.69386299 0.61227402 0.30613701
[20,] 0.63641813 0.72716373 0.36358187
[21,] 0.61227304 0.77545393 0.38772696
[22,] 0.57953062 0.84093876 0.42046938
[23,] 0.52542584 0.94914832 0.47457416
[24,] 0.50237031 0.99525938 0.49762969
[25,] 0.50607435 0.98785130 0.49392565
[26,] 0.51960489 0.96079022 0.48039511
[27,] 0.46277500 0.92555000 0.53722500
[28,] 0.41167682 0.82335364 0.58832318
[29,] 0.40196321 0.80392641 0.59803679
[30,] 0.59490935 0.81018129 0.40509065
[31,] 0.54017153 0.91965693 0.45982847
[32,] 0.50158032 0.99683936 0.49841968
[33,] 0.46423366 0.92846731 0.53576634
[34,] 0.47715080 0.95430159 0.52284920
[35,] 0.44562460 0.89124921 0.55437540
[36,] 0.46791135 0.93582269 0.53208865
[37,] 0.48601702 0.97203403 0.51398298
[38,] 0.44137931 0.88275862 0.55862069
[39,] 0.39061203 0.78122407 0.60938797
[40,] 0.39070709 0.78141418 0.60929291
[41,] 0.35521603 0.71043207 0.64478397
[42,] 0.36759214 0.73518428 0.63240786
[43,] 0.34291680 0.68583360 0.65708320
[44,] 0.31408051 0.62816103 0.68591949
[45,] 0.28570910 0.57141820 0.71429090
[46,] 0.37684725 0.75369450 0.62315275
[47,] 0.34592796 0.69185592 0.65407204
[48,] 0.30905982 0.61811965 0.69094018
[49,] 0.26793891 0.53587782 0.73206109
[50,] 0.23118524 0.46237048 0.76881476
[51,] 0.23633521 0.47267041 0.76366479
[52,] 0.23891810 0.47783621 0.76108190
[53,] 0.25190526 0.50381051 0.74809474
[54,] 0.46675923 0.93351845 0.53324077
[55,] 0.42151070 0.84302139 0.57848930
[56,] 0.37820614 0.75641229 0.62179386
[57,] 0.34662282 0.69324564 0.65337718
[58,] 0.32492703 0.64985406 0.67507297
[59,] 0.29642523 0.59285045 0.70357477
[60,] 0.35086506 0.70173012 0.64913494
[61,] 0.30962221 0.61924441 0.69037779
[62,] 0.26997852 0.53995705 0.73002148
[63,] 0.23702087 0.47404175 0.76297913
[64,] 0.20294362 0.40588724 0.79705638
[65,] 0.18930479 0.37860957 0.81069521
[66,] 0.16007406 0.32014812 0.83992594
[67,] 0.15565776 0.31131553 0.84434224
[68,] 0.13928733 0.27857467 0.86071267
[69,] 0.22949323 0.45898646 0.77050677
[70,] 0.19628114 0.39256229 0.80371886
[71,] 0.21915652 0.43831304 0.78084348
[72,] 0.18771723 0.37543446 0.81228277
[73,] 0.19573256 0.39146512 0.80426744
[74,] 0.17360841 0.34721683 0.82639159
[75,] 0.16344572 0.32689144 0.83655428
[76,] 0.17370618 0.34741236 0.82629382
[77,] 0.14808574 0.29617148 0.85191426
[78,] 0.12668189 0.25336377 0.87331811
[79,] 0.10697390 0.21394780 0.89302610
[80,] 0.08803600 0.17607201 0.91196400
[81,] 0.07539486 0.15078972 0.92460514
[82,] 0.06564476 0.13128953 0.93435524
[83,] 0.22948498 0.45896996 0.77051502
[84,] 0.19909088 0.39818177 0.80090912
[85,] 0.18875164 0.37750328 0.81124836
[86,] 0.15946491 0.31892983 0.84053509
[87,] 0.14965345 0.29930691 0.85034655
[88,] 0.14249576 0.28499153 0.85750424
[89,] 0.12636619 0.25273237 0.87363381
[90,] 0.13373732 0.26747464 0.86626268
[91,] 0.11270686 0.22541372 0.88729314
[92,] 0.09528881 0.19057762 0.90471119
[93,] 0.10115048 0.20230095 0.89884952
[94,] 0.09870865 0.19741730 0.90129135
[95,] 0.10155455 0.20310910 0.89844545
[96,] 0.08644590 0.17289180 0.91355410
[97,] 0.07859952 0.15719904 0.92140048
[98,] 0.07645339 0.15290678 0.92354661
[99,] 0.11632673 0.23265345 0.88367327
[100,] 0.10275292 0.20550585 0.89724708
[101,] 0.09644913 0.19289825 0.90355087
[102,] 0.08330724 0.16661447 0.91669276
[103,] 0.42949341 0.85898681 0.57050659
[104,] 0.38270893 0.76541785 0.61729107
[105,] 0.34820635 0.69641270 0.65179365
[106,] 0.31517219 0.63034438 0.68482781
[107,] 0.28824834 0.57649668 0.71175166
[108,] 0.25591484 0.51182968 0.74408516
[109,] 0.24144349 0.48288698 0.75855651
[110,] 0.20400095 0.40800191 0.79599905
[111,] 0.17044722 0.34089443 0.82955278
[112,] 0.18248056 0.36496111 0.81751944
[113,] 0.15961988 0.31923975 0.84038012
[114,] 0.13685026 0.27370053 0.86314974
[115,] 0.11004831 0.22009662 0.88995169
[116,] 0.09509767 0.19019533 0.90490233
[117,] 0.14978515 0.29957030 0.85021485
[118,] 0.13140100 0.26280200 0.86859900
[119,] 0.11640188 0.23280375 0.88359812
[120,] 0.17786250 0.35572501 0.82213750
[121,] 0.17110500 0.34221000 0.82889500
[122,] 0.14819103 0.29638206 0.85180897
[123,] 0.11870159 0.23740318 0.88129841
[124,] 0.10698451 0.21396901 0.89301549
[125,] 0.17386990 0.34773980 0.82613010
[126,] 0.19357984 0.38715968 0.80642016
[127,] 0.16380471 0.32760941 0.83619529
[128,] 0.13328262 0.26656524 0.86671738
[129,] 0.10307466 0.20614932 0.89692534
[130,] 0.40326426 0.80652852 0.59673574
[131,] 0.34045691 0.68091382 0.65954309
[132,] 0.34297441 0.68594881 0.65702559
[133,] 0.30845938 0.61691876 0.69154062
[134,] 0.27542879 0.55085757 0.72457121
[135,] 0.27231464 0.54462928 0.72768536
[136,] 0.21265602 0.42531205 0.78734398
[137,] 0.17801865 0.35603730 0.82198135
[138,] 0.13463565 0.26927130 0.86536435
[139,] 0.13914223 0.27828446 0.86085777
[140,] 0.10825257 0.21650514 0.89174743
[141,] 0.07444479 0.14888959 0.92555521
[142,] 0.06512636 0.13025272 0.93487364
[143,] 0.08734918 0.17469835 0.91265082
[144,] 0.06971379 0.13942758 0.93028621
[145,] 0.05489521 0.10979041 0.94510479
[146,] 0.15135068 0.30270137 0.84864932
[147,] 0.08326791 0.16653582 0.91673209
> postscript(file="/var/wessaorg/rcomp/tmp/1lvl71321607231.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/2qnnh1321607231.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/3unfg1321607231.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/47wfx1321607231.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/5giey1321607231.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 162
Frequency = 1
1 2 3 4 5 6
0.04078501 -1.17901653 1.89032345 -0.35338515 8.38780393 -0.42398359
7 8 9 10 11 12
9.44946190 -1.47725306 -2.16315904 0.74166249 -2.74256972 -4.43228991
13 14 15 16 17 18
2.67349879 1.77366776 -2.33774068 1.56729387 1.05432357 -1.32243024
19 20 21 22 23 24
-2.62709031 0.32794655 -5.10800187 1.33847459 -0.53791425 1.58163614
25 26 27 28 29 30
-1.83241874 -2.92859411 -0.92859411 2.71250818 2.02694114 0.69711555
31 32 33 34 35 36
-3.31404173 2.80982619 -2.07518788 -1.76430916 -0.02803332 -4.72240508
37 38 39 40 41 42
6.61852433 -0.79707450 -2.88763495 -2.80407862 -4.13625185 1.07767320
43 44 45 46 47 48
-4.88499209 1.41773654 -1.46733110 -0.22693330 -3.65172936 -2.25575359
49 50 51 52 53 54
2.27364987 -2.36880317 -2.68700180 1.27947771 4.85003020 1.48266660
55 56 57 58 59 60
-1.75399414 -0.83683904 0.23769954 -3.73167957 -3.15605440 2.49428875
61 62 63 64 65 66
7.30032569 -0.90860886 -0.54665208 1.33786851 0.25147106 -2.04896350
67 68 69 70 71 72
4.28472496 -0.64682105 0.08182636 0.86680721 0.06790030 2.21261621
73 74 75 76 77 78
0.38858223 -2.73100169 -1.88562133 6.25259377 0.34860958 3.99474610
79 80 81 82 83 84
0.05951180 -3.66066492 -1.67605754 -2.69766069 -3.68021070 -0.90701636
85 86 87 88 89 90
-0.86988976 0.25154341 0.01144093 -1.08200929 2.13711436 9.06609970
91 92 93 94 95 96
0.75817236 2.64953270 -0.00185589 2.29055280 -3.15433107 -2.07224132
97 98 99 100 101 102
3.33648412 -1.66649275 -1.86246943 -3.19360760 -3.51114828 3.00093603
103 104 105 106 107 108
-1.27506812 -2.32335201 2.81444197 5.72195500 -2.30145366 2.88378195
109 110 111 112 113 114
1.68365211 10.81997951 0.17018342 1.48524561 -1.95036387 1.78084420
115 116 117 118 119 120
-1.40128860 -3.10560782 0.20953175 -0.53664782 -4.21416530 1.45366147
121 122 123 124 125 126
1.83328125 0.61360563 -2.58845564 -4.78009485 -2.56269933 -2.28517996
127 128 129 130 131 132
-5.15917250 -3.51135638 -2.14101110 -0.11600995 -2.24222551 6.80223924
133 134 135 136 137 138
-3.48392049 1.64887807 -1.32834251 0.89473112 9.36629093 0.43495302
139 140 141 142 143 144
2.63071667 -2.27229935 -1.42087812 -3.52750416 0.15411782 -0.92813149
145 146 147 148 149 150
-1.31546189 -2.12708504 -1.56865309 -0.05082313 -2.10208389 5.95790432
151 152 153 154 155 156
-1.35472804 3.33415482 -4.04784625 -1.61693698 5.67526361 4.85538279
157 158 159 160 161 162
1.59019697 0.19670471 -2.49050839 -4.16907131 5.14565194 3.13449466
> postscript(file="/var/wessaorg/rcomp/tmp/6qby41321607231.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 0.04078501 NA
1 -1.17901653 0.04078501
2 1.89032345 -1.17901653
3 -0.35338515 1.89032345
4 8.38780393 -0.35338515
5 -0.42398359 8.38780393
6 9.44946190 -0.42398359
7 -1.47725306 9.44946190
8 -2.16315904 -1.47725306
9 0.74166249 -2.16315904
10 -2.74256972 0.74166249
11 -4.43228991 -2.74256972
12 2.67349879 -4.43228991
13 1.77366776 2.67349879
14 -2.33774068 1.77366776
15 1.56729387 -2.33774068
16 1.05432357 1.56729387
17 -1.32243024 1.05432357
18 -2.62709031 -1.32243024
19 0.32794655 -2.62709031
20 -5.10800187 0.32794655
21 1.33847459 -5.10800187
22 -0.53791425 1.33847459
23 1.58163614 -0.53791425
24 -1.83241874 1.58163614
25 -2.92859411 -1.83241874
26 -0.92859411 -2.92859411
27 2.71250818 -0.92859411
28 2.02694114 2.71250818
29 0.69711555 2.02694114
30 -3.31404173 0.69711555
31 2.80982619 -3.31404173
32 -2.07518788 2.80982619
33 -1.76430916 -2.07518788
34 -0.02803332 -1.76430916
35 -4.72240508 -0.02803332
36 6.61852433 -4.72240508
37 -0.79707450 6.61852433
38 -2.88763495 -0.79707450
39 -2.80407862 -2.88763495
40 -4.13625185 -2.80407862
41 1.07767320 -4.13625185
42 -4.88499209 1.07767320
43 1.41773654 -4.88499209
44 -1.46733110 1.41773654
45 -0.22693330 -1.46733110
46 -3.65172936 -0.22693330
47 -2.25575359 -3.65172936
48 2.27364987 -2.25575359
49 -2.36880317 2.27364987
50 -2.68700180 -2.36880317
51 1.27947771 -2.68700180
52 4.85003020 1.27947771
53 1.48266660 4.85003020
54 -1.75399414 1.48266660
55 -0.83683904 -1.75399414
56 0.23769954 -0.83683904
57 -3.73167957 0.23769954
58 -3.15605440 -3.73167957
59 2.49428875 -3.15605440
60 7.30032569 2.49428875
61 -0.90860886 7.30032569
62 -0.54665208 -0.90860886
63 1.33786851 -0.54665208
64 0.25147106 1.33786851
65 -2.04896350 0.25147106
66 4.28472496 -2.04896350
67 -0.64682105 4.28472496
68 0.08182636 -0.64682105
69 0.86680721 0.08182636
70 0.06790030 0.86680721
71 2.21261621 0.06790030
72 0.38858223 2.21261621
73 -2.73100169 0.38858223
74 -1.88562133 -2.73100169
75 6.25259377 -1.88562133
76 0.34860958 6.25259377
77 3.99474610 0.34860958
78 0.05951180 3.99474610
79 -3.66066492 0.05951180
80 -1.67605754 -3.66066492
81 -2.69766069 -1.67605754
82 -3.68021070 -2.69766069
83 -0.90701636 -3.68021070
84 -0.86988976 -0.90701636
85 0.25154341 -0.86988976
86 0.01144093 0.25154341
87 -1.08200929 0.01144093
88 2.13711436 -1.08200929
89 9.06609970 2.13711436
90 0.75817236 9.06609970
91 2.64953270 0.75817236
92 -0.00185589 2.64953270
93 2.29055280 -0.00185589
94 -3.15433107 2.29055280
95 -2.07224132 -3.15433107
96 3.33648412 -2.07224132
97 -1.66649275 3.33648412
98 -1.86246943 -1.66649275
99 -3.19360760 -1.86246943
100 -3.51114828 -3.19360760
101 3.00093603 -3.51114828
102 -1.27506812 3.00093603
103 -2.32335201 -1.27506812
104 2.81444197 -2.32335201
105 5.72195500 2.81444197
106 -2.30145366 5.72195500
107 2.88378195 -2.30145366
108 1.68365211 2.88378195
109 10.81997951 1.68365211
110 0.17018342 10.81997951
111 1.48524561 0.17018342
112 -1.95036387 1.48524561
113 1.78084420 -1.95036387
114 -1.40128860 1.78084420
115 -3.10560782 -1.40128860
116 0.20953175 -3.10560782
117 -0.53664782 0.20953175
118 -4.21416530 -0.53664782
119 1.45366147 -4.21416530
120 1.83328125 1.45366147
121 0.61360563 1.83328125
122 -2.58845564 0.61360563
123 -4.78009485 -2.58845564
124 -2.56269933 -4.78009485
125 -2.28517996 -2.56269933
126 -5.15917250 -2.28517996
127 -3.51135638 -5.15917250
128 -2.14101110 -3.51135638
129 -0.11600995 -2.14101110
130 -2.24222551 -0.11600995
131 6.80223924 -2.24222551
132 -3.48392049 6.80223924
133 1.64887807 -3.48392049
134 -1.32834251 1.64887807
135 0.89473112 -1.32834251
136 9.36629093 0.89473112
137 0.43495302 9.36629093
138 2.63071667 0.43495302
139 -2.27229935 2.63071667
140 -1.42087812 -2.27229935
141 -3.52750416 -1.42087812
142 0.15411782 -3.52750416
143 -0.92813149 0.15411782
144 -1.31546189 -0.92813149
145 -2.12708504 -1.31546189
146 -1.56865309 -2.12708504
147 -0.05082313 -1.56865309
148 -2.10208389 -0.05082313
149 5.95790432 -2.10208389
150 -1.35472804 5.95790432
151 3.33415482 -1.35472804
152 -4.04784625 3.33415482
153 -1.61693698 -4.04784625
154 5.67526361 -1.61693698
155 4.85538279 5.67526361
156 1.59019697 4.85538279
157 0.19670471 1.59019697
158 -2.49050839 0.19670471
159 -4.16907131 -2.49050839
160 5.14565194 -4.16907131
161 3.13449466 5.14565194
162 NA 3.13449466
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.17901653 0.04078501
[2,] 1.89032345 -1.17901653
[3,] -0.35338515 1.89032345
[4,] 8.38780393 -0.35338515
[5,] -0.42398359 8.38780393
[6,] 9.44946190 -0.42398359
[7,] -1.47725306 9.44946190
[8,] -2.16315904 -1.47725306
[9,] 0.74166249 -2.16315904
[10,] -2.74256972 0.74166249
[11,] -4.43228991 -2.74256972
[12,] 2.67349879 -4.43228991
[13,] 1.77366776 2.67349879
[14,] -2.33774068 1.77366776
[15,] 1.56729387 -2.33774068
[16,] 1.05432357 1.56729387
[17,] -1.32243024 1.05432357
[18,] -2.62709031 -1.32243024
[19,] 0.32794655 -2.62709031
[20,] -5.10800187 0.32794655
[21,] 1.33847459 -5.10800187
[22,] -0.53791425 1.33847459
[23,] 1.58163614 -0.53791425
[24,] -1.83241874 1.58163614
[25,] -2.92859411 -1.83241874
[26,] -0.92859411 -2.92859411
[27,] 2.71250818 -0.92859411
[28,] 2.02694114 2.71250818
[29,] 0.69711555 2.02694114
[30,] -3.31404173 0.69711555
[31,] 2.80982619 -3.31404173
[32,] -2.07518788 2.80982619
[33,] -1.76430916 -2.07518788
[34,] -0.02803332 -1.76430916
[35,] -4.72240508 -0.02803332
[36,] 6.61852433 -4.72240508
[37,] -0.79707450 6.61852433
[38,] -2.88763495 -0.79707450
[39,] -2.80407862 -2.88763495
[40,] -4.13625185 -2.80407862
[41,] 1.07767320 -4.13625185
[42,] -4.88499209 1.07767320
[43,] 1.41773654 -4.88499209
[44,] -1.46733110 1.41773654
[45,] -0.22693330 -1.46733110
[46,] -3.65172936 -0.22693330
[47,] -2.25575359 -3.65172936
[48,] 2.27364987 -2.25575359
[49,] -2.36880317 2.27364987
[50,] -2.68700180 -2.36880317
[51,] 1.27947771 -2.68700180
[52,] 4.85003020 1.27947771
[53,] 1.48266660 4.85003020
[54,] -1.75399414 1.48266660
[55,] -0.83683904 -1.75399414
[56,] 0.23769954 -0.83683904
[57,] -3.73167957 0.23769954
[58,] -3.15605440 -3.73167957
[59,] 2.49428875 -3.15605440
[60,] 7.30032569 2.49428875
[61,] -0.90860886 7.30032569
[62,] -0.54665208 -0.90860886
[63,] 1.33786851 -0.54665208
[64,] 0.25147106 1.33786851
[65,] -2.04896350 0.25147106
[66,] 4.28472496 -2.04896350
[67,] -0.64682105 4.28472496
[68,] 0.08182636 -0.64682105
[69,] 0.86680721 0.08182636
[70,] 0.06790030 0.86680721
[71,] 2.21261621 0.06790030
[72,] 0.38858223 2.21261621
[73,] -2.73100169 0.38858223
[74,] -1.88562133 -2.73100169
[75,] 6.25259377 -1.88562133
[76,] 0.34860958 6.25259377
[77,] 3.99474610 0.34860958
[78,] 0.05951180 3.99474610
[79,] -3.66066492 0.05951180
[80,] -1.67605754 -3.66066492
[81,] -2.69766069 -1.67605754
[82,] -3.68021070 -2.69766069
[83,] -0.90701636 -3.68021070
[84,] -0.86988976 -0.90701636
[85,] 0.25154341 -0.86988976
[86,] 0.01144093 0.25154341
[87,] -1.08200929 0.01144093
[88,] 2.13711436 -1.08200929
[89,] 9.06609970 2.13711436
[90,] 0.75817236 9.06609970
[91,] 2.64953270 0.75817236
[92,] -0.00185589 2.64953270
[93,] 2.29055280 -0.00185589
[94,] -3.15433107 2.29055280
[95,] -2.07224132 -3.15433107
[96,] 3.33648412 -2.07224132
[97,] -1.66649275 3.33648412
[98,] -1.86246943 -1.66649275
[99,] -3.19360760 -1.86246943
[100,] -3.51114828 -3.19360760
[101,] 3.00093603 -3.51114828
[102,] -1.27506812 3.00093603
[103,] -2.32335201 -1.27506812
[104,] 2.81444197 -2.32335201
[105,] 5.72195500 2.81444197
[106,] -2.30145366 5.72195500
[107,] 2.88378195 -2.30145366
[108,] 1.68365211 2.88378195
[109,] 10.81997951 1.68365211
[110,] 0.17018342 10.81997951
[111,] 1.48524561 0.17018342
[112,] -1.95036387 1.48524561
[113,] 1.78084420 -1.95036387
[114,] -1.40128860 1.78084420
[115,] -3.10560782 -1.40128860
[116,] 0.20953175 -3.10560782
[117,] -0.53664782 0.20953175
[118,] -4.21416530 -0.53664782
[119,] 1.45366147 -4.21416530
[120,] 1.83328125 1.45366147
[121,] 0.61360563 1.83328125
[122,] -2.58845564 0.61360563
[123,] -4.78009485 -2.58845564
[124,] -2.56269933 -4.78009485
[125,] -2.28517996 -2.56269933
[126,] -5.15917250 -2.28517996
[127,] -3.51135638 -5.15917250
[128,] -2.14101110 -3.51135638
[129,] -0.11600995 -2.14101110
[130,] -2.24222551 -0.11600995
[131,] 6.80223924 -2.24222551
[132,] -3.48392049 6.80223924
[133,] 1.64887807 -3.48392049
[134,] -1.32834251 1.64887807
[135,] 0.89473112 -1.32834251
[136,] 9.36629093 0.89473112
[137,] 0.43495302 9.36629093
[138,] 2.63071667 0.43495302
[139,] -2.27229935 2.63071667
[140,] -1.42087812 -2.27229935
[141,] -3.52750416 -1.42087812
[142,] 0.15411782 -3.52750416
[143,] -0.92813149 0.15411782
[144,] -1.31546189 -0.92813149
[145,] -2.12708504 -1.31546189
[146,] -1.56865309 -2.12708504
[147,] -0.05082313 -1.56865309
[148,] -2.10208389 -0.05082313
[149,] 5.95790432 -2.10208389
[150,] -1.35472804 5.95790432
[151,] 3.33415482 -1.35472804
[152,] -4.04784625 3.33415482
[153,] -1.61693698 -4.04784625
[154,] 5.67526361 -1.61693698
[155,] 4.85538279 5.67526361
[156,] 1.59019697 4.85538279
[157,] 0.19670471 1.59019697
[158,] -2.49050839 0.19670471
[159,] -4.16907131 -2.49050839
[160,] 5.14565194 -4.16907131
[161,] 3.13449466 5.14565194
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.17901653 0.04078501
2 1.89032345 -1.17901653
3 -0.35338515 1.89032345
4 8.38780393 -0.35338515
5 -0.42398359 8.38780393
6 9.44946190 -0.42398359
7 -1.47725306 9.44946190
8 -2.16315904 -1.47725306
9 0.74166249 -2.16315904
10 -2.74256972 0.74166249
11 -4.43228991 -2.74256972
12 2.67349879 -4.43228991
13 1.77366776 2.67349879
14 -2.33774068 1.77366776
15 1.56729387 -2.33774068
16 1.05432357 1.56729387
17 -1.32243024 1.05432357
18 -2.62709031 -1.32243024
19 0.32794655 -2.62709031
20 -5.10800187 0.32794655
21 1.33847459 -5.10800187
22 -0.53791425 1.33847459
23 1.58163614 -0.53791425
24 -1.83241874 1.58163614
25 -2.92859411 -1.83241874
26 -0.92859411 -2.92859411
27 2.71250818 -0.92859411
28 2.02694114 2.71250818
29 0.69711555 2.02694114
30 -3.31404173 0.69711555
31 2.80982619 -3.31404173
32 -2.07518788 2.80982619
33 -1.76430916 -2.07518788
34 -0.02803332 -1.76430916
35 -4.72240508 -0.02803332
36 6.61852433 -4.72240508
37 -0.79707450 6.61852433
38 -2.88763495 -0.79707450
39 -2.80407862 -2.88763495
40 -4.13625185 -2.80407862
41 1.07767320 -4.13625185
42 -4.88499209 1.07767320
43 1.41773654 -4.88499209
44 -1.46733110 1.41773654
45 -0.22693330 -1.46733110
46 -3.65172936 -0.22693330
47 -2.25575359 -3.65172936
48 2.27364987 -2.25575359
49 -2.36880317 2.27364987
50 -2.68700180 -2.36880317
51 1.27947771 -2.68700180
52 4.85003020 1.27947771
53 1.48266660 4.85003020
54 -1.75399414 1.48266660
55 -0.83683904 -1.75399414
56 0.23769954 -0.83683904
57 -3.73167957 0.23769954
58 -3.15605440 -3.73167957
59 2.49428875 -3.15605440
60 7.30032569 2.49428875
61 -0.90860886 7.30032569
62 -0.54665208 -0.90860886
63 1.33786851 -0.54665208
64 0.25147106 1.33786851
65 -2.04896350 0.25147106
66 4.28472496 -2.04896350
67 -0.64682105 4.28472496
68 0.08182636 -0.64682105
69 0.86680721 0.08182636
70 0.06790030 0.86680721
71 2.21261621 0.06790030
72 0.38858223 2.21261621
73 -2.73100169 0.38858223
74 -1.88562133 -2.73100169
75 6.25259377 -1.88562133
76 0.34860958 6.25259377
77 3.99474610 0.34860958
78 0.05951180 3.99474610
79 -3.66066492 0.05951180
80 -1.67605754 -3.66066492
81 -2.69766069 -1.67605754
82 -3.68021070 -2.69766069
83 -0.90701636 -3.68021070
84 -0.86988976 -0.90701636
85 0.25154341 -0.86988976
86 0.01144093 0.25154341
87 -1.08200929 0.01144093
88 2.13711436 -1.08200929
89 9.06609970 2.13711436
90 0.75817236 9.06609970
91 2.64953270 0.75817236
92 -0.00185589 2.64953270
93 2.29055280 -0.00185589
94 -3.15433107 2.29055280
95 -2.07224132 -3.15433107
96 3.33648412 -2.07224132
97 -1.66649275 3.33648412
98 -1.86246943 -1.66649275
99 -3.19360760 -1.86246943
100 -3.51114828 -3.19360760
101 3.00093603 -3.51114828
102 -1.27506812 3.00093603
103 -2.32335201 -1.27506812
104 2.81444197 -2.32335201
105 5.72195500 2.81444197
106 -2.30145366 5.72195500
107 2.88378195 -2.30145366
108 1.68365211 2.88378195
109 10.81997951 1.68365211
110 0.17018342 10.81997951
111 1.48524561 0.17018342
112 -1.95036387 1.48524561
113 1.78084420 -1.95036387
114 -1.40128860 1.78084420
115 -3.10560782 -1.40128860
116 0.20953175 -3.10560782
117 -0.53664782 0.20953175
118 -4.21416530 -0.53664782
119 1.45366147 -4.21416530
120 1.83328125 1.45366147
121 0.61360563 1.83328125
122 -2.58845564 0.61360563
123 -4.78009485 -2.58845564
124 -2.56269933 -4.78009485
125 -2.28517996 -2.56269933
126 -5.15917250 -2.28517996
127 -3.51135638 -5.15917250
128 -2.14101110 -3.51135638
129 -0.11600995 -2.14101110
130 -2.24222551 -0.11600995
131 6.80223924 -2.24222551
132 -3.48392049 6.80223924
133 1.64887807 -3.48392049
134 -1.32834251 1.64887807
135 0.89473112 -1.32834251
136 9.36629093 0.89473112
137 0.43495302 9.36629093
138 2.63071667 0.43495302
139 -2.27229935 2.63071667
140 -1.42087812 -2.27229935
141 -3.52750416 -1.42087812
142 0.15411782 -3.52750416
143 -0.92813149 0.15411782
144 -1.31546189 -0.92813149
145 -2.12708504 -1.31546189
146 -1.56865309 -2.12708504
147 -0.05082313 -1.56865309
148 -2.10208389 -0.05082313
149 5.95790432 -2.10208389
150 -1.35472804 5.95790432
151 3.33415482 -1.35472804
152 -4.04784625 3.33415482
153 -1.61693698 -4.04784625
154 5.67526361 -1.61693698
155 4.85538279 5.67526361
156 1.59019697 4.85538279
157 0.19670471 1.59019697
158 -2.49050839 0.19670471
159 -4.16907131 -2.49050839
160 5.14565194 -4.16907131
161 3.13449466 5.14565194
> 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/77ie01321607231.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/8b1ew1321607231.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/9w04n1321607231.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/10or5i1321607231.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/11ekym1321607231.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/12gejx1321607231.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/13xyvo1321607231.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/14aush1321607231.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/15d7io1321607231.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/168xl51321607231.tab")
+ }
>
> try(system("convert tmp/1lvl71321607231.ps tmp/1lvl71321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qnnh1321607231.ps tmp/2qnnh1321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/3unfg1321607231.ps tmp/3unfg1321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/47wfx1321607231.ps tmp/47wfx1321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/5giey1321607231.ps tmp/5giey1321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/6qby41321607231.ps tmp/6qby41321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/77ie01321607231.ps tmp/77ie01321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/8b1ew1321607231.ps tmp/8b1ew1321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/9w04n1321607231.ps tmp/9w04n1321607231.png",intern=TRUE))
character(0)
> try(system("convert tmp/10or5i1321607231.ps tmp/10or5i1321607231.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.815 0.544 5.439