R version 2.12.0 (2010-10-15) Copyright (C) 2010 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 <- c(6.4,7.7,9.2,8.6,7.4,8.6,6.2,6,6.6,5.1,4.7,5,3.6,1.9,-0.1,-5.7,-5.6,-6.4,-7.7,-8,-11.9,-15.4,-15.5,-13.4,-10.9,-10.8,-7.3,-6.5,-5.1,-5.3,-6.8,-8.4,-8.4,-9.7,-8.8,-9.6,-11.5,-11,-14.9,-16.2,-14.4,-17.3,-15.7,-12.6,-9.4,-8.1,-5.4,-4.6,-4.9,-4,-3.1,-1.3,0,-0.4,3,0.4,1.2,0.6,-1.3,-3.2,-1.8,-3.6,-4.2,-6.9,-8,-7.5,-8.2,-7.6,-3.7,-1.7,-0.7,0.2,0.6,2.2,3.3,5.3,5.5,6.3,7.7,6.5,5.5,6.9,5.7,6.9,6.1,4.8,3.7,5.8,6.8,8.5,7.2,5,4.7,2.3,2.4,0.1,1.9,1.7,2,-1.9,0.5,-1.3,-3.3,-2.8,-8,-13.9,-21.9,-28.8,-27.6,-31.4,-31.8,-29.4,-27.6,-23.6,-22.8,-18.2,-17.8,-14.2,-8.8,-7.9,-7,-7,-3.6,-2.4,-4.9,-7.7,-6.5,-5.1,-3.4,-2.8,0.8) > par1 = '12' > #'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!) > par1 <- as.numeric(par1) > (n <- length(x)) [1] 131 > (np <- floor(n / par1)) [1] 10 > 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] [1,] 6.4 3.6 -10.9 -11.5 -4.9 -1.8 0.6 6.1 1.9 -27.6 [2,] 7.7 1.9 -10.8 -11.0 -4.0 -3.6 2.2 4.8 1.7 -31.4 [3,] 9.2 -0.1 -7.3 -14.9 -3.1 -4.2 3.3 3.7 2.0 -31.8 [4,] 8.6 -5.7 -6.5 -16.2 -1.3 -6.9 5.3 5.8 -1.9 -29.4 [5,] 7.4 -5.6 -5.1 -14.4 0.0 -8.0 5.5 6.8 0.5 -27.6 [6,] 8.6 -6.4 -5.3 -17.3 -0.4 -7.5 6.3 8.5 -1.3 -23.6 [7,] 6.2 -7.7 -6.8 -15.7 3.0 -8.2 7.7 7.2 -3.3 -22.8 [8,] 6.0 -8.0 -8.4 -12.6 0.4 -7.6 6.5 5.0 -2.8 -18.2 [9,] 6.6 -11.9 -8.4 -9.4 1.2 -3.7 5.5 4.7 -8.0 -17.8 [10,] 5.1 -15.4 -9.7 -8.1 0.6 -1.7 6.9 2.3 -13.9 -14.2 [11,] 4.7 -15.5 -8.8 -5.4 -1.3 -0.7 5.7 2.4 -21.9 -8.8 [12,] 5.0 -13.4 -9.6 -4.6 -3.2 0.2 6.9 0.1 -28.8 -7.9 > 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] 6.791667 -7.016667 -8.133333 -11.758333 -1.083333 -4.475000 [7] 5.200000 4.783333 -6.316667 -21.758333 > arr.sd [1] 1.512048 6.413456 1.961601 4.208100 2.340875 3.067461 2.113592 [8] 2.364446 10.100570 8.368497 > arr.range [1] 4.5 19.1 5.8 12.7 7.9 8.4 7.1 8.4 30.8 23.9 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 3.2706 -0.2227 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 2.846 -1.270 Warning message: In log(arr.mean) : NaNs produced > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 10.2015 -0.6074 > postscript(file="/var/www/rcomp/tmp/19cd61293199498.ps",horizontal=F,onefile=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/rcomp/tmp/29cd61293199498.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/3uccc1293199498.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/rcomp/tmp/4xvsi1293199498.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/rcomp/tmp/5jv9o1293199498.tab") > > try(system("convert tmp/19cd61293199498.ps tmp/19cd61293199498.png",intern=TRUE)) character(0) > try(system("convert tmp/29cd61293199498.ps tmp/29cd61293199498.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.59 0.40 0.98