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(95320.00 + ,94965.00 + ,94605.00 + ,93860.00 + ,101230.00 + ,100840.00 + ,95320.00 + ,91650.00 + ,92005.00 + ,92005.00 + ,92400.00 + ,93110.00 + ,94215.00 + ,94215.00 + ,93505.00 + ,91650.00 + ,101230.00 + ,102690.00 + ,100485.00 + ,95320.00 + ,97530.00 + ,94215.00 + ,95710.00 + ,96425.00 + ,97170.00 + ,95320.00 + ,95710.00 + ,93110.00 + ,101230.00 + ,103795.00 + ,101590.00 + ,97530.00 + ,101945.00 + ,97170.00 + ,101590.00 + ,101230.00 + ,102335.00 + ,98275.00 + ,102690.00 + ,102335.00 + ,108960.00 + ,107465.00 + ,101590.00 + ,98630.00 + ,102690.00 + ,97170.00 + ,101230.00 + ,101945.00 + ,103440.00 + ,100130.00 + ,101945.00 + ,103050.00 + ,107110.00 + ,103795.00 + ,99380.00 + ,94605.00 + ,99025.00 + ,86875.00 + ,92755.00 + ,96065.00 + ,99380.00 + ,94605.00 + ,94605.00 + ,94605.00 + ,97170.00 + ,93505.00 + ,88695.00 + ,84670.00 + ,87590.00 + ,76190.00 + ,83175.00 + ,87235.00 + ,87980.00 + ,83920.00 + ,84275.00 + ,83175.00 + ,86875.00 + ,84275.00 + ,79150.00 + ,75445.00 + ,81710.00 + ,68105.00 + ,76940.00 + ,80965.00 + ,80965.00 + ,76190.00 + ,71775.00 + ,71420.00 + ,75445.00 + ,71775.00 + ,64795.00 + ,59985.00 + ,65150.00 + ,53005.00 + ,64045.00 + ,69920.00 + ,71775.00 + ,67715.00 + ,62585.00 + ,66255.00 + ,67715.00 + ,66610.00 + ,55565.00 + ,50440.00 + ,54105.00 + ,43065.00 + ,54465.00 + ,58525.00 + ,61835.00 + ,56315.00 + ,51150.00 + ,54105.00 + ,55565.00 + ,52645.00 + ,41605.00 + ,36795.00 + ,41210.00 + ,29065.00 + ,42315.00 + ,50440.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,] 95320 94215 97170 102335 103440 99380 87980 80965 71775 61835 [2,] 94965 94215 95320 98275 100130 94605 83920 76190 67715 56315 [3,] 94605 93505 95710 102690 101945 94605 84275 71775 62585 51150 [4,] 93860 91650 93110 102335 103050 94605 83175 71420 66255 54105 [5,] 101230 101230 101230 108960 107110 97170 86875 75445 67715 55565 [6,] 100840 102690 103795 107465 103795 93505 84275 71775 66610 52645 [7,] 95320 100485 101590 101590 99380 88695 79150 64795 55565 41605 [8,] 91650 95320 97530 98630 94605 84670 75445 59985 50440 36795 [9,] 92005 97530 101945 102690 99025 87590 81710 65150 54105 41210 [10,] 92005 94215 97170 97170 86875 76190 68105 53005 43065 29065 [11,] 92400 95710 101590 101230 92755 83175 76940 64045 54465 42315 [12,] 93110 96425 101230 101945 96065 87235 80965 69920 58525 50440 > 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] 94775.83 96432.50 98949.17 102109.58 99014.58 90118.75 81067.92 [8] 68705.83 59901.67 47753.75 > arr.sd [1] 3211.793 3407.929 3342.744 3420.072 5632.039 6714.903 5522.182 7696.680 [9] 8594.376 9511.604 > arr.range [1] 9580 11040 10685 11790 20235 23190 19875 27960 28710 32770 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 15196.9395 -0.1132 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 24.244 -1.386 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 52991.7013 -0.3983 > postscript(file="/var/wessaorg/rcomp/tmp/1bax41439751515.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/2ydpe1439751515.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/34hvl1439751515.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/4lvgq1439751515.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/57sig1439751515.tab") > > try(system("convert tmp/1bax41439751515.ps tmp/1bax41439751515.png",intern=TRUE)) character(0) > try(system("convert tmp/2ydpe1439751515.ps tmp/2ydpe1439751515.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.936 0.132 1.070