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(88.52,90.15,88.63,88.32,88.51,88.53,88.35,88.4,88.41,88.47,88.46,89.28,89.11,90.74,89.49,88.62,89.09,89.14,89.45,89.33,89.44,89.54,89.52,90.48,90.04,91.93,91.25,89.27,90.57,90.79,90.83,90.76,91.29,91.48,91.63,92.63,91.7,93.86,92.45,92.03,92.71,93.15,92.98,92.73,93.29,93.2,93.34,93.95,93.43,95.67,94.02,93.51,94.6,94.27,94.05,94.1,94.51,94.53,94.2,93.58,94.94,96.24,95.77,94.41,95.09,95.37,95.17,95.05,95.33,95.42,95.95,96.12,96.94,98.73,98.03,97.42,98.39,98.77,98.46,98.3,98.25,98.33,98.61,98.99,98.8,100.26,100.85,98.87,99.81,100.44,100.07,99.8,99.77,99.9,100.58,100.86,101.05,101.3,101.45,101.13,101.38,101.03,100.79,100.84,101.17,101.36,101.14,101.24) > 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,] 88.52 89.11 90.04 91.70 93.43 94.94 96.94 98.80 101.05 [2,] 90.15 90.74 91.93 93.86 95.67 96.24 98.73 100.26 101.30 [3,] 88.63 89.49 91.25 92.45 94.02 95.77 98.03 100.85 101.45 [4,] 88.32 88.62 89.27 92.03 93.51 94.41 97.42 98.87 101.13 [5,] 88.51 89.09 90.57 92.71 94.60 95.09 98.39 99.81 101.38 [6,] 88.53 89.14 90.79 93.15 94.27 95.37 98.77 100.44 101.03 [7,] 88.35 89.45 90.83 92.98 94.05 95.17 98.46 100.07 100.79 [8,] 88.40 89.33 90.76 92.73 94.10 95.05 98.30 99.80 100.84 [9,] 88.41 89.44 91.29 93.29 94.51 95.33 98.25 99.77 101.17 [10,] 88.47 89.54 91.48 93.20 94.53 95.42 98.33 99.90 101.36 [11,] 88.46 89.52 91.63 93.34 94.20 95.95 98.61 100.58 101.14 [12,] 89.28 90.48 92.63 93.95 93.58 96.12 98.99 100.86 101.24 > 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] 88.66917 89.49583 91.03917 92.94917 94.20583 95.40500 98.26833 [8] 100.00083 101.15667 > arr.sd [1] 0.5292612 0.5845816 0.8794260 0.6717746 0.6066819 0.5336410 0.5799660 [8] 0.6688179 0.2062802 > arr.range [1] 1.83 2.12 3.36 2.25 2.24 1.83 2.05 2.06 0.66 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 2.30023 -0.01814 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 18.428 -4.182 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 9.79422 -0.08194 > postscript(file="/var/wessaorg/rcomp/tmp/1ncx31447949811.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/2bajz1447949811.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/3yfx71447949811.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/47j671447949811.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/5yrh11447949811.tab") > > try(system("convert tmp/1ncx31447949811.ps tmp/1ncx31447949811.png",intern=TRUE)) character(0) > try(system("convert tmp/2bajz1447949811.ps tmp/2bajz1447949811.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.882 0.142 1.022