R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-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(4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,1,4,0,4,0,4,1,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,1,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,1,4,0,4,1,4,0,4,0,4,0,4,0,4,0,4,1,4,0,4,0,4,0,4,0,4,0,4,0,4,1,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,1,4,0,4,0,4,0,4,0,4,1,4,0,4,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,1,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,1,2,1,2,0),dim=c(2,154),dimnames=list(c('Weeks','CorrectAnalysis
'),1:154))
> y <- array(NA,dim=c(2,154),dimnames=list(c('Weeks','CorrectAnalysis
'),1:154))
> 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 = 'Include Monthly Dummies'
> par1 = '2'
> par3 <- 'No Linear Trend'
> par2 <- 'Include Monthly Dummies'
> par1 <- '2'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, 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(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 0 0 0 0 0 0 0
145 0 2 1 0 0 0 0 0 0 0 0 0 0
146 0 2 0 1 0 0 0 0 0 0 0 0 0
147 0 2 0 0 1 0 0 0 0 0 0 0 0
148 0 2 0 0 0 1 0 0 0 0 0 0 0
149 0 2 0 0 0 0 1 0 0 0 0 0 0
150 0 2 0 0 0 0 0 1 0 0 0 0 0
151 0 2 0 0 0 0 0 0 1 0 0 0 0
152 1 2 0 0 0 0 0 0 0 1 0 0 0
153 1 2 0 0 0 0 0 0 0 0 1 0 0
154 0 2 0 0 0 0 0 0 0 0 0 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks M1 M2 M3 M4
0.064187 0.032362 -0.168741 -0.168741 -0.163762 -0.086839
M5 M6 M7 M8 M9 M10
-0.009916 -0.086839 -0.009916 -0.009916 -0.009916 -0.163762
M11
-0.166667
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.19363 -0.11899 -0.04207 0.01992 0.89320
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.064187 0.103638 0.619 0.537
Weeks 0.032362 0.021782 1.486 0.140
M1 -0.168741 0.107276 -1.573 0.118
M2 -0.168741 0.107276 -1.573 0.118
M3 -0.163762 0.107284 -1.526 0.129
M4 -0.086839 0.107284 -0.809 0.420
M5 -0.009916 0.107284 -0.092 0.926
M6 -0.086839 0.107284 -0.809 0.420
M7 -0.009916 0.107284 -0.092 0.926
M8 -0.009916 0.107284 -0.092 0.926
M9 -0.009916 0.107284 -0.092 0.926
M10 -0.163762 0.107284 -1.526 0.129
M11 -0.166667 0.109391 -1.524 0.130
Residual standard error: 0.268 on 141 degrees of freedom
Multiple R-squared: 0.08508, Adjusted R-squared: 0.007211
F-statistic: 1.093 on 12 and 141 DF, p-value: 0.3709
> 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.00000000 0.0000000000 1.0000000000
[2,] 0.84281789 0.3143642207 0.1571821103
[3,] 0.74850932 0.5029813650 0.2514906825
[4,] 0.64188222 0.7162355652 0.3581177826
[5,] 0.94581946 0.1083610876 0.0541805438
[6,] 0.91414753 0.1717049380 0.0858524690
[7,] 0.87004833 0.2599033437 0.1299516719
[8,] 0.81458603 0.3708279458 0.1854139729
[9,] 0.75320643 0.4935871445 0.2467935722
[10,] 0.67970881 0.6405823771 0.3202911886
[11,] 0.60057809 0.7988438112 0.3994219056
[12,] 0.51916626 0.9616674817 0.4808337408
[13,] 0.44082192 0.8816438341 0.5591780829
[14,] 0.52181163 0.9563767389 0.4781883695
[15,] 0.44835209 0.8967041710 0.5516479145
[16,] 0.38253988 0.7650797514 0.6174601243
[17,] 0.45608463 0.9121692664 0.5439153668
[18,] 0.39416978 0.7883395588 0.6058302206
[19,] 0.32878370 0.6575673906 0.6712163047
[20,] 0.26901013 0.5380202585 0.7309898707
[21,] 0.22289585 0.4457917022 0.7771041489
[22,] 0.17609726 0.3521945161 0.8239027420
[23,] 0.13648993 0.2729798559 0.8635100721
[24,] 0.10388358 0.2077671695 0.8961164152
[25,] 0.07896625 0.1579325032 0.9210337484
[26,] 0.28322990 0.5664597932 0.7167701034
[27,] 0.23681626 0.4736325160 0.7631837420
[28,] 0.20122547 0.4024509334 0.7987745333
[29,] 0.20658336 0.4131667152 0.7934166424
[30,] 0.17548842 0.3509768362 0.8245115819
[31,] 0.14023157 0.2804631438 0.8597684281
[32,] 0.11028772 0.2205754414 0.8897122793
[33,] 0.09215691 0.1843138282 0.9078430859
[34,] 0.07068443 0.1413688658 0.9293155671
[35,] 0.05339343 0.1067868505 0.9466065748
[36,] 0.03982512 0.0796502455 0.9601748773
[37,] 0.43064517 0.8612903425 0.5693548287
[38,] 0.48726302 0.9745260453 0.5127369773
[39,] 0.90386799 0.1922640120 0.0961320060
[40,] 0.89117610 0.2176478016 0.1088239008
[41,] 0.88072148 0.2385570303 0.1192785152
[42,] 0.86768198 0.2646360379 0.1323180190
[43,] 0.83860708 0.3227858417 0.1613929208
[44,] 0.80570524 0.3885895121 0.1942947561
[45,] 0.97510412 0.0497917568 0.0248958784
[46,] 0.96681911 0.0663617809 0.0331808904
[47,] 0.95642308 0.0871538496 0.0435769248
[48,] 0.94372893 0.1125421344 0.0562710672
[49,] 0.93236428 0.1352714466 0.0676357233
[50,] 0.93171945 0.1365611033 0.0682805516
[51,] 0.91859975 0.1628004958 0.0814002479
[52,] 0.99258339 0.0148332177 0.0074166088
[53,] 0.99104508 0.0179098318 0.0089549159
[54,] 0.99060421 0.0187915797 0.0093957899
[55,] 0.98708099 0.0258380228 0.0129190114
[56,] 0.98247617 0.0350476584 0.0175238292
[57,] 0.98039094 0.0392181215 0.0196090608
[58,] 0.97404138 0.0519172358 0.0259586179
[59,] 0.96612727 0.0677454644 0.0338727322
[60,] 0.95687506 0.0862498859 0.0431249430
[61,] 0.94786058 0.1042788427 0.0521394213
[62,] 0.94384111 0.1123177870 0.0561588935
[63,] 0.93397699 0.1320460234 0.0660230117
[64,] 0.99405039 0.0118992175 0.0059496088
[65,] 0.99328458 0.0134308464 0.0067154232
[66,] 0.99544275 0.0091145055 0.0045572527
[67,] 0.99441458 0.0111708459 0.0055854230
[68,] 0.99386984 0.0122603204 0.0061301602
[69,] 0.99981678 0.0003664371 0.0001832186
[70,] 0.99970055 0.0005988944 0.0002994472
[71,] 0.99951787 0.0009642554 0.0004821277
[72,] 0.99923529 0.0015294149 0.0007647074
[73,] 0.99882368 0.0023526494 0.0011763247
[74,] 0.99826807 0.0034638554 0.0017319277
[75,] 0.99736741 0.0052651893 0.0026325946
[76,] 0.99614416 0.0077116770 0.0038558385
[77,] 0.99515170 0.0096966013 0.0048483007
[78,] 0.99644841 0.0071031744 0.0035515872
[79,] 0.99483217 0.0103356518 0.0051678259
[80,] 0.99254300 0.0149139901 0.0074569950
[81,] 0.98955236 0.0208952746 0.0104476373
[82,] 0.98534348 0.0293130483 0.0146565241
[83,] 0.97966286 0.0406742719 0.0203371360
[84,] 0.97205233 0.0558953484 0.0279476742
[85,] 0.96189620 0.0762075973 0.0381037987
[86,] 0.94987999 0.1002400122 0.0501200061
[87,] 0.93360399 0.1327920132 0.0663960066
[88,] 0.91478989 0.1704202101 0.0852101050
[89,] 0.90571164 0.1885767288 0.0942883644
[90,] 0.93810424 0.1237915154 0.0618957577
[91,] 0.91886442 0.1622711698 0.0811355849
[92,] 0.89517379 0.2096524109 0.1048262054
[93,] 0.86781983 0.2643603456 0.1321801728
[94,] 0.83430267 0.3313946619 0.1656973310
[95,] 0.79530601 0.4093879785 0.2046939892
[96,] 0.75057658 0.4988468375 0.2494234187
[97,] 0.69985786 0.6002842796 0.3001421398
[98,] 0.64720293 0.7055941390 0.3527970695
[99,] 0.58806697 0.8238660511 0.4119330256
[100,] 0.52904089 0.9419182254 0.4709591127
[101,] 0.52706653 0.9458669371 0.4729334685
[102,] 0.72179107 0.5564178656 0.2782089328
[103,] 0.66427229 0.6714554249 0.3357277124
[104,] 0.60177066 0.7964586713 0.3982293356
[105,] 0.53733886 0.9253222888 0.4626611444
[106,] 0.46937805 0.9387561029 0.5306219486
[107,] 0.40127122 0.8025424342 0.5987287829
[108,] 0.33479717 0.6695943453 0.6652028274
[109,] 0.27160712 0.5432142456 0.7283928772
[110,] 0.21562152 0.4312430388 0.7843784806
[111,] 0.16479249 0.3295849884 0.8352075058
[112,] 0.12270888 0.2454177646 0.8772911177
[113,] 0.15873694 0.3174738784 0.8412630608
[114,] 0.78028531 0.4394293881 0.2197146941
[115,] 0.70521515 0.5895696980 0.2947848490
[116,] 0.61727056 0.7654588702 0.3827294351
[117,] 0.52038492 0.9592301690 0.4796150845
[118,] 0.41754717 0.8350943448 0.5824528276
[119,] 0.31593523 0.6318704547 0.6840647726
[120,] 0.22231919 0.4446383886 0.7776808057
[121,] 0.14275443 0.2855088699 0.8572455650
[122,] 0.08200877 0.1640175391 0.9179912304
[123,] 0.04005854 0.0801170721 0.9599414640
> postscript(file="/var/wessaorg/rcomp/tmp/1sxmf1355749692.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/2jnyi1355749692.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/3x77j1355749692.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/4g04x1355749692.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/5t0081355749692.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 = 154
Frequency = 1
1 2 3 4 5 6
-0.02489378 -0.02489378 -0.02987253 -0.10679561 -0.18371869 -0.10679561
7 8 9 10 11 12
-0.18371869 -0.18371869 -0.18371869 -0.02987253 -0.02696826 -0.19363493
13 14 15 16 17 18
-0.02489378 -0.02489378 -0.02987253 -0.10679561 0.81628131 -0.10679561
19 20 21 22 23 24
-0.18371869 0.81628131 -0.18371869 -0.02987253 -0.02696826 -0.19363493
25 26 27 28 29 30
-0.02489378 -0.02489378 -0.02987253 -0.10679561 -0.18371869 -0.10679561
31 32 33 34 35 36
-0.18371869 -0.18371869 -0.18371869 -0.02987253 -0.02696826 -0.19363493
37 38 39 40 41 42
-0.02489378 -0.02489378 -0.02987253 -0.10679561 0.81628131 -0.10679561
43 44 45 46 47 48
-0.18371869 -0.18371869 -0.18371869 -0.02987253 -0.02696826 -0.19363493
49 50 51 52 53 54
-0.02489378 -0.02489378 -0.02987253 0.89320439 -0.18371869 0.89320439
55 56 57 58 59 60
-0.18371869 -0.18371869 -0.18371869 -0.02987253 -0.02696826 0.80636507
61 62 63 64 65 66
-0.02489378 -0.02489378 -0.02987253 -0.10679561 -0.18371869 -0.10679561
67 68 69 70 71 72
0.81628131 -0.18371869 -0.18371869 -0.02987253 -0.02696826 -0.19363493
73 74 75 76 77 78
-0.02489378 -0.02489378 -0.02987253 -0.10679561 -0.18371869 -0.10679561
79 80 81 82 83 84
0.81628131 -0.18371869 -0.18371869 -0.02987253 -0.02696826 0.80636507
85 86 87 88 89 90
-0.02489378 -0.02489378 0.03485129 -0.04207179 -0.11899486 -0.04207179
91 92 93 94 95 96
-0.11899486 -0.11899486 -0.11899486 0.03485129 0.03775556 -0.12891110
97 98 99 100 101 102
0.03983004 0.03983004 0.03485129 -0.04207179 -0.11899486 -0.04207179
103 104 105 106 107 108
-0.11899486 -0.11899486 -0.11899486 0.03485129 0.03775556 -0.12891110
109 110 111 112 113 114
0.03983004 0.03983004 0.03485129 -0.04207179 -0.11899486 -0.04207179
115 116 117 118 119 120
-0.11899486 -0.11899486 -0.11899486 0.03485129 0.03775556 -0.12891110
121 122 123 124 125 126
0.03983004 0.03983004 0.03485129 -0.04207179 -0.11899486 -0.04207179
127 128 129 130 131 132
-0.11899486 -0.11899486 -0.11899486 0.03485129 0.03775556 -0.12891110
133 134 135 136 137 138
0.03983004 0.03983004 0.03485129 -0.04207179 -0.11899486 -0.04207179
139 140 141 142 143 144
-0.11899486 -0.11899486 0.88100514 0.03485129 0.03775556 -0.12891110
145 146 147 148 149 150
0.03983004 0.03983004 0.03485129 -0.04207179 -0.11899486 -0.04207179
151 152 153 154
-0.11899486 0.88100514 0.88100514 0.03485129
> postscript(file="/var/wessaorg/rcomp/tmp/609711355749692.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 = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.02489378 NA
1 -0.02489378 -0.02489378
2 -0.02987253 -0.02489378
3 -0.10679561 -0.02987253
4 -0.18371869 -0.10679561
5 -0.10679561 -0.18371869
6 -0.18371869 -0.10679561
7 -0.18371869 -0.18371869
8 -0.18371869 -0.18371869
9 -0.02987253 -0.18371869
10 -0.02696826 -0.02987253
11 -0.19363493 -0.02696826
12 -0.02489378 -0.19363493
13 -0.02489378 -0.02489378
14 -0.02987253 -0.02489378
15 -0.10679561 -0.02987253
16 0.81628131 -0.10679561
17 -0.10679561 0.81628131
18 -0.18371869 -0.10679561
19 0.81628131 -0.18371869
20 -0.18371869 0.81628131
21 -0.02987253 -0.18371869
22 -0.02696826 -0.02987253
23 -0.19363493 -0.02696826
24 -0.02489378 -0.19363493
25 -0.02489378 -0.02489378
26 -0.02987253 -0.02489378
27 -0.10679561 -0.02987253
28 -0.18371869 -0.10679561
29 -0.10679561 -0.18371869
30 -0.18371869 -0.10679561
31 -0.18371869 -0.18371869
32 -0.18371869 -0.18371869
33 -0.02987253 -0.18371869
34 -0.02696826 -0.02987253
35 -0.19363493 -0.02696826
36 -0.02489378 -0.19363493
37 -0.02489378 -0.02489378
38 -0.02987253 -0.02489378
39 -0.10679561 -0.02987253
40 0.81628131 -0.10679561
41 -0.10679561 0.81628131
42 -0.18371869 -0.10679561
43 -0.18371869 -0.18371869
44 -0.18371869 -0.18371869
45 -0.02987253 -0.18371869
46 -0.02696826 -0.02987253
47 -0.19363493 -0.02696826
48 -0.02489378 -0.19363493
49 -0.02489378 -0.02489378
50 -0.02987253 -0.02489378
51 0.89320439 -0.02987253
52 -0.18371869 0.89320439
53 0.89320439 -0.18371869
54 -0.18371869 0.89320439
55 -0.18371869 -0.18371869
56 -0.18371869 -0.18371869
57 -0.02987253 -0.18371869
58 -0.02696826 -0.02987253
59 0.80636507 -0.02696826
60 -0.02489378 0.80636507
61 -0.02489378 -0.02489378
62 -0.02987253 -0.02489378
63 -0.10679561 -0.02987253
64 -0.18371869 -0.10679561
65 -0.10679561 -0.18371869
66 0.81628131 -0.10679561
67 -0.18371869 0.81628131
68 -0.18371869 -0.18371869
69 -0.02987253 -0.18371869
70 -0.02696826 -0.02987253
71 -0.19363493 -0.02696826
72 -0.02489378 -0.19363493
73 -0.02489378 -0.02489378
74 -0.02987253 -0.02489378
75 -0.10679561 -0.02987253
76 -0.18371869 -0.10679561
77 -0.10679561 -0.18371869
78 0.81628131 -0.10679561
79 -0.18371869 0.81628131
80 -0.18371869 -0.18371869
81 -0.02987253 -0.18371869
82 -0.02696826 -0.02987253
83 0.80636507 -0.02696826
84 -0.02489378 0.80636507
85 -0.02489378 -0.02489378
86 0.03485129 -0.02489378
87 -0.04207179 0.03485129
88 -0.11899486 -0.04207179
89 -0.04207179 -0.11899486
90 -0.11899486 -0.04207179
91 -0.11899486 -0.11899486
92 -0.11899486 -0.11899486
93 0.03485129 -0.11899486
94 0.03775556 0.03485129
95 -0.12891110 0.03775556
96 0.03983004 -0.12891110
97 0.03983004 0.03983004
98 0.03485129 0.03983004
99 -0.04207179 0.03485129
100 -0.11899486 -0.04207179
101 -0.04207179 -0.11899486
102 -0.11899486 -0.04207179
103 -0.11899486 -0.11899486
104 -0.11899486 -0.11899486
105 0.03485129 -0.11899486
106 0.03775556 0.03485129
107 -0.12891110 0.03775556
108 0.03983004 -0.12891110
109 0.03983004 0.03983004
110 0.03485129 0.03983004
111 -0.04207179 0.03485129
112 -0.11899486 -0.04207179
113 -0.04207179 -0.11899486
114 -0.11899486 -0.04207179
115 -0.11899486 -0.11899486
116 -0.11899486 -0.11899486
117 0.03485129 -0.11899486
118 0.03775556 0.03485129
119 -0.12891110 0.03775556
120 0.03983004 -0.12891110
121 0.03983004 0.03983004
122 0.03485129 0.03983004
123 -0.04207179 0.03485129
124 -0.11899486 -0.04207179
125 -0.04207179 -0.11899486
126 -0.11899486 -0.04207179
127 -0.11899486 -0.11899486
128 -0.11899486 -0.11899486
129 0.03485129 -0.11899486
130 0.03775556 0.03485129
131 -0.12891110 0.03775556
132 0.03983004 -0.12891110
133 0.03983004 0.03983004
134 0.03485129 0.03983004
135 -0.04207179 0.03485129
136 -0.11899486 -0.04207179
137 -0.04207179 -0.11899486
138 -0.11899486 -0.04207179
139 -0.11899486 -0.11899486
140 0.88100514 -0.11899486
141 0.03485129 0.88100514
142 0.03775556 0.03485129
143 -0.12891110 0.03775556
144 0.03983004 -0.12891110
145 0.03983004 0.03983004
146 0.03485129 0.03983004
147 -0.04207179 0.03485129
148 -0.11899486 -0.04207179
149 -0.04207179 -0.11899486
150 -0.11899486 -0.04207179
151 0.88100514 -0.11899486
152 0.88100514 0.88100514
153 0.03485129 0.88100514
154 NA 0.03485129
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.02489378 -0.02489378
[2,] -0.02987253 -0.02489378
[3,] -0.10679561 -0.02987253
[4,] -0.18371869 -0.10679561
[5,] -0.10679561 -0.18371869
[6,] -0.18371869 -0.10679561
[7,] -0.18371869 -0.18371869
[8,] -0.18371869 -0.18371869
[9,] -0.02987253 -0.18371869
[10,] -0.02696826 -0.02987253
[11,] -0.19363493 -0.02696826
[12,] -0.02489378 -0.19363493
[13,] -0.02489378 -0.02489378
[14,] -0.02987253 -0.02489378
[15,] -0.10679561 -0.02987253
[16,] 0.81628131 -0.10679561
[17,] -0.10679561 0.81628131
[18,] -0.18371869 -0.10679561
[19,] 0.81628131 -0.18371869
[20,] -0.18371869 0.81628131
[21,] -0.02987253 -0.18371869
[22,] -0.02696826 -0.02987253
[23,] -0.19363493 -0.02696826
[24,] -0.02489378 -0.19363493
[25,] -0.02489378 -0.02489378
[26,] -0.02987253 -0.02489378
[27,] -0.10679561 -0.02987253
[28,] -0.18371869 -0.10679561
[29,] -0.10679561 -0.18371869
[30,] -0.18371869 -0.10679561
[31,] -0.18371869 -0.18371869
[32,] -0.18371869 -0.18371869
[33,] -0.02987253 -0.18371869
[34,] -0.02696826 -0.02987253
[35,] -0.19363493 -0.02696826
[36,] -0.02489378 -0.19363493
[37,] -0.02489378 -0.02489378
[38,] -0.02987253 -0.02489378
[39,] -0.10679561 -0.02987253
[40,] 0.81628131 -0.10679561
[41,] -0.10679561 0.81628131
[42,] -0.18371869 -0.10679561
[43,] -0.18371869 -0.18371869
[44,] -0.18371869 -0.18371869
[45,] -0.02987253 -0.18371869
[46,] -0.02696826 -0.02987253
[47,] -0.19363493 -0.02696826
[48,] -0.02489378 -0.19363493
[49,] -0.02489378 -0.02489378
[50,] -0.02987253 -0.02489378
[51,] 0.89320439 -0.02987253
[52,] -0.18371869 0.89320439
[53,] 0.89320439 -0.18371869
[54,] -0.18371869 0.89320439
[55,] -0.18371869 -0.18371869
[56,] -0.18371869 -0.18371869
[57,] -0.02987253 -0.18371869
[58,] -0.02696826 -0.02987253
[59,] 0.80636507 -0.02696826
[60,] -0.02489378 0.80636507
[61,] -0.02489378 -0.02489378
[62,] -0.02987253 -0.02489378
[63,] -0.10679561 -0.02987253
[64,] -0.18371869 -0.10679561
[65,] -0.10679561 -0.18371869
[66,] 0.81628131 -0.10679561
[67,] -0.18371869 0.81628131
[68,] -0.18371869 -0.18371869
[69,] -0.02987253 -0.18371869
[70,] -0.02696826 -0.02987253
[71,] -0.19363493 -0.02696826
[72,] -0.02489378 -0.19363493
[73,] -0.02489378 -0.02489378
[74,] -0.02987253 -0.02489378
[75,] -0.10679561 -0.02987253
[76,] -0.18371869 -0.10679561
[77,] -0.10679561 -0.18371869
[78,] 0.81628131 -0.10679561
[79,] -0.18371869 0.81628131
[80,] -0.18371869 -0.18371869
[81,] -0.02987253 -0.18371869
[82,] -0.02696826 -0.02987253
[83,] 0.80636507 -0.02696826
[84,] -0.02489378 0.80636507
[85,] -0.02489378 -0.02489378
[86,] 0.03485129 -0.02489378
[87,] -0.04207179 0.03485129
[88,] -0.11899486 -0.04207179
[89,] -0.04207179 -0.11899486
[90,] -0.11899486 -0.04207179
[91,] -0.11899486 -0.11899486
[92,] -0.11899486 -0.11899486
[93,] 0.03485129 -0.11899486
[94,] 0.03775556 0.03485129
[95,] -0.12891110 0.03775556
[96,] 0.03983004 -0.12891110
[97,] 0.03983004 0.03983004
[98,] 0.03485129 0.03983004
[99,] -0.04207179 0.03485129
[100,] -0.11899486 -0.04207179
[101,] -0.04207179 -0.11899486
[102,] -0.11899486 -0.04207179
[103,] -0.11899486 -0.11899486
[104,] -0.11899486 -0.11899486
[105,] 0.03485129 -0.11899486
[106,] 0.03775556 0.03485129
[107,] -0.12891110 0.03775556
[108,] 0.03983004 -0.12891110
[109,] 0.03983004 0.03983004
[110,] 0.03485129 0.03983004
[111,] -0.04207179 0.03485129
[112,] -0.11899486 -0.04207179
[113,] -0.04207179 -0.11899486
[114,] -0.11899486 -0.04207179
[115,] -0.11899486 -0.11899486
[116,] -0.11899486 -0.11899486
[117,] 0.03485129 -0.11899486
[118,] 0.03775556 0.03485129
[119,] -0.12891110 0.03775556
[120,] 0.03983004 -0.12891110
[121,] 0.03983004 0.03983004
[122,] 0.03485129 0.03983004
[123,] -0.04207179 0.03485129
[124,] -0.11899486 -0.04207179
[125,] -0.04207179 -0.11899486
[126,] -0.11899486 -0.04207179
[127,] -0.11899486 -0.11899486
[128,] -0.11899486 -0.11899486
[129,] 0.03485129 -0.11899486
[130,] 0.03775556 0.03485129
[131,] -0.12891110 0.03775556
[132,] 0.03983004 -0.12891110
[133,] 0.03983004 0.03983004
[134,] 0.03485129 0.03983004
[135,] -0.04207179 0.03485129
[136,] -0.11899486 -0.04207179
[137,] -0.04207179 -0.11899486
[138,] -0.11899486 -0.04207179
[139,] -0.11899486 -0.11899486
[140,] 0.88100514 -0.11899486
[141,] 0.03485129 0.88100514
[142,] 0.03775556 0.03485129
[143,] -0.12891110 0.03775556
[144,] 0.03983004 -0.12891110
[145,] 0.03983004 0.03983004
[146,] 0.03485129 0.03983004
[147,] -0.04207179 0.03485129
[148,] -0.11899486 -0.04207179
[149,] -0.04207179 -0.11899486
[150,] -0.11899486 -0.04207179
[151,] 0.88100514 -0.11899486
[152,] 0.88100514 0.88100514
[153,] 0.03485129 0.88100514
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.02489378 -0.02489378
2 -0.02987253 -0.02489378
3 -0.10679561 -0.02987253
4 -0.18371869 -0.10679561
5 -0.10679561 -0.18371869
6 -0.18371869 -0.10679561
7 -0.18371869 -0.18371869
8 -0.18371869 -0.18371869
9 -0.02987253 -0.18371869
10 -0.02696826 -0.02987253
11 -0.19363493 -0.02696826
12 -0.02489378 -0.19363493
13 -0.02489378 -0.02489378
14 -0.02987253 -0.02489378
15 -0.10679561 -0.02987253
16 0.81628131 -0.10679561
17 -0.10679561 0.81628131
18 -0.18371869 -0.10679561
19 0.81628131 -0.18371869
20 -0.18371869 0.81628131
21 -0.02987253 -0.18371869
22 -0.02696826 -0.02987253
23 -0.19363493 -0.02696826
24 -0.02489378 -0.19363493
25 -0.02489378 -0.02489378
26 -0.02987253 -0.02489378
27 -0.10679561 -0.02987253
28 -0.18371869 -0.10679561
29 -0.10679561 -0.18371869
30 -0.18371869 -0.10679561
31 -0.18371869 -0.18371869
32 -0.18371869 -0.18371869
33 -0.02987253 -0.18371869
34 -0.02696826 -0.02987253
35 -0.19363493 -0.02696826
36 -0.02489378 -0.19363493
37 -0.02489378 -0.02489378
38 -0.02987253 -0.02489378
39 -0.10679561 -0.02987253
40 0.81628131 -0.10679561
41 -0.10679561 0.81628131
42 -0.18371869 -0.10679561
43 -0.18371869 -0.18371869
44 -0.18371869 -0.18371869
45 -0.02987253 -0.18371869
46 -0.02696826 -0.02987253
47 -0.19363493 -0.02696826
48 -0.02489378 -0.19363493
49 -0.02489378 -0.02489378
50 -0.02987253 -0.02489378
51 0.89320439 -0.02987253
52 -0.18371869 0.89320439
53 0.89320439 -0.18371869
54 -0.18371869 0.89320439
55 -0.18371869 -0.18371869
56 -0.18371869 -0.18371869
57 -0.02987253 -0.18371869
58 -0.02696826 -0.02987253
59 0.80636507 -0.02696826
60 -0.02489378 0.80636507
61 -0.02489378 -0.02489378
62 -0.02987253 -0.02489378
63 -0.10679561 -0.02987253
64 -0.18371869 -0.10679561
65 -0.10679561 -0.18371869
66 0.81628131 -0.10679561
67 -0.18371869 0.81628131
68 -0.18371869 -0.18371869
69 -0.02987253 -0.18371869
70 -0.02696826 -0.02987253
71 -0.19363493 -0.02696826
72 -0.02489378 -0.19363493
73 -0.02489378 -0.02489378
74 -0.02987253 -0.02489378
75 -0.10679561 -0.02987253
76 -0.18371869 -0.10679561
77 -0.10679561 -0.18371869
78 0.81628131 -0.10679561
79 -0.18371869 0.81628131
80 -0.18371869 -0.18371869
81 -0.02987253 -0.18371869
82 -0.02696826 -0.02987253
83 0.80636507 -0.02696826
84 -0.02489378 0.80636507
85 -0.02489378 -0.02489378
86 0.03485129 -0.02489378
87 -0.04207179 0.03485129
88 -0.11899486 -0.04207179
89 -0.04207179 -0.11899486
90 -0.11899486 -0.04207179
91 -0.11899486 -0.11899486
92 -0.11899486 -0.11899486
93 0.03485129 -0.11899486
94 0.03775556 0.03485129
95 -0.12891110 0.03775556
96 0.03983004 -0.12891110
97 0.03983004 0.03983004
98 0.03485129 0.03983004
99 -0.04207179 0.03485129
100 -0.11899486 -0.04207179
101 -0.04207179 -0.11899486
102 -0.11899486 -0.04207179
103 -0.11899486 -0.11899486
104 -0.11899486 -0.11899486
105 0.03485129 -0.11899486
106 0.03775556 0.03485129
107 -0.12891110 0.03775556
108 0.03983004 -0.12891110
109 0.03983004 0.03983004
110 0.03485129 0.03983004
111 -0.04207179 0.03485129
112 -0.11899486 -0.04207179
113 -0.04207179 -0.11899486
114 -0.11899486 -0.04207179
115 -0.11899486 -0.11899486
116 -0.11899486 -0.11899486
117 0.03485129 -0.11899486
118 0.03775556 0.03485129
119 -0.12891110 0.03775556
120 0.03983004 -0.12891110
121 0.03983004 0.03983004
122 0.03485129 0.03983004
123 -0.04207179 0.03485129
124 -0.11899486 -0.04207179
125 -0.04207179 -0.11899486
126 -0.11899486 -0.04207179
127 -0.11899486 -0.11899486
128 -0.11899486 -0.11899486
129 0.03485129 -0.11899486
130 0.03775556 0.03485129
131 -0.12891110 0.03775556
132 0.03983004 -0.12891110
133 0.03983004 0.03983004
134 0.03485129 0.03983004
135 -0.04207179 0.03485129
136 -0.11899486 -0.04207179
137 -0.04207179 -0.11899486
138 -0.11899486 -0.04207179
139 -0.11899486 -0.11899486
140 0.88100514 -0.11899486
141 0.03485129 0.88100514
142 0.03775556 0.03485129
143 -0.12891110 0.03775556
144 0.03983004 -0.12891110
145 0.03983004 0.03983004
146 0.03485129 0.03983004
147 -0.04207179 0.03485129
148 -0.11899486 -0.04207179
149 -0.04207179 -0.11899486
150 -0.11899486 -0.04207179
151 0.88100514 -0.11899486
152 0.88100514 0.88100514
153 0.03485129 0.88100514
> 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/7potp1355749692.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/8m6mr1355749692.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/9fc461355749692.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/10st451355749692.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/11p2vg1355749692.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/12pbru1355749692.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/1383t11355749692.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/149l501355749692.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/15mheo1355749692.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/16lw301355749693.tab")
+ }
>
> try(system("convert tmp/1sxmf1355749692.ps tmp/1sxmf1355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/2jnyi1355749692.ps tmp/2jnyi1355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/3x77j1355749692.ps tmp/3x77j1355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/4g04x1355749692.ps tmp/4g04x1355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/5t0081355749692.ps tmp/5t0081355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/609711355749692.ps tmp/609711355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/7potp1355749692.ps tmp/7potp1355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/8m6mr1355749692.ps tmp/8m6mr1355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/9fc461355749692.ps tmp/9fc461355749692.png",intern=TRUE))
character(0)
> try(system("convert tmp/10st451355749692.ps tmp/10st451355749692.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.504 1.310 9.822