R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(71.97 + ,72.32 + ,74.07 + ,77.95 + ,81.75 + ,80.81 + ,74.1 + ,71.37 + ,75.21 + ,76.9 + ,74.44 + ,74.76 + ,76.23 + ,76.97 + ,78.4 + ,78.6 + ,80.08 + ,81.12 + ,80.31 + ,84.59 + ,81.34 + ,80.95 + ,80.48 + ,75.26 + ,76.32 + ,78.92 + ,80.47 + ,83.14 + ,85.42 + ,81.53 + ,87.31 + ,86.01 + ,85.1 + ,79.91 + ,78.6 + ,78.6 + ,79.37 + ,82.89 + ,84.43 + ,85.32 + ,87.71 + ,84.68 + ,80.62 + ,84.79 + ,85.49 + ,81.68 + ,77.69 + ,78.31 + ,79.18 + ,80.91 + ,83.91 + ,86.3 + ,89.76 + ,85.11 + ,83.81 + ,85.36 + ,85.89 + ,82.59 + ,80.87 + ,80.27 + ,81.36 + ,84.81 + ,90.3 + ,95.43 + ,97.59 + ,97.8 + ,99.48 + ,97.52 + ,104.39 + ,97.74 + ,91.37 + ,92.42 + ,96.9 + ,101.58 + ,105.46 + ,110.06 + ,107.9 + ,102.87 + ,96.28 + ,98.59 + ,103.22 + ,98.6 + ,91.79 + ,93.83 + ,95.17 + ,95.19 + ,99.44 + ,109.18 + ,109.15 + ,109.72 + ,108.41 + ,102.96 + ,107.64 + ,97.28 + ,97.25 + ,91.84 + ,94.12 + ,97.86 + ,98.83 + ,102.29 + ,104.49 + ,102.11 + ,102.14 + ,101.28 + ,101.21 + ,94.2 + ,88.47 + ,88.08 + ,88.02 + ,92.95 + ,97.05 + ,101.44 + ,100.34 + ,99.98 + ,94.17 + ,94.54 + ,95.12 + ,98.04 + ,93.72 + ,93.83 + ,93.03 + ,95.81 + ,99.1 + ,100.12 + ,100.67 + ,103.87 + ,102.39 + ,107.21 + ,105.71 + ,99.79 + ,96.12 + ,96.17 + ,97.23 + ,98.08 + ,99.84 + ,99.72 + ,99.92 + ,102.7 + ,102.06 + ,102.36 + ,102.43 + ,100.6 + ,98.4 + ,98.61 + ,103.03 + ,104.7 + ,107.45 + ,109.67 + ,110.54 + ,112.05 + ,113.19 + ,114.2 + ,112.56 + ,107.36 + ,103.93 + ,103.83 + ,104.74 + ,107.5 + ,109.53 + ,109.42 + ,108.6 + ,110.72 + ,105.1 + ,105.19 + ,102.55 + ,101.25 + ,101.56 + ,101.62 + ,101.7 + ,102.94 + ,104.37 + ,106.93 + ,107.82 + ,110.83 + ,106.86 + ,109.46 + ,108.8 + ,108.69 + ,107.77 + ,108.64 + ,108.5 + ,113.84 + ,114.59 + ,116.27 + ,113.63 + ,112.29 + ,110.31 + ,108.47 + ,110.67 + ,109.1 + ,107.02 + ,108.12 + ,106.69 + ,109.87 + ,110.82 + ,114.14 + ,113.31 + ,115.16 + ,111.06 + ,111.13 + ,115.96 + ,117.57 + ,114.69 + ,119.42 + ,118.4 + ,123.32 + ,123.39 + ,127.04 + ,129.35 + ,127.12 + ,122.1 + ,120.22 + ,121.53 + ,119.01 + ,114.27 + ,114.46) > 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] 216 > (np <- floor(n / par1)) [1] 18 > 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] [,11] [1,] 71.97 76.23 76.32 79.37 79.18 81.36 96.90 95.17 94.12 88.02 93.03 [2,] 72.32 76.97 78.92 82.89 80.91 84.81 101.58 95.19 97.86 92.95 95.81 [3,] 74.07 78.40 80.47 84.43 83.91 90.30 105.46 99.44 98.83 97.05 99.10 [4,] 77.95 78.60 83.14 85.32 86.30 95.43 110.06 109.18 102.29 101.44 100.12 [5,] 81.75 80.08 85.42 87.71 89.76 97.59 107.90 109.15 104.49 100.34 100.67 [6,] 80.81 81.12 81.53 84.68 85.11 97.80 102.87 109.72 102.11 99.98 103.87 [7,] 74.10 80.31 87.31 80.62 83.81 99.48 96.28 108.41 102.14 94.17 102.39 [8,] 71.37 84.59 86.01 84.79 85.36 97.52 98.59 102.96 101.28 94.54 107.21 [9,] 75.21 81.34 85.10 85.49 85.89 104.39 103.22 107.64 101.21 95.12 105.71 [10,] 76.90 80.95 79.91 81.68 82.59 97.74 98.60 97.28 94.20 98.04 99.79 [11,] 74.44 80.48 78.60 77.69 80.87 91.37 91.79 97.25 88.47 93.72 96.12 [12,] 74.76 75.26 78.60 78.31 80.27 92.42 93.83 91.84 88.08 93.83 96.17 [,12] [,13] [,14] [,15] [,16] [,17] [,18] [1,] 97.23 103.03 104.74 101.70 108.50 106.69 118.40 [2,] 98.08 104.70 107.50 102.94 113.84 109.87 123.32 [3,] 99.84 107.45 109.53 104.37 114.59 110.82 123.39 [4,] 99.72 109.67 109.42 106.93 116.27 114.14 127.04 [5,] 99.92 110.54 108.60 107.82 113.63 113.31 129.35 [6,] 102.70 112.05 110.72 110.83 112.29 115.16 127.12 [7,] 102.06 113.19 105.10 106.86 110.31 111.06 122.10 [8,] 102.36 114.20 105.19 109.46 108.47 111.13 120.22 [9,] 102.43 112.56 102.55 108.80 110.67 115.96 121.53 [10,] 100.60 107.36 101.25 108.69 109.10 117.57 119.01 [11,] 98.40 103.93 101.56 107.77 107.02 114.69 114.27 [12,] 98.61 103.83 101.62 108.64 108.12 119.42 114.46 > 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] 75.47083 79.52750 81.77750 82.74833 83.66333 94.18417 100.59000 [8] 101.93583 97.92333 95.76667 99.99917 100.16250 108.54250 105.64833 [15] 107.06750 111.06750 113.31833 121.68417 > arr.sd [1] 3.311156 2.577099 3.543070 3.188986 3.049350 6.471304 5.585852 6.631113 [9] 5.518383 3.790244 4.290104 1.883252 4.028736 3.442757 2.734158 2.988366 [17] 3.569952 4.767503 > arr.range [1] 10.38 9.33 10.99 10.02 10.58 23.03 18.27 17.88 16.41 13.42 14.18 5.47 [13] 11.17 9.47 9.13 9.25 12.73 15.08 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 1.90182 0.02109 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -1.1838 0.5485 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 7.99610 0.04705 > postscript(file="/var/wessaorg/rcomp/tmp/1fbct1398699176.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/2ianc1398699176.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/303wo1398699176.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/4211h1398699176.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/5hiwm1398699176.tab") > > try(system("convert tmp/1fbct1398699176.ps tmp/1fbct1398699176.png",intern=TRUE)) character(0) > try(system("convert tmp/2ianc1398699176.ps tmp/2ianc1398699176.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.638 0.326 1.968