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(96.44,96.35,96.4,96.66,96.95,97.14,97.27,97.34,97.42,97.47,97.29,97.36,97.47,97.48,97.84,97.9,97.53,97.61,97.73,97.76,97.87,97.85,98.13,98.21,98.3,98.34,98.38,98.42,98.16,98.18,98.22,98.29,98.45,98.54,98.54,98.78,98.84,99.14,99.2,99.33,98.56,98.65,98.77,98.82,98.9,98.89,98.9,99.07,99.09,99.12,99.03,99,99.21,99.35,99.37,99.39,99.41,99.43,99.6,99.73,99.78,99.8,99.88,99.74,100.15,100.27,100.26,100.36,100.37,100.54,99.8,99.82,99.82,99.82,99.67,99.78,99.44,99.61,99.71,99.71,99.77,99.77,99.89,99.96,100.02,100,100.04,99.99,99.97,99.77,99.93,99.9,100.01,100.08,100.21,100.28,100.48,100.72,100.74,100.88,101.03,101.47,101.46,101.46,101.45,101.74,102.41,102.54,102.67,102.87,102.9,102.88,102.82,102.94,102.97,103.01,103.11,103.21,104.66,104.79) > 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,] 96.44 97.47 98.30 98.84 99.09 99.78 99.82 100.02 100.48 102.67 [2,] 96.35 97.48 98.34 99.14 99.12 99.80 99.82 100.00 100.72 102.87 [3,] 96.40 97.84 98.38 99.20 99.03 99.88 99.67 100.04 100.74 102.90 [4,] 96.66 97.90 98.42 99.33 99.00 99.74 99.78 99.99 100.88 102.88 [5,] 96.95 97.53 98.16 98.56 99.21 100.15 99.44 99.97 101.03 102.82 [6,] 97.14 97.61 98.18 98.65 99.35 100.27 99.61 99.77 101.47 102.94 [7,] 97.27 97.73 98.22 98.77 99.37 100.26 99.71 99.93 101.46 102.97 [8,] 97.34 97.76 98.29 98.82 99.39 100.36 99.71 99.90 101.46 103.01 [9,] 97.42 97.87 98.45 98.90 99.41 100.37 99.77 100.01 101.45 103.11 [10,] 97.47 97.85 98.54 98.89 99.43 100.54 99.77 100.08 101.74 103.21 [11,] 97.29 98.13 98.54 98.90 99.60 99.80 99.89 100.21 102.41 104.66 [12,] 97.36 98.21 98.78 99.07 99.73 99.82 99.96 100.28 102.54 104.79 > 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] 97.00750 97.78167 98.38333 98.92250 99.31083 100.06417 99.74583 [8] 100.01667 101.36500 103.23583 > arr.sd [1] 0.4298652 0.2371740 0.1777809 0.2257160 0.2267341 0.2883325 0.1349383 [8] 0.1336436 0.6457483 0.7093974 > arr.range [1] 1.12 0.74 0.62 0.77 0.73 0.80 0.52 0.51 2.06 2.12 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -6.6006 0.0695 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -70.61 15.06 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -21.2533 0.2235 > postscript(file="/var/wessaorg/rcomp/tmp/1qpjm1458316475.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/2m5s11458316475.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/37uqm1458316475.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/4upmw1458316475.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/5et5f1458316475.tab") > > try(system("convert tmp/1qpjm1458316475.ps tmp/1qpjm1458316475.png",intern=TRUE)) character(0) > try(system("convert tmp/2m5s11458316475.ps tmp/2m5s11458316475.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.975 0.189 1.165