R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" 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(29054.50 + ,28543.50 + ,28032.00 + ,27009.50 + ,37356.00 + ,36844.50 + ,29054.50 + ,23881.50 + ,24392.50 + ,24392.50 + ,24904.00 + ,25982.00 + ,22859.00 + ,19731.00 + ,17169.50 + ,17169.50 + ,27009.50 + ,28032.00 + ,20242.00 + ,11429.50 + ,16091.50 + ,16091.50 + ,19731.00 + ,21831.50 + ,21320.00 + ,16091.50 + ,18708.50 + ,17681.00 + ,26493.50 + ,24392.50 + ,16091.50 + ,9891.00 + ,15580.00 + ,17169.50 + ,18708.50 + ,20753.50 + ,16602.50 + ,13019.00 + ,14558.00 + ,15069.00 + ,28543.50 + ,28543.50 + ,20753.50 + ,19731.00 + ,22859.00 + ,21320.00 + ,25471.00 + ,30644.00 + ,31671.50 + ,24392.50 + ,22342.50 + ,20242.00 + ,34283.50 + ,35311.00 + ,32694.00 + ,35311.00 + ,34794.50 + ,30644.00 + ,35311.00 + ,40484.00 + ,42584.50 + ,36333.50 + ,32182.50 + ,35311.00 + ,48785.00 + ,52936.00 + ,51913.50 + ,53958.00 + ,53447.00 + ,48274.00 + ,57086.50 + ,59187.00 + ,62259.50 + ,52936.00 + ,49296.50 + ,53447.00 + ,63337.50 + ,72150.00 + ,70049.50 + ,70049.50 + ,71077.00 + ,67488.00 + ,76817.00 + ,76817.00 + ,75227.50 + ,66410.00 + ,67999.50 + ,69027.00 + ,75789.50 + ,84602.00 + ,78350.50 + ,81479.00 + ,78862.00 + ,77328.00 + ,89269.00 + ,86652.00 + ,83012.50 + ,77839.50 + ,83012.50 + ,85629.50 + ,88752.50 + ,92903.00 + ,88752.50 + ,91314.00 + ,88190.50 + ,87679.50 + ,100642.50 + ,101720.50 + ,97570.00 + ,90291.50 + ,96492.00 + ,99104.00 + ,102232.00 + ,106894.00 + ,102232.00 + ,105871.50 + ,104282.00 + ,98592.50 + ,110533.00 + ,110533.00) > 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] [1,] 29054.5 22859.0 21320.0 16602.5 31671.5 42584.5 62259.5 75227.5 83012.5 [2,] 28543.5 19731.0 16091.5 13019.0 24392.5 36333.5 52936.0 66410.0 77839.5 [3,] 28032.0 17169.5 18708.5 14558.0 22342.5 32182.5 49296.5 67999.5 83012.5 [4,] 27009.5 17169.5 17681.0 15069.0 20242.0 35311.0 53447.0 69027.0 85629.5 [5,] 37356.0 27009.5 26493.5 28543.5 34283.5 48785.0 63337.5 75789.5 88752.5 [6,] 36844.5 28032.0 24392.5 28543.5 35311.0 52936.0 72150.0 84602.0 92903.0 [7,] 29054.5 20242.0 16091.5 20753.5 32694.0 51913.5 70049.5 78350.5 88752.5 [8,] 23881.5 11429.5 9891.0 19731.0 35311.0 53958.0 70049.5 81479.0 91314.0 [9,] 24392.5 16091.5 15580.0 22859.0 34794.5 53447.0 71077.0 78862.0 88190.5 [10,] 24392.5 16091.5 17169.5 21320.0 30644.0 48274.0 67488.0 77328.0 87679.5 [11,] 24904.0 19731.0 18708.5 25471.0 35311.0 57086.5 76817.0 89269.0 100642.5 [12,] 25982.0 21831.5 20753.5 30644.0 40484.0 59187.0 76817.0 86652.0 101720.5 [,10] [1,] 97570.0 [2,] 90291.5 [3,] 96492.0 [4,] 99104.0 [5,] 102232.0 [6,] 106894.0 [7,] 102232.0 [8,] 105871.5 [9,] 104282.0 [10,] 98592.5 [11,] 110533.0 [12,] 110533.0 > 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] 28287.25 19782.29 18573.42 21426.17 31456.79 47666.54 65477.04 [8] 77583.00 89120.75 102052.29 > arr.sd [1] 4521.855 4717.844 4352.163 5951.057 6076.552 8987.650 9330.671 7287.561 [9] 6927.618 6006.785 > arr.range [1] 13474.5 16602.5 16602.5 17625.0 20242.0 27004.5 27520.5 22859.0 23881.0 [10] 20241.5 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 5052.1906 0.0272 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 5.8863 0.2678 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 1.628e+04 8.623e-02 > postscript(file="/var/wessaorg/rcomp/tmp/1si4k1470783743.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/2ezr01470783743.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/35n1i1470783743.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/4atn11470783743.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/5yvjo1470783743.tab") > > try(system("convert tmp/1si4k1470783743.ps tmp/1si4k1470783743.png",intern=TRUE)) character(0) > try(system("convert tmp/2ezr01470783743.ps tmp/2ezr01470783743.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.888 0.062 0.966