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(329.6 + ,327.2 + ,326.3 + ,315.4 + ,308.6 + ,302.6 + ,295.6 + ,291.5 + ,288.1 + ,281.1 + ,282.4 + ,284.9 + ,274.2 + ,265.7 + ,259.7 + ,253.7 + ,249.5 + ,244.6 + ,243 + ,239.2 + ,235.7 + ,231.1 + ,226.7 + ,221.7 + ,219.4 + ,214.2 + ,211.7 + ,207.7 + ,204.7 + ,201.2 + ,199.9 + ,197.8 + ,195.2 + ,194.3 + ,192.8 + ,188.5 + ,183.2 + ,181.4 + ,180.5 + ,180.2 + ,179.2 + ,177.1 + ,174.2 + ,172.1 + ,171.1 + ,169.8 + ,169.5 + ,165.5 + ,167.2 + ,167.6 + ,171.8 + ,175.9 + ,180 + ,184.9 + ,184.6 + ,187.6 + ,191.5 + ,195.5 + ,201.6 + ,203.5 + ,209.1 + ,217.1 + ,227.6 + ,237.2 + ,245.6 + ,253.2 + ,260.5 + ,266.1 + ,273 + ,280.8 + ,284.4 + ,288.5 + ,284.8 + ,288.9 + ,299.6 + ,307.8 + ,311.4 + ,322 + ,317.8 + ,319.1 + ,322.3 + ,323.1 + ,322.8 + ,325 + ,323.2 + ,318.8 + ,328.2 + ,329.2 + ,326.5 + ,330.1 + ,323.8 + ,321.8 + ,319.6 + ,315.5 + ,310.7 + ,306.5 + ,295.1 + ,288 + ,293.9 + ,289.3 + ,287.4 + ,282.6 + ,276.9 + ,272.7 + ,267.9 + ,262.8 + ,256.6 + ,250.7 + ,243.2 + ,235.1 + ,229.6 + ,222.9 + ,217.6 + ,214.1 + ,210.8 + ,208 + ,202.6 + ,199 + ,195.5 + ,192.1 + ,189.4 + ,182.4 + ,179.2 + ,176.5 + ,174 + ,171.7 + ,169.8 + ,168.3 + ,166.4 + ,165.9 + ,166.4 + ,170.6 + ,177.6 + ,183.4 + ,191.9 + ,201.7 + ,210.6 + ,221.6 + ,232.2 + ,240.4 + ,248.4 + ,258.5 + ,265 + ,271.7 + ,273.9 + ,277.8 + ,273.4 + ,270.9 + ,268.3 + ,264.7 + ,264.1 + ,264.5 + ,262.2 + ,258.6 + ,259.4 + ,262.7 + ,264.9 + ,260.5 + ,256.4 + ,254.7 + ,254.8 + ,255.3 + ,256.8 + ,258.7 + ,259.8 + ,261.7 + ,264.7 + ,269.1 + ,279 + ,283.4 + ,285.5 + ,288.2 + ,292.1 + ,295.6 + ,302.4 + ,308.5 + ,314.1 + ,319.8 + ,329.7 + ,339.7) > 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] 180 > (np <- floor(n / par1)) [1] 15 > 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,] 329.6 274.2 219.4 183.2 167.2 209.1 284.8 323.2 295.1 243.2 189.4 177.6 [2,] 327.2 265.7 214.2 181.4 167.6 217.1 288.9 318.8 288.0 235.1 182.4 183.4 [3,] 326.3 259.7 211.7 180.5 171.8 227.6 299.6 328.2 293.9 229.6 179.2 191.9 [4,] 315.4 253.7 207.7 180.2 175.9 237.2 307.8 329.2 289.3 222.9 176.5 201.7 [5,] 308.6 249.5 204.7 179.2 180.0 245.6 311.4 326.5 287.4 217.6 174.0 210.6 [6,] 302.6 244.6 201.2 177.1 184.9 253.2 322.0 330.1 282.6 214.1 171.7 221.6 [7,] 295.6 243.0 199.9 174.2 184.6 260.5 317.8 323.8 276.9 210.8 169.8 232.2 [8,] 291.5 239.2 197.8 172.1 187.6 266.1 319.1 321.8 272.7 208.0 168.3 240.4 [9,] 288.1 235.7 195.2 171.1 191.5 273.0 322.3 319.6 267.9 202.6 166.4 248.4 [10,] 281.1 231.1 194.3 169.8 195.5 280.8 323.1 315.5 262.8 199.0 165.9 258.5 [11,] 282.4 226.7 192.8 169.5 201.6 284.4 322.8 310.7 256.6 195.5 166.4 265.0 [12,] 284.9 221.7 188.5 165.5 203.5 288.5 325.0 306.5 250.7 192.1 170.6 271.7 [,13] [,14] [,15] [1,] 273.9 264.9 279.0 [2,] 277.8 260.5 283.4 [3,] 273.4 256.4 285.5 [4,] 270.9 254.7 288.2 [5,] 268.3 254.8 292.1 [6,] 264.7 255.3 295.6 [7,] 264.1 256.8 302.4 [8,] 264.5 258.7 308.5 [9,] 262.2 259.8 314.1 [10,] 258.6 261.7 319.8 [11,] 259.4 264.7 329.7 [12,] 262.7 269.1 339.7 > 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] 302.7750 245.4000 202.2833 175.3167 184.3083 253.5917 312.0500 321.1583 [9] 276.9917 214.2083 173.3833 225.2500 266.7083 259.7833 303.1667 > arr.sd [1] 18.244208 15.916030 9.436952 5.705951 12.333064 26.642975 13.961538 [8] 7.376555 14.880827 16.113036 7.289823 32.436918 6.111756 4.608655 [15] 19.434100 > arr.range [1] 48.5 52.5 30.9 17.7 36.3 79.4 40.2 23.6 44.4 51.1 23.5 94.1 19.2 14.4 60.7 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 8.41222 0.02269 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) -0.8140 0.6014 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 28.81974 0.05495 > postscript(file="/var/wessaorg/rcomp/tmp/1odmk1398688098.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/28e5l1398688098.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/3lkrk1398688098.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/4pfrq1398688098.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/5kjoq1398688098.tab") > > try(system("convert tmp/1odmk1398688098.ps tmp/1odmk1398688098.png",intern=TRUE)) character(0) > try(system("convert tmp/28e5l1398688098.ps tmp/28e5l1398688098.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.635 0.295 1.922