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(7263.63 + ,7135.88 + ,7008.00 + ,6752.38 + ,9339.00 + ,9211.13 + ,7263.63 + ,5970.38 + ,6098.13 + ,6098.13 + ,6226.00 + ,6495.50 + ,5714.75 + ,4932.75 + ,4292.38 + ,4292.38 + ,6752.38 + ,7008.00 + ,5060.50 + ,2857.38 + ,4022.88 + ,4022.88 + ,4932.75 + ,5457.88 + ,5330.00 + ,4022.88 + ,4677.13 + ,4420.25 + ,6623.38 + ,6098.13 + ,4022.88 + ,2472.75 + ,3895.00 + ,4292.38 + ,4677.13 + ,5188.38 + ,4150.63 + ,3254.75 + ,3639.50 + ,3767.25 + ,7135.88 + ,7135.88 + ,5188.38 + ,4932.75 + ,5714.75 + ,5330.00 + ,6367.75 + ,7661.00 + ,7917.88 + ,6098.13 + ,5585.63 + ,5060.50 + ,8570.88 + ,8827.75 + ,8173.50 + ,8827.75 + ,8698.63 + ,7661.00 + ,8827.75 + ,10121.00 + ,10646.13 + ,9083.38 + ,8045.63 + ,8827.75 + ,12196.25 + ,13234.00 + ,12978.38 + ,13489.50 + ,13361.75 + ,12068.50 + ,14271.63 + ,14796.75 + ,15564.88 + ,13234.00 + ,12324.13 + ,13361.75 + ,15834.38 + ,18037.50 + ,17512.38 + ,17512.38 + ,17769.25 + ,16872.00 + ,19204.25 + ,19204.25 + ,18806.88 + ,16602.50 + ,16999.88 + ,17256.75 + ,18947.38 + ,21150.50 + ,19587.63 + ,20369.75 + ,19715.50 + ,19332.00 + ,22317.25 + ,21663.00 + ,20753.13 + ,19459.88 + ,20753.13 + ,21407.38 + ,22188.13 + ,23225.75 + ,22188.13 + ,22828.50 + ,22047.63 + ,21919.88 + ,25160.63 + ,25430.13 + ,24392.50 + ,22572.88 + ,24123.00 + ,24776.00 + ,25558.00 + ,26723.50 + ,25558.00 + ,26467.88 + ,26070.50 + ,24648.13 + ,27633.25 + ,27633.25) > 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] [1,] 7263.63 5714.75 5330.00 4150.63 7917.88 10646.13 15564.88 18806.88 [2,] 7135.88 4932.75 4022.88 3254.75 6098.13 9083.38 13234.00 16602.50 [3,] 7008.00 4292.38 4677.13 3639.50 5585.63 8045.63 12324.13 16999.88 [4,] 6752.38 4292.38 4420.25 3767.25 5060.50 8827.75 13361.75 17256.75 [5,] 9339.00 6752.38 6623.38 7135.88 8570.88 12196.25 15834.38 18947.38 [6,] 9211.13 7008.00 6098.13 7135.88 8827.75 13234.00 18037.50 21150.50 [7,] 7263.63 5060.50 4022.88 5188.38 8173.50 12978.38 17512.38 19587.63 [8,] 5970.38 2857.38 2472.75 4932.75 8827.75 13489.50 17512.38 20369.75 [9,] 6098.13 4022.88 3895.00 5714.75 8698.63 13361.75 17769.25 19715.50 [10,] 6098.13 4022.88 4292.38 5330.00 7661.00 12068.50 16872.00 19332.00 [11,] 6226.00 4932.75 4677.13 6367.75 8827.75 14271.63 19204.25 22317.25 [12,] 6495.50 5457.88 5188.38 7661.00 10121.00 14796.75 19204.25 21663.00 [,9] [,10] [1,] 20753.13 24392.50 [2,] 19459.88 22572.88 [3,] 20753.13 24123.00 [4,] 21407.38 24776.00 [5,] 22188.13 25558.00 [6,] 23225.75 26723.50 [7,] 22188.13 25558.00 [8,] 22828.50 26467.88 [9,] 22047.63 26070.50 [10,] 21919.88 24648.13 [11,] 25160.63 27633.25 [12,] 25430.13 27633.25 > 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] 7071.816 4945.576 4643.358 5356.543 7864.200 11916.637 16369.263 [8] 19395.752 22280.192 25513.074 > arr.sd [1] 1130.463 1179.460 1088.042 1487.765 1519.137 2246.912 2332.667 1821.889 [9] 1731.904 1501.695 > arr.range [1] 3368.62 4150.62 4150.63 4406.25 5060.50 6751.12 6880.12 5714.75 5970.25 [10] 5060.37 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 1263.0477 0.0272 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 4.8712 0.2678 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 4.070e+03 8.623e-02 > postscript(file="/var/wessaorg/rcomp/tmp/1p8v71470817877.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/2glbr1470817877.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/3d6x91470817877.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/40m351470817877.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/5cq441470817877.tab") > > try(system("convert tmp/1p8v71470817877.ps tmp/1p8v71470817877.png",intern=TRUE)) character(0) > try(system("convert tmp/2glbr1470817877.ps tmp/2glbr1470817877.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.892 0.072 0.981