R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" 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(21571.00 + ,21493.00 + ,21422.00 + ,21272.00 + ,22747.00 + ,22676.00 + ,21571.00 + ,20831.00 + ,20909.00 + ,20909.00 + ,20980.00 + ,21130.00 + ,21051.00 + ,21643.00 + ,21864.00 + ,21643.00 + ,22455.00 + ,21935.00 + ,20759.00 + ,20467.00 + ,20467.00 + ,20610.00 + ,20026.00 + ,20467.00 + ,20097.00 + ,20467.00 + ,21051.00 + ,21272.00 + ,21792.00 + ,21571.00 + ,20246.00 + ,19726.00 + ,19506.00 + ,19726.00 + ,19363.00 + ,19506.00 + ,19064.00 + ,19805.00 + ,20168.00 + ,20246.00 + ,21643.00 + ,21643.00 + ,19805.00 + ,19363.00 + ,19363.00 + ,19584.00 + ,18622.00 + ,18180.00 + ,17668.00 + ,17817.00 + ,18480.00 + ,17960.00 + ,19363.00 + ,19584.00 + ,18180.00 + ,17668.00 + ,17375.00 + ,17668.00 + ,16855.00 + ,16563.00 + ,15388.00 + ,15680.00 + ,15751.00 + ,15830.00 + ,17226.00 + ,17076.00 + ,15388.00 + ,14647.00 + ,14355.00 + ,14725.00 + ,13322.00 + ,12367.00 + ,10601.00 + ,10750.00 + ,10750.00 + ,10601.00 + ,11854.00 + ,11926.00 + ,10451.00 + ,10159.00 + ,9568.00 + ,10380.00 + ,8905.00 + ,8022.00 + ,6333.00 + ,6697.00 + ,6255.00 + ,6404.00 + ,7509.00 + ,7730.00 + ,6996.00 + ,6917.00 + ,6917.00 + ,7879.00 + ,6184.00 + ,5079.00 + ,3163.00 + ,4709.00 + ,4488.00 + ,4566.00 + ,6333.00 + ,6112.00 + ,5300.00 + ,5671.00 + ,5671.00 + ,6996.00 + ,5450.00 + ,4566.00 + ,3163.00 + ,5008.00 + ,4859.00 + ,4930.00 + ,6476.00 + ,6333.00 + ,5813.00 + ,5892.00 + ,6255.00 + ,7067.00 + ,5813.00 + ,4787.00) > par1 = '12' > 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,] 21571 21051 20097 19064 17668 15388 10601 6333 3163 3163 [2,] 21493 21643 20467 19805 17817 15680 10750 6697 4709 5008 [3,] 21422 21864 21051 20168 18480 15751 10750 6255 4488 4859 [4,] 21272 21643 21272 20246 17960 15830 10601 6404 4566 4930 [5,] 22747 22455 21792 21643 19363 17226 11854 7509 6333 6476 [6,] 22676 21935 21571 21643 19584 17076 11926 7730 6112 6333 [7,] 21571 20759 20246 19805 18180 15388 10451 6996 5300 5813 [8,] 20831 20467 19726 19363 17668 14647 10159 6917 5671 5892 [9,] 20909 20467 19506 19363 17375 14355 9568 6917 5671 6255 [10,] 20909 20610 19726 19584 17668 14725 10380 7879 6996 7067 [11,] 20980 20026 19363 18622 16855 13322 8905 6184 5450 5813 [12,] 21130 20467 19506 18180 16563 12367 8022 5079 4566 4787 > 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] 21459.250 21115.583 20360.250 19790.500 17931.750 15146.250 10330.583 [8] 6741.667 5252.083 5533.000 > arr.sd [1] 642.4159 763.8452 862.1609 1049.1979 889.6428 1394.4437 1101.8161 [8] 773.4585 1023.6292 1042.5622 > arr.range [1] 1916 2429 2429 3463 3021 4859 3904 2800 3833 3904 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 1.096e+03 -9.878e-03 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Call: lm(formula = log(arr.sd) ~ log(arr.mean)) Coefficients: (Intercept) log(arr.mean) 7.8338 -0.1054 > (lm2 <- lm(arr.range~arr.mean)) Call: lm(formula = arr.range ~ arr.mean) Coefficients: (Intercept) arr.mean 4258.82109 -0.06982 > postscript(file="/var/wessaorg/rcomp/tmp/1kzo21471285993.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/29htw1471285993.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/3l82w1471285993.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/441iu1471285993.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/5l6351471285993.tab") > > try(system("convert tmp/1kzo21471285993.ps tmp/1kzo21471285993.png",intern=TRUE)) character(0) > try(system("convert tmp/29htw1471285993.ps tmp/29htw1471285993.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.885 0.085 0.977