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(3469648.00 + ,3456726.00 + ,3443622.00 + ,3416504.00 + ,3684772.00 + ,3670576.00 + ,3469648.00 + ,3336060.00 + ,3348982.00 + ,3348982.00 + ,3363360.00 + ,3389204.00 + ,3429426.00 + ,3429426.00 + ,3403582.00 + ,3336060.00 + ,3684772.00 + ,3737916.00 + ,3657654.00 + ,3469648.00 + ,3550092.00 + ,3429426.00 + ,3483844.00 + ,3509870.00 + ,3536988.00 + ,3469648.00 + ,3483844.00 + ,3389204.00 + ,3684772.00 + ,3778138.00 + ,3697876.00 + ,3550092.00 + ,3710798.00 + ,3536988.00 + ,3697876.00 + ,3684772.00 + ,3724994.00 + ,3577210.00 + ,3737916.00 + ,3724994.00 + ,3966144.00 + ,3911726.00 + ,3697876.00 + ,3590132.00 + ,3737916.00 + ,3536988.00 + ,3684772.00 + ,3710798.00 + ,3765216.00 + ,3644732.00 + ,3710798.00 + ,3751020.00 + ,3898804.00 + ,3778138.00 + ,3617432.00 + ,3443622.00 + ,3604510.00 + ,3162250.00 + ,3376282.00 + ,3496766.00 + ,3617432.00 + ,3443622.00 + ,3443622.00 + ,3443622.00 + ,3536988.00 + ,3403582.00 + ,3228498.00 + ,3081988.00 + ,3188276.00 + ,2773316.00 + ,3027570.00 + ,3175354.00 + ,3202472.00 + ,3054688.00 + ,3067610.00 + ,3027570.00 + ,3162250.00 + ,3067610.00 + ,2881060.00 + ,2746198.00 + ,2974244.00 + ,2479022.00 + ,2800616.00 + ,2947126.00 + ,2947126.00 + ,2773316.00 + ,2612610.00 + ,2599688.00 + ,2746198.00 + ,2612610.00 + ,2358538.00 + ,2183454.00 + ,2371460.00 + ,1929382.00 + ,2331238.00 + ,2545088.00 + ,2612610.00 + ,2464826.00 + ,2278094.00 + ,2411682.00 + ,2464826.00 + ,2424604.00 + ,2022566.00 + ,1836016.00 + ,1969422.00 + ,1567566.00 + ,1982526.00 + ,2130310.00 + ,2250794.00 + ,2049866.00 + ,1861860.00 + ,1969422.00 + ,2022566.00 + ,1916278.00 + ,1514422.00 + ,1339338.00 + ,1500044.00 + ,1057966.00 + ,1540266.00 + ,1836016.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] [1,] 3469648 3429426 3536988 3724994 3765216 3617432 3202472 2947126 2612610 [2,] 3456726 3429426 3469648 3577210 3644732 3443622 3054688 2773316 2464826 [3,] 3443622 3403582 3483844 3737916 3710798 3443622 3067610 2612610 2278094 [4,] 3416504 3336060 3389204 3724994 3751020 3443622 3027570 2599688 2411682 [5,] 3684772 3684772 3684772 3966144 3898804 3536988 3162250 2746198 2464826 [6,] 3670576 3737916 3778138 3911726 3778138 3403582 3067610 2612610 2424604 [7,] 3469648 3657654 3697876 3697876 3617432 3228498 2881060 2358538 2022566 [8,] 3336060 3469648 3550092 3590132 3443622 3081988 2746198 2183454 1836016 [9,] 3348982 3550092 3710798 3737916 3604510 3188276 2974244 2371460 1969422 [10,] 3348982 3429426 3536988 3536988 3162250 2773316 2479022 1929382 1567566 [11,] 3363360 3483844 3697876 3684772 3376282 3027570 2800616 2331238 1982526 [12,] 3389204 3509870 3684772 3710798 3496766 3175354 2947126 2545088 2130310 [,10] [1,] 2250794 [2,] 2049866 [3,] 1861860 [4,] 1969422 [5,] 2022566 [6,] 1916278 [7,] 1514422 [8,] 1339338 [9,] 1500044 [10,] 1057966 [11,] 1540266 [12,] 1836016 > 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] 3449840 3510143 3601750 3716789 3604131 3280322 2950872 2500892 2180421 [10] 1738236 > arr.sd [1] 116909.3 124048.6 121675.9 124490.6 205006.2 244422.5 201007.4 280159.2 [9] 312835.3 346222.4 > arr.range [1] 348712 401856 388934 429156 736554 844116 723450 1017744 1045044 [10] 1192828 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 5.532e+05 -1.132e-01 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 32.820 -1.386 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 1.929e+06 -3.983e-01 > postscript(file="/var/wessaorg/rcomp/tmp/1h53t1438966493.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/226a81438966493.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/3wt631438966493.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/4hae81438966493.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/5l21s1438966493.tab") > > try(system("convert tmp/1h53t1438966493.ps tmp/1h53t1438966493.png",intern=TRUE)) character(0) > try(system("convert tmp/226a81438966493.ps tmp/226a81438966493.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.912 0.175 1.085