R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(1.56,1.56,1.54,1.54,1.54,1.54,1.57,1.58,1.57,1.57,1.57,1.57,1.56,1.58,1.58,1.58,1.58,1.53,1.48,1.48,1.48,1.48,1.48,1.57,1.57,1.57,1.60,1.60,1.65,1.71,1.71,1.71,1.74,1.78,1.84,1.84,1.76,1.72,1.66,1.65,1.66,1.66,1.66,1.61,1.55,1.56,1.55,1.55,1.61,1.54,1.48,1.42,1.42,1.42,1.43,1.46,1.50,1.47,1.43,1.42,1.39,1.37,1.38,1.51,1.47,1.47,1.53,1.55,1.50,1.52,1.53,1.53,1.52,1.60,1.52,1.64,1.63,1.69,1.73,1.69,1.61,1.52,1.55,1.56,1.56,1.56,1.54,1.53,1.54,1.48,1.38,1.34,1.28,1.28,1.30,1.31,1.31,1.31,1.32,1.31,1.27,1.24,1.24,1.24,1.24,1.24,1.24,1.24,1.23,1.26,1.28,1.32,1.40,1.41,1.37,1.33,1.33,1.34,1.34,1.38,1.43,1.39,1.33,1.33,1.34,1.38,1.37,1.38,1.31,1.38,1.30,1.30,1.29,1.31,1.31,1.32,1.31,1.30,1.31,1.33,1.34,1.42,1.42,1.36,1.36,1.34,1.34,1.33,1.31,1.25,1.23,1.17,1.19,1.19,1.19,1.19) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P. (2012), Standard Deviation-Mean Plot (v1.0.6) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_smp.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 156 > (np <- floor(n / par1)) [1] 13 > 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] [,13] [1,] 1.56 1.56 1.57 1.76 1.61 1.39 1.52 1.56 1.31 1.23 1.43 1.29 1.36 [2,] 1.56 1.58 1.57 1.72 1.54 1.37 1.60 1.56 1.31 1.26 1.39 1.31 1.34 [3,] 1.54 1.58 1.60 1.66 1.48 1.38 1.52 1.54 1.32 1.28 1.33 1.31 1.34 [4,] 1.54 1.58 1.60 1.65 1.42 1.51 1.64 1.53 1.31 1.32 1.33 1.32 1.33 [5,] 1.54 1.58 1.65 1.66 1.42 1.47 1.63 1.54 1.27 1.40 1.34 1.31 1.31 [6,] 1.54 1.53 1.71 1.66 1.42 1.47 1.69 1.48 1.24 1.41 1.38 1.30 1.25 [7,] 1.57 1.48 1.71 1.66 1.43 1.53 1.73 1.38 1.24 1.37 1.37 1.31 1.23 [8,] 1.58 1.48 1.71 1.61 1.46 1.55 1.69 1.34 1.24 1.33 1.38 1.33 1.17 [9,] 1.57 1.48 1.74 1.55 1.50 1.50 1.61 1.28 1.24 1.33 1.31 1.34 1.19 [10,] 1.57 1.48 1.78 1.56 1.47 1.52 1.52 1.28 1.24 1.34 1.38 1.42 1.19 [11,] 1.57 1.48 1.84 1.55 1.43 1.53 1.55 1.30 1.24 1.34 1.30 1.42 1.19 [12,] 1.57 1.57 1.84 1.55 1.42 1.53 1.56 1.31 1.24 1.38 1.30 1.36 1.19 > 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] 1.559167 1.531667 1.693333 1.632500 1.466667 1.479167 1.605000 1.425000 [9] 1.266667 1.332500 1.353333 1.335000 1.257500 > arr.sd [1] 0.01505042 0.04764134 0.09689107 0.06969088 0.05928871 0.06444989 [7] 0.07305042 0.11950656 0.03498918 0.05479300 0.04097301 0.04379705 [13] 0.07312816 > arr.range [1] 0.04 0.10 0.27 0.21 0.19 0.18 0.21 0.28 0.08 0.18 0.13 0.13 0.19 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -0.009415 0.048351 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -3.2054 0.8129 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -0.04631 0.14743 > postscript(file="/var/wessaorg/rcomp/tmp/1rfjm1483968027.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/wessaorg/rcomp/tmp/2rlqv1483968027.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/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,'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/wessaorg/rcomp/tmp/3cw411483968027.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/wessaorg/rcomp/tmp/4trn21483968027.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/wessaorg/rcomp/tmp/5iwz21483968027.tab") > > try(system("convert tmp/1rfjm1483968027.ps tmp/1rfjm1483968027.png",intern=TRUE)) character(0) > try(system("convert tmp/2rlqv1483968027.ps tmp/2rlqv1483968027.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.879 0.072 0.988