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(40927.00 + ,40856.00 + ,40778.00 + ,40635.00 + ,42103.00 + ,42032.00 + ,40927.00 + ,40194.00 + ,40265.00 + ,40265.00 + ,40336.00 + ,40486.00 + ,40856.00 + ,40414.00 + ,40856.00 + ,40486.00 + ,41661.00 + ,42181.00 + ,39973.00 + ,39381.00 + ,39894.00 + ,39823.00 + ,39381.00 + ,39453.00 + ,40336.00 + ,40194.00 + ,40336.00 + ,40336.00 + ,41298.00 + ,41440.00 + ,38790.00 + ,38790.00 + ,39823.00 + ,39310.00 + ,38427.00 + ,38790.00 + ,39674.00 + ,39232.00 + ,39161.00 + ,38206.00 + ,39602.00 + ,39894.00 + ,37023.00 + ,36952.00 + ,38427.00 + ,37615.00 + ,36218.00 + ,36810.00 + ,37465.00 + ,37615.00 + ,37173.00 + ,36290.00 + ,38128.00 + ,38128.00 + ,34893.00 + ,34673.00 + ,35556.00 + ,33939.00 + ,32314.00 + ,32835.00 + ,33939.00 + ,33055.00 + ,32464.00 + ,31210.00 + ,32906.00 + ,32977.00 + ,29743.00 + ,29664.00 + ,30256.00 + ,28418.00 + ,26430.00 + ,27235.00 + ,28339.00 + ,27164.00 + ,27093.00 + ,25910.00 + ,27826.00 + ,28197.00 + ,24585.00 + ,23780.00 + ,24293.00 + ,22305.00 + ,20246.00 + ,20909.00 + ,22156.00 + ,20688.00 + ,20909.00 + ,20026.00 + ,21864.00 + ,22084.00 + ,17668.00 + ,17375.00 + ,18180.00 + ,16050.00 + ,14134.00 + ,14797.00 + ,16414.00 + ,14504.00 + ,14355.00 + ,12880.00 + ,14504.00 + ,15017.00 + ,10451.00 + ,10451.00 + ,11113.00 + ,9347.00 + ,7359.00 + ,8392.00 + ,10230.00 + ,8242.00 + ,9055.00 + ,7950.00 + ,9717.00 + ,10308.00 + ,5592.00 + ,5229.00 + ,5963.00 + ,4196.00 + ,2800.00 + ,3384.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] [,10] [1,] 40927 40856 40336 39674 37465 33939 28339 22156 16414 10230 [2,] 40856 40414 40194 39232 37615 33055 27164 20688 14504 8242 [3,] 40778 40856 40336 39161 37173 32464 27093 20909 14355 9055 [4,] 40635 40486 40336 38206 36290 31210 25910 20026 12880 7950 [5,] 42103 41661 41298 39602 38128 32906 27826 21864 14504 9717 [6,] 42032 42181 41440 39894 38128 32977 28197 22084 15017 10308 [7,] 40927 39973 38790 37023 34893 29743 24585 17668 10451 5592 [8,] 40194 39381 38790 36952 34673 29664 23780 17375 10451 5229 [9,] 40265 39894 39823 38427 35556 30256 24293 18180 11113 5963 [10,] 40265 39823 39310 37615 33939 28418 22305 16050 9347 4196 [11,] 40336 39381 38427 36218 32314 26430 20246 14134 7359 2800 [12,] 40486 39453 38790 36810 32835 27235 20909 14797 8392 3384 > 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] 40817.000 40363.250 39822.500 38234.500 35750.750 30691.417 25053.917 [8] 18827.583 12065.583 6888.833 > arr.sd [1] 641.6489 900.2103 1005.9239 1285.5570 2035.1635 2469.6734 2827.9942 [8] 2860.3301 2932.1890 2697.6386 > arr.range [1] 1909 2800 3013 3676 5814 7509 8093 8022 9055 7508 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 3764.21911 -0.06234 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 14.0305 -0.6484 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 10870.9388 -0.1778 > postscript(file="/var/wessaorg/rcomp/tmp/1eejb1470935325.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/28pbe1470935325.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/3fplq1470935325.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/47wnv1470935325.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/5no1w1470935325.tab") > > try(system("convert tmp/1eejb1470935325.ps tmp/1eejb1470935325.png",intern=TRUE)) character(0) > try(system("convert tmp/28pbe1470935325.ps tmp/28pbe1470935325.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.822 0.079 0.910