R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(72.04,72.26,72.53,72.41,72.91,72.84,72.92,73.03,72.98,72.99,73.15,73.34,73.8,74.46,74.54,74.92,74.19,74.34,74.54,74.4,73.78,74.42,73.54,74.45,76.31,76.44,76.64,76.44,76.49,76.52,78.15,78.54,78.79,78.75,78.28,78.44,78.75,80.54,80.84,81.11,80.47,80.53,80.35,80.29,80.27,80.1,79.8,79.84,79.92,80.26,80.69,84.5,85.45,86.19,86.4,85.98,85.87,86.06,86.43,86.43,86.37,86.84,86.73,90.99,92.61,93.83,94.2,94.01,93.47,93.27,94.3,94.53,94.59,94.69,94.67,96.55,97.14,97.32,97.97,98.49,99.11,99.09,98.76,99.2,99.61,99.54,99.68,100.75,100.38,100.79,100.39,100.39,100.12,100,99.17,99.17,99.59,99.96,99.68,101.03,100.99,101.38,101.84,101.52,101.37,101.22,101.45,101.99) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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] [1,] 72.04 73.80 76.31 78.75 79.92 86.37 94.59 99.61 99.59 [2,] 72.26 74.46 76.44 80.54 80.26 86.84 94.69 99.54 99.96 [3,] 72.53 74.54 76.64 80.84 80.69 86.73 94.67 99.68 99.68 [4,] 72.41 74.92 76.44 81.11 84.50 90.99 96.55 100.75 101.03 [5,] 72.91 74.19 76.49 80.47 85.45 92.61 97.14 100.38 100.99 [6,] 72.84 74.34 76.52 80.53 86.19 93.83 97.32 100.79 101.38 [7,] 72.92 74.54 78.15 80.35 86.40 94.20 97.97 100.39 101.84 [8,] 73.03 74.40 78.54 80.29 85.98 94.01 98.49 100.39 101.52 [9,] 72.98 73.78 78.79 80.27 85.87 93.47 99.11 100.12 101.37 [10,] 72.99 74.42 78.75 80.10 86.06 93.27 99.09 100.00 101.22 [11,] 73.15 73.54 78.28 79.80 86.43 94.30 98.76 99.17 101.45 [12,] 73.34 74.45 78.44 79.84 86.43 94.53 99.20 99.17 101.99 > 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] 72.78333 74.28167 77.48250 80.24083 84.51500 91.76250 97.29833 [8] 99.99917 101.00167 > arr.sd [1] 0.3878222 0.3907762 1.0703621 0.5994461 2.6074491 3.2263746 1.8027345 [8] 0.5635514 0.8147150 > arr.range [1] 1.30 1.38 2.48 2.36 6.51 8.16 4.61 1.62 2.40 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -0.98890 0.02613 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -11.283 2.524 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -1.92446 0.06177 > postscript(file="/var/wessaorg/rcomp/tmp/1wq1q1448046730.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/2ssyx1448046730.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/3mx9f1448046730.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/4qp221448046730.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/5ir6h1448046730.tab") > > try(system("convert tmp/1wq1q1448046730.ps tmp/1wq1q1448046730.png",intern=TRUE)) character(0) > try(system("convert tmp/2ssyx1448046730.ps tmp/2ssyx1448046730.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.879 0.165 1.045