R version 3.2.4 Revised (2016-03-16 r70336) -- "Very Secure Dishes" Copyright (C) 2016 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(340.4,343.2,345,346.6,348.7,351.1,352.7,354.8,359.8,364.4,366.2,368.8,369.6,370.6,374.2,378.1,381,383.2,387.3,391.4,395.1,399.1,403,406.3,410.2,413.3,418.4,421.4,422.5,425.5,427.3,430.7,433.2,437.5,439.9,443,445.6,446.2,449.3,453.9,458,461.2,463.7,466,468.3,471.7,474.7,477.3,479.8,482.6,485.6,488.5,492,494.8,498.3,502.1,505.8,511.7,516.6,521.3,526.1,530.4,534.7,538.4,544.6,547.7,551.4,554.3,557.5,560.7,563.8,566.2,567.2,569.3,570.9,573,575.1,578.1,581,584.4,340.4,343.2,345,346.6,348.7,351.1,352.7,354.8,359.8,364.4,366.2,368.8,369.6,370.6,374.2,378.1,381,383.2,387.3,391.4,395.1,399.1,403,406.3,410.2,413.3,418.4,421.4,422.5,425.5,427.3,430.7,433.2,437.5,439.9,443,445.6,446.2,449.3,453.9,458,461.2,463.7,466,468.3,471.7,474.7,477.3,479.8,482.6,485.6,488.5,492,494.8,498.3,502.1,505.8,511.7,516.6,521.3,526.1,530.4,534.7,538.4,544.6,547.7,551.4,554.3,557.5,560.7,563.8,566.2,567.2,569.3,570.9,573,575.1,578.1,581,584.4) > 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] 160 > (np <- floor(n / par1)) [1] 13 > 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] [,12] [1,] 340.4 369.6 410.2 445.6 479.8 526.1 567.2 348.7 381.0 422.5 458.0 492.0 [2,] 343.2 370.6 413.3 446.2 482.6 530.4 569.3 351.1 383.2 425.5 461.2 494.8 [3,] 345.0 374.2 418.4 449.3 485.6 534.7 570.9 352.7 387.3 427.3 463.7 498.3 [4,] 346.6 378.1 421.4 453.9 488.5 538.4 573.0 354.8 391.4 430.7 466.0 502.1 [5,] 348.7 381.0 422.5 458.0 492.0 544.6 575.1 359.8 395.1 433.2 468.3 505.8 [6,] 351.1 383.2 425.5 461.2 494.8 547.7 578.1 364.4 399.1 437.5 471.7 511.7 [7,] 352.7 387.3 427.3 463.7 498.3 551.4 581.0 366.2 403.0 439.9 474.7 516.6 [8,] 354.8 391.4 430.7 466.0 502.1 554.3 584.4 368.8 406.3 443.0 477.3 521.3 [9,] 359.8 395.1 433.2 468.3 505.8 557.5 340.4 369.6 410.2 445.6 479.8 526.1 [10,] 364.4 399.1 437.5 471.7 511.7 560.7 343.2 370.6 413.3 446.2 482.6 530.4 [11,] 366.2 403.0 439.9 474.7 516.6 563.8 345.0 374.2 418.4 449.3 485.6 534.7 [12,] 368.8 406.3 443.0 477.3 521.3 566.2 346.6 378.1 421.4 453.9 488.5 538.4 [,13] [1,] 544.6 [2,] 547.7 [3,] 551.4 [4,] 554.3 [5,] 557.5 [6,] 560.7 [7,] 563.8 [8,] 566.2 [9,] 567.2 [10,] 569.3 [11,] 570.9 [12,] 573.0 > 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] 353.4750 386.5750 426.9083 461.3250 498.2583 547.9833 497.8500 363.2500 [9] 400.8083 437.8833 473.1167 514.3500 560.5500 > arr.sd [1] 9.451130 12.515454 10.368349 10.890874 13.524823 13.327131 [7] 113.880963 9.674380 13.556646 10.097329 9.918471 15.985988 [13] 9.424485 > arr.range [1] 28.4 36.7 32.8 31.7 41.5 40.1 244.0 29.4 40.4 31.4 30.5 46.4 [13] 28.4 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -20.89355 0.08852 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -4.697 1.196 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -35.3001 0.1892 > postscript(file="/var/wessaorg/rcomp/tmp/11pbf1458678128.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/27xs21458678128.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/3hl6h1458678128.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/4va3j1458678128.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/5y52s1458678128.tab") > > try(system("convert tmp/11pbf1458678128.ps tmp/11pbf1458678128.png",intern=TRUE)) character(0) > try(system("convert tmp/27xs21458678128.ps tmp/27xs21458678128.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.926 0.176 1.109