R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(221.102 + ,220.892 + ,225.537 + ,219.334 + ,216.126 + ,224.573 + ,213.991 + ,221.865 + ,215.382 + ,213.962 + ,217.009 + ,318.110 + ,219.662 + ,212.650 + ,209.307 + ,210.541 + ,210.609 + ,208.910 + ,207.541 + ,207.699 + ,205.005 + ,205.747 + ,203.644 + ,229.937 + ,214.446 + ,210.194 + ,206.535 + ,216.524 + ,198.243 + ,208.274 + ,207.493 + ,215.525 + ,207.562 + ,213.355 + ,209.048 + ,220.497 + ,214.563 + ,211.571 + ,216.385 + ,211.496 + ,209.683 + ,206.304 + ,213.925 + ,204.829 + ,205.729 + ,200.296 + ,207.960 + ,207.729 + ,208.327 + ,207.794 + ,213.700 + ,213.136 + ,210.354 + ,202.205 + ,220.425 + ,210.038 + ,205.201 + ,197.441 + ,200.021 + ,203.165 + ,201.699 + ,201.003 + ,232.308 + ,211.412 + ,209.661 + ,213.587 + ,193.611 + ,192.543 + ,196.040 + ,191.407 + ,189.726 + ,191.272 + ,187.924 + ,198.213 + ,199.352 + ,199.289 + ,195.475 + ,198.045 + ,197.615 + ,189.015 + ,189.668 + ,189.120 + ,194.168 + ,192.304 + ,185.913 + ,197.599 + ,186.085 + ,190.566 + ,187.054 + ,193.222 + ,189.856 + ,190.608 + ,190.588 + ,186.773 + ,183.510 + ,180.106 + ,180.150 + ,178.412 + ,182.353 + ,203.805 + ,186.054 + ,184.290 + ,187.483 + ,187.111 + ,189.561 + ,184.439 + ,182.985 + ,183.828 + ,184.036 + ,183.214 + ,183.464 + ,173.718 + ,180.210 + ,171.252 + ,172.705 + ,174.006 + ,172.043 + ,169.445 + ,169.449 + ,177.073 + ,170.799 + ,171.648 + ,172.220 + ,165.795 + ,167.466 + ,165.528 + ,162.851 + ,165.864 + ,162.094 + ,162.385 + ,164.293 + ,165.983 + ,159.680 + ,161.739 + ,159.302 + ,167.795 + ,164.242 + ,159.743 + ,160.887 + ,163.844 + ,161.172 + ,159.330 + ,155.570 + ,156.749 + ,155.012 + ,163.419 + ,153.630 + ,154.535 + ,151.543 + ,152.955 + ,150.166 + ,151.416 + ,150.332 + ,152.196 + ,153.422 + ,147.435) > 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] 156 > (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] [1,] 221.102 219.662 214.446 214.563 208.327 201.699 187.924 185.913 180.150 [2,] 220.892 212.650 210.194 211.571 207.794 201.003 198.213 197.599 178.412 [3,] 225.537 209.307 206.535 216.385 213.700 232.308 199.352 186.085 182.353 [4,] 219.334 210.541 216.524 211.496 213.136 211.412 199.289 190.566 203.805 [5,] 216.126 210.609 198.243 209.683 210.354 209.661 195.475 187.054 186.054 [6,] 224.573 208.910 208.274 206.304 202.205 213.587 198.045 193.222 184.290 [7,] 213.991 207.541 207.493 213.925 220.425 193.611 197.615 189.856 187.483 [8,] 221.865 207.699 215.525 204.829 210.038 192.543 189.015 190.608 187.111 [9,] 215.382 205.005 207.562 205.729 205.201 196.040 189.668 190.588 189.561 [10,] 213.962 205.747 213.355 200.296 197.441 191.407 189.120 186.773 184.439 [11,] 217.009 203.644 209.048 207.960 200.021 189.726 194.168 183.510 182.985 [12,] 318.110 229.937 220.497 207.729 203.165 191.272 192.304 180.106 183.828 [,10] [,11] [,12] [,13] [1,] 184.036 170.799 159.680 155.012 [2,] 183.214 171.648 161.739 163.419 [3,] 183.464 172.220 159.302 153.630 [4,] 173.718 165.795 167.795 154.535 [5,] 180.210 167.466 164.242 151.543 [6,] 171.252 165.528 159.743 152.955 [7,] 172.705 162.851 160.887 150.166 [8,] 174.006 165.864 163.844 151.416 [9,] 172.043 162.094 161.172 150.332 [10,] 169.445 162.385 159.330 152.196 [11,] 169.449 164.293 155.570 153.422 [12,] 177.073 165.983 156.749 147.435 > 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] 227.3236 210.9377 210.6413 209.2058 207.6506 202.0224 194.1823 188.4900 [9] 185.8726 175.8846 166.4105 160.8377 153.0051 > arr.sd [1] 28.852764 7.288971 5.844559 4.635444 6.477785 12.701013 4.398626 [8] 4.601936 6.447057 5.519976 3.505638 3.324755 3.895615 > arr.range [1] 104.148 26.293 22.254 16.089 22.984 42.582 11.428 17.493 25.393 [10] 14.591 10.126 12.225 15.984 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -27.9913 0.1851 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -16.024 3.396 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean -102.1916 0.6701 > postscript(file="/var/fisher/rcomp/tmp/1n8881385817957.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/fisher/rcomp/tmp/2r8ng1385817957.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/3s3xa1385817957.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/fisher/rcomp/tmp/48hms1385817957.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/fisher/rcomp/tmp/5nx1t1385817957.tab") > > try(system("convert tmp/1n8881385817957.ps tmp/1n8881385817957.png",intern=TRUE)) character(0) > try(system("convert tmp/2r8ng1385817957.ps tmp/2r8ng1385817957.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.692 0.490 2.154