R version 3.2.4 (2016-03-10) -- "Very Secure Dishes" 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(92.09,93.77,94.44,94.91,94.78,94.51,94.36,96.6,96.72,96.71,97.44,97.83,98.92,97.98,98.76,99.76,99.87,100.09,100.07,99.46,100.4,101.25,102.29,102.1,105.91,108.95,110.07,109.92,109.87,110.54,110.79,110.32,110.76,110.24,110.27,110.11,110.39,111.05,110.85,110.24,108.7,109.93,109.53,109.83,107.86,104.61,103.61,103.11,102.59,102.91,101.94,101.8,102.25,102.6,102.49,102.13,100.76,100.86,101.12,100.74,99.99,99.39,99.52,99.21,99.38,99.37,99.38,99.26,99.36,99.2,98.53,98.65,99.15,100.17,99.98,100.07,99.94,100.05,99.13,98.74,98.64,98.44,98.81,98.88,99.63,100.08,100.07,100.55,99.98,99.89,99.86,99.61,100.12,100.24,100.1,99.86,97.99,97.57,98.28,97.97,97.99,97.84,97.33,96.7,96.79,96.76,96.23,96.29,96.46,97.23,97.59,97.13,97.37,96.12,96.96,96.7,97,97.15,96.51,96.68) > 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] 120 > (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,] 92.09 98.92 105.91 110.39 102.59 99.99 99.15 99.63 97.99 96.46 [2,] 93.77 97.98 108.95 111.05 102.91 99.39 100.17 100.08 97.57 97.23 [3,] 94.44 98.76 110.07 110.85 101.94 99.52 99.98 100.07 98.28 97.59 [4,] 94.91 99.76 109.92 110.24 101.80 99.21 100.07 100.55 97.97 97.13 [5,] 94.78 99.87 109.87 108.70 102.25 99.38 99.94 99.98 97.99 97.37 [6,] 94.51 100.09 110.54 109.93 102.60 99.37 100.05 99.89 97.84 96.12 [7,] 94.36 100.07 110.79 109.53 102.49 99.38 99.13 99.86 97.33 96.96 [8,] 96.60 99.46 110.32 109.83 102.13 99.26 98.74 99.61 96.70 96.70 [9,] 96.72 100.40 110.76 107.86 100.76 99.36 98.64 100.12 96.79 97.00 [10,] 96.71 101.25 110.24 104.61 100.86 99.20 98.44 100.24 96.76 97.15 [11,] 97.44 102.29 110.27 103.61 101.12 98.53 98.81 100.10 96.23 96.51 [12,] 97.83 102.10 110.11 103.11 100.74 98.65 98.88 99.86 96.29 96.68 > 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] 95.34667 100.07917 109.81250 108.30917 101.84917 99.27000 99.33333 [8] 99.99917 97.31167 96.90833 > arr.sd [1] 1.7046372 1.2956182 1.3203039 2.8858320 0.7877177 0.3787779 0.6555821 [8] 0.2587543 0.7262586 0.4238961 > arr.range [1] 5.74 4.31 4.88 7.94 2.17 1.46 1.73 0.94 2.05 1.47 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -7.9695 0.0894 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -34.425 7.419 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -22.94 0.26 > postscript(file="/var/wessaorg/rcomp/tmp/1dqht1458629666.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/2k2l91458629666.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/3k8gk1458629666.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/4u2ly1458629666.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/5ykxx1458629666.tab") > > try(system("convert tmp/1dqht1458629666.ps tmp/1dqht1458629666.png",intern=TRUE)) character(0) > try(system("convert tmp/2k2l91458629666.ps tmp/2k2l91458629666.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.832 0.159 0.988