R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(5947968.00 + ,5925816.00 + ,5903352.00 + ,5856864.00 + ,6316752.00 + ,6292416.00 + ,5947968.00 + ,5718960.00 + ,5741112.00 + ,5741112.00 + ,5765760.00 + ,5810064.00 + ,5879016.00 + ,5879016.00 + ,5834712.00 + ,5718960.00 + ,6316752.00 + ,6407856.00 + ,6270264.00 + ,5947968.00 + ,6085872.00 + ,5879016.00 + ,5972304.00 + ,6016920.00 + ,6063408.00 + ,5947968.00 + ,5972304.00 + ,5810064.00 + ,6316752.00 + ,6476808.00 + ,6339216.00 + ,6085872.00 + ,6361368.00 + ,6063408.00 + ,6339216.00 + ,6316752.00 + ,6385704.00 + ,6132360.00 + ,6407856.00 + ,6385704.00 + ,6799104.00 + ,6705816.00 + ,6339216.00 + ,6154512.00 + ,6407856.00 + ,6063408.00 + ,6316752.00 + ,6361368.00 + ,6454656.00 + ,6248112.00 + ,6361368.00 + ,6430320.00 + ,6683664.00 + ,6476808.00 + ,6201312.00 + ,5903352.00 + ,6179160.00 + ,5421000.00 + ,5787912.00 + ,5994456.00 + ,6201312.00 + ,5903352.00 + ,5903352.00 + ,5903352.00 + ,6063408.00 + ,5834712.00 + ,5534568.00 + ,5283408.00 + ,5465616.00 + ,4754256.00 + ,5190120.00 + ,5443464.00 + ,5489952.00 + ,5236608.00 + ,5258760.00 + ,5190120.00 + ,5421000.00 + ,5258760.00 + ,4938960.00 + ,4707768.00 + ,5098704.00 + ,4249752.00 + ,4801056.00 + ,5052216.00 + ,5052216.00 + ,4754256.00 + ,4478760.00 + ,4456608.00 + ,4707768.00 + ,4478760.00 + ,4043208.00 + ,3743064.00 + ,4065360.00 + ,3307512.00 + ,3996408.00 + ,4363008.00 + ,4478760.00 + ,4225416.00 + ,3905304.00 + ,4134312.00 + ,4225416.00 + ,4156464.00 + ,3467256.00 + ,3147456.00 + ,3376152.00 + ,2687256.00 + ,3398616.00 + ,3651960.00 + ,3858504.00 + ,3514056.00 + ,3191760.00 + ,3376152.00 + ,3467256.00 + ,3285048.00 + ,2596152.00 + ,2296008.00 + ,2571504.00 + ,1813656.00 + ,2640456.00 + ,3147456.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,] 5947968 5879016 6063408 6385704 6454656 6201312 5489952 5052216 4478760 [2,] 5925816 5879016 5947968 6132360 6248112 5903352 5236608 4754256 4225416 [3,] 5903352 5834712 5972304 6407856 6361368 5903352 5258760 4478760 3905304 [4,] 5856864 5718960 5810064 6385704 6430320 5903352 5190120 4456608 4134312 [5,] 6316752 6316752 6316752 6799104 6683664 6063408 5421000 4707768 4225416 [6,] 6292416 6407856 6476808 6705816 6476808 5834712 5258760 4478760 4156464 [7,] 5947968 6270264 6339216 6339216 6201312 5534568 4938960 4043208 3467256 [8,] 5718960 5947968 6085872 6154512 5903352 5283408 4707768 3743064 3147456 [9,] 5741112 6085872 6361368 6407856 6179160 5465616 5098704 4065360 3376152 [10,] 5741112 5879016 6063408 6063408 5421000 4754256 4249752 3307512 2687256 [11,] 5765760 5972304 6339216 6316752 5787912 5190120 4801056 3996408 3398616 [12,] 5810064 6016920 6316752 6361368 5994456 5443464 5052216 4363008 3651960 [,10] [1,] 3858504 [2,] 3514056 [3,] 3191760 [4,] 3376152 [5,] 3467256 [6,] 3285048 [7,] 2596152 [8,] 2296008 [9,] 2571504 [10,] 1813656 [11,] 2640456 [12,] 3147456 > 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] 5914012 6017388 6174428 6371638 6178510 5623410 5058638 4287244 3737864 [10] 2979834 > arr.sd [1] 200415.9 212654.8 208587.3 213412.5 351439.2 419010.0 344584.2 480272.9 [9] 536289.1 593524.1 > arr.range [1] 597792 688896 666744 735696 1262664 1447056 1240200 1744704 1791504 [10] 2044848 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 9.483e+05 -1.132e-01 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 34.106 -1.386 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 3.307e+06 -3.983e-01 > postscript(file="/var/wessaorg/rcomp/tmp/1g3si1438858680.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/2errx1438858680.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/303ho1438858680.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/4beo61438858680.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/5zcwb1438858680.tab") > > try(system("convert tmp/1g3si1438858680.ps tmp/1g3si1438858680.png",intern=TRUE)) character(0) > try(system("convert tmp/2errx1438858680.ps tmp/2errx1438858680.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.892 0.172 1.070