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(19064.00 + ,18993.00 + ,18921.00 + ,18772.00 + ,20246.00 + ,20168.00 + ,19064.00 + ,18330.00 + ,18401.00 + ,18401.00 + ,18480.00 + ,18622.00 + ,18843.00 + ,18843.00 + ,18701.00 + ,18330.00 + ,20246.00 + ,20538.00 + ,20097.00 + ,19064.00 + ,19506.00 + ,18843.00 + ,19142.00 + ,19285.00 + ,19434.00 + ,19064.00 + ,19142.00 + ,18622.00 + ,20246.00 + ,20759.00 + ,20318.00 + ,19506.00 + ,20389.00 + ,19434.00 + ,20318.00 + ,20246.00 + ,20467.00 + ,19655.00 + ,20538.00 + ,20467.00 + ,21792.00 + ,21493.00 + ,20318.00 + ,19726.00 + ,20538.00 + ,19434.00 + ,20246.00 + ,20389.00 + ,20688.00 + ,20026.00 + ,20389.00 + ,20610.00 + ,21422.00 + ,20759.00 + ,19876.00 + ,18921.00 + ,19805.00 + ,17375.00 + ,18551.00 + ,19213.00 + ,19876.00 + ,18921.00 + ,18921.00 + ,18921.00 + ,19434.00 + ,18701.00 + ,17739.00 + ,16934.00 + ,17518.00 + ,15238.00 + ,16635.00 + ,17447.00 + ,17596.00 + ,16784.00 + ,16855.00 + ,16635.00 + ,17375.00 + ,16855.00 + ,15830.00 + ,15089.00 + ,16342.00 + ,13621.00 + ,15388.00 + ,16193.00 + ,16193.00 + ,15238.00 + ,14355.00 + ,14284.00 + ,15089.00 + ,14355.00 + ,12959.00 + ,11997.00 + ,13030.00 + ,10601.00 + ,12809.00 + ,13984.00 + ,14355.00 + ,13543.00 + ,12517.00 + ,13251.00 + ,13543.00 + ,13322.00 + ,11113.00 + ,10088.00 + ,10821.00 + ,8613.00 + ,10893.00 + ,11705.00 + ,12367.00 + ,11263.00 + ,10230.00 + ,10821.00 + ,11113.00 + ,10529.00 + ,8321.00 + ,7359.00 + ,8242.00 + ,5813.00 + ,8463.00 + ,10088.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,] 19064 18843 19434 20467 20688 19876 17596 16193 14355 12367 [2,] 18993 18843 19064 19655 20026 18921 16784 15238 13543 11263 [3,] 18921 18701 19142 20538 20389 18921 16855 14355 12517 10230 [4,] 18772 18330 18622 20467 20610 18921 16635 14284 13251 10821 [5,] 20246 20246 20246 21792 21422 19434 17375 15089 13543 11113 [6,] 20168 20538 20759 21493 20759 18701 16855 14355 13322 10529 [7,] 19064 20097 20318 20318 19876 17739 15830 12959 11113 8321 [8,] 18330 19064 19506 19726 18921 16934 15089 11997 10088 7359 [9,] 18401 19506 20389 20538 19805 17518 16342 13030 10821 8242 [10,] 18401 18843 19434 19434 17375 15238 13621 10601 8613 5813 [11,] 18480 19142 20318 20246 18551 16635 15388 12809 10893 8463 [12,] 18622 19285 20246 20389 19213 17447 16193 13984 11705 10088 > 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] 18955.17 19286.50 19789.83 20421.92 19802.92 18023.75 16213.58 13741.17 [9] 11980.33 9550.75 > arr.sd [1] 642.3587 681.5858 668.5489 684.0144 1126.4078 1342.9806 1104.4364 [8] 1539.3361 1718.8752 1902.3208 > arr.range [1] 1916 2208 2137 2358 4047 4638 3975 5592 5742 6554 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 3039.3879 -0.1132 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 20.404 -1.386 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 10598.3403 -0.3983 > postscript(file="/var/wessaorg/rcomp/tmp/1b6x51438966830.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/27ar11438966830.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/3mjxl1438966830.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/4zjlt1438966830.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/5mpt61438966830.tab") > > try(system("convert tmp/1b6x51438966830.ps tmp/1b6x51438966830.png",intern=TRUE)) character(0) > try(system("convert tmp/27ar11438966830.ps tmp/27ar11438966830.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.952 0.175 1.130