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(1684800.00 + ,1622400.00 + ,1716000.00 + ,1372800.00 + ,1778400.00 + ,1747200.00 + ,1872000.00 + ,1934400.00 + ,2152800.00 + ,1872000.00 + ,1778400.00 + ,2215200.00 + ,1872000.00 + ,1404000.00 + ,1653600.00 + ,1248000.00 + ,1747200.00 + ,1435200.00 + ,1903200.00 + ,1716000.00 + ,1809600.00 + ,2028000.00 + ,1996800.00 + ,2371200.00 + ,1716000.00 + ,1435200.00 + ,1591200.00 + ,1154400.00 + ,1653600.00 + ,1279200.00 + ,1809600.00 + ,1716000.00 + ,1528800.00 + ,2184000.00 + ,1965600.00 + ,2246400.00 + ,1684800.00 + ,1560000.00 + ,1404000.00 + ,1154400.00 + ,1528800.00 + ,1372800.00 + ,1872000.00 + ,1809600.00 + ,1560000.00 + ,2090400.00 + ,1934400.00 + ,2496000.00 + ,1996800.00 + ,1216800.00 + ,1216800.00 + ,1216800.00 + ,1435200.00 + ,1435200.00 + ,1934400.00 + ,1778400.00 + ,1591200.00 + ,1996800.00 + ,1840800.00 + ,2652000.00 + ,2090400.00 + ,1216800.00 + ,1279200.00 + ,1060800.00 + ,1466400.00 + ,1684800.00 + ,2121600.00 + ,2090400.00 + ,1684800.00 + ,1965600.00 + ,1747200.00 + ,2496000.00 + ,1903200.00 + ,1528800.00 + ,1372800.00 + ,1029600.00 + ,1528800.00 + ,1840800.00 + ,2152800.00 + ,2028000.00 + ,1497600.00 + ,2152800.00 + ,1684800.00 + ,2589600.00 + ,2152800.00 + ,1560000.00 + ,1435200.00 + ,967200.00 + ,1528800.00 + ,1466400.00 + ,2215200.00 + ,2215200.00 + ,1684800.00 + ,2184000.00 + ,1622400.00 + ,2527200.00 + ,2152800.00 + ,1591200.00 + ,1216800.00 + ,842400.00 + ,1653600.00 + ,1591200.00 + ,2090400.00 + ,2402400.00 + ,1778400.00 + ,1996800.00 + ,1497600.00 + ,2589600.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] 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,] 1684800 1872000 1716000 1684800 1996800 2090400 1903200 2152800 2152800 [2,] 1622400 1404000 1435200 1560000 1216800 1216800 1528800 1560000 1591200 [3,] 1716000 1653600 1591200 1404000 1216800 1279200 1372800 1435200 1216800 [4,] 1372800 1248000 1154400 1154400 1216800 1060800 1029600 967200 842400 [5,] 1778400 1747200 1653600 1528800 1435200 1466400 1528800 1528800 1653600 [6,] 1747200 1435200 1279200 1372800 1435200 1684800 1840800 1466400 1591200 [7,] 1872000 1903200 1809600 1872000 1934400 2121600 2152800 2215200 2090400 [8,] 1934400 1716000 1716000 1809600 1778400 2090400 2028000 2215200 2402400 [9,] 2152800 1809600 1528800 1560000 1591200 1684800 1497600 1684800 1778400 [10,] 1872000 2028000 2184000 2090400 1996800 1965600 2152800 2184000 1996800 [11,] 1778400 1996800 1965600 1934400 1840800 1747200 1684800 1622400 1497600 [12,] 2215200 2371200 2246400 2496000 2652000 2496000 2589600 2527200 2589600 > 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] 1812200 1765400 1690000 1705600 1692600 1742000 1775800 1796600 1783600 > arr.sd [1] 225951.3 308135.2 330680.8 362226.3 428025.5 430850.4 421847.3 453198.0 [9] 494360.6 > arr.range [1] 842400 1123200 1092000 1341600 1435200 1435200 1560000 1560000 1747200 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 5.721e+05 -1.074e-01 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 31.469 -1.296 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 9.581e+05 2.229e-01 > postscript(file="/var/wessaorg/rcomp/tmp/104io1438953091.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/24sdb1438953091.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/3kn7f1438953091.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/4ggfj1438953091.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/5ueil1438953091.tab") > > try(system("convert tmp/104io1438953091.ps tmp/104io1438953091.png",intern=TRUE)) character(0) > try(system("convert tmp/24sdb1438953091.ps tmp/24sdb1438953091.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.915 0.175 1.093