R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(14620,16005,16683,15487,15684,15962,12000,13769,14031,16078,15827,13149,15969,16628,16670,16487,16883,16201,12168,14010,16556,17404,16435,13123,16744,17410,16484,17103,17301,17301,12843,13748,16904,17342,15476,15424,15988,19244,18715,17780,17160,17349,11171,13438,16713,18369,17067,14055,15500,18475,19423,18686,19646,19733,12605,16616,19156,21348,20049,18020,20262,21789,20603,21928,21025,19346,11786,19082,20127,20217,20385,16653,13065,20275,21776,20260,22523,23033,14133,20110,19682,22197,17212,11784,15467,17002,15952,18767,20605,19809,14233,19311,20827,23388,20181,14344) > par1 = '4' > par1 <- as.numeric(par1) > (n <- length(x)) [1] 96 > (np <- floor(n / par1)) [1] 24 > arr <- array(NA,dim=c(par1,np)) > j <- 0 > k <- 1 > for (i in 1:(np*par1)) + { + j = j + 1 + arr[j,k] <- x[i] + if (j == par1) { + j = 0 + k=k+1 + } + } > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 14620 15684 14031 15969 16883 16556 16744 17301 16904 15988 17160 16713 [2,] 16005 15962 16078 16628 16201 17404 17410 17301 17342 19244 17349 18369 [3,] 16683 12000 15827 16670 12168 16435 16484 12843 15476 18715 11171 17067 [4,] 15487 13769 13149 16487 14010 13123 17103 13748 15424 17780 13438 14055 [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [1,] 15500 19646 19156 20262 21025 20127 13065 22523 19682 15467 20605 20827 [2,] 18475 19733 21348 21789 19346 20217 20275 23033 22197 17002 19809 23388 [3,] 19423 12605 20049 20603 11786 20385 21776 14133 17212 15952 14233 20181 [4,] 18686 16616 18020 21928 19082 16653 20260 20110 11784 18767 19311 14344 > arr.mean <- array(NA,dim=np) > arr.sd <- array(NA,dim=np) > arr.range <- array(NA,dim=np) > for (j in 1:np) + { + arr.mean[j] <- mean(arr[,j],na.rm=TRUE) + arr.sd[j] <- sd(arr[,j],na.rm=TRUE) + arr.range[j] <- max(arr[,j],na.rm=TRUE) - min(arr[,j],na.rm=TRUE) + } > arr.mean [1] 15698.75 14353.75 14771.25 16438.50 14815.50 15879.50 16935.25 15298.25 [9] 16286.50 17931.75 14779.50 16551.00 18021.00 17150.00 19643.25 21145.50 [17] 17809.75 19345.50 18844.00 19949.75 17718.75 16797.00 18489.50 19685.00 > arr.sd [1] 870.0722 1847.3499 1414.4338 322.6376 2148.8177 1887.5579 405.6808 [8] 2341.9040 982.5482 1430.2299 3004.9961 1809.9392 1729.1025 3358.7739 [15] 1407.4988 836.9144 4106.9892 1798.1816 3917.7494 4082.0055 4449.2369 [22] 1461.2609 2887.2752 3820.5004 > arr.range [1] 2063 3962 2929 701 4715 4281 926 4458 1918 3256 6178 4314 [13] 3923 7128 3328 1666 9239 3732 8711 8900 10413 3300 6372 9044 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -557.6870 0.1586 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -2.511 1.026 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -2118.6547 0.4014 > postscript(file="/var/www/html/rcomp/tmp/13g8s1243891807.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.mean,arr.sd,main='Standard Deviation-Mean Plot',xlab='mean',ylab='standard deviation') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2li7r1243891807.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.mean,arr.range,main='Range-Mean Plot',xlab='mean',ylab='range') > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Standard Deviation-Mean Plot',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Section',header=TRUE) > a<-table.element(a,'Mean',header=TRUE) > a<-table.element(a,'Standard Deviation',header=TRUE) > a<-table.element(a,'Range',header=TRUE) > a<-table.row.end(a) > for (j in 1:np) { + a<-table.row.start(a) + a<-table.element(a,j,header=TRUE) + a<-table.element(a,arr.mean[j]) + a<-table.element(a,arr.sd[j] ) + a<-table.element(a,arr.range[j] ) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3i3ub1243891807.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Regression: S.E.(k) = alpha + beta * Mean(k)',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'alpha',header=TRUE) > a<-table.element(a,lm1$coefficients[[1]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'beta',header=TRUE) > a<-table.element(a,lm1$coefficients[[2]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,summary(lm1)$coefficients[2,2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,summary(lm1)$coefficients[2,3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'p-value',header=TRUE) > a<-table.element(a,summary(lm1)$coefficients[2,4]) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/43hs81243891807.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Regression: ln S.E.(k) = alpha + beta * ln Mean(k)',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'alpha',header=TRUE) > a<-table.element(a,lnlm1$coefficients[[1]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'beta',header=TRUE) > a<-table.element(a,lnlm1$coefficients[[2]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,summary(lnlm1)$coefficients[2,2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,summary(lnlm1)$coefficients[2,3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'p-value',header=TRUE) > a<-table.element(a,summary(lnlm1)$coefficients[2,4]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Lambda',header=TRUE) > a<-table.element(a,1-lnlm1$coefficients[[2]]) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/5fmkk1243891807.tab") > > system("convert tmp/13g8s1243891807.ps tmp/13g8s1243891807.png") > system("convert tmp/2li7r1243891807.ps tmp/2li7r1243891807.png") > > > proc.time() user system elapsed 0.520 0.283 0.624