R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(103.24,103.43,103.43,103.43,103.31,103.31,103.31,103.31,104.06,104.8,105.36,105.38,105.38,105.38,108.37,112.21,112.05,112.05,112.06,112.05,111.36,111.36,111.36,111.36,111.78,111.89,111.89,111.89,112.02,112.02,112.02,112.02,112.02,112.02,112.02,111.28,111.28,111.28,111.28,110.56,110.56,110.56,110.56,110.56,111.37,109.43,109.43,109.57,109.57,109.57,109.57,109.57,109.39,111.68,111.68,111.68,111.93,111.93,111.93,111.93,111.56,111.89,111.89,111.89,110.82,110.82,110.82,110.82,110.98,110.98,111.78,111.78) > 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 Plot (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_sdplot.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 72 > (np <- floor(n / par1)) [1] 6 > arr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + if (j == par1) j = 0 + } > ari [1] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 103.24 105.38 111.78 111.28 109.57 111.56 NA [2,] 103.43 105.38 111.89 111.28 109.57 111.89 NA [3,] 103.43 108.37 111.89 111.28 109.57 111.89 NA [4,] 103.43 112.21 111.89 110.56 109.57 111.89 NA [5,] 103.31 112.05 112.02 110.56 109.39 110.82 NA [6,] 103.31 112.05 112.02 110.56 111.68 110.82 NA [7,] 103.31 112.06 112.02 110.56 111.68 110.82 NA [8,] 103.31 112.05 112.02 110.56 111.68 110.82 NA [9,] 104.06 111.36 112.02 111.37 111.93 110.98 NA [10,] 104.80 111.36 112.02 109.43 111.93 110.98 NA [11,] 105.36 111.36 112.02 109.43 111.93 111.78 NA [12,] 105.38 111.36 111.28 109.57 111.93 111.78 NA > arr.sd <- array(NA,dim=par1) > arr.range <- array(NA,dim=par1) > arr.iqr <- array(NA,dim=par1) > for (j in 1:par1) + { + arr.sd[j] <- sqrt(var(arr[j,],na.rm=TRUE)) + arr.range[j] <- max(arr[j,],na.rm=TRUE) - min(arr[j,],na.rm=TRUE) + arr.iqr[j] <- quantile(arr[j,],0.75,na.rm=TRUE) - quantile(arr[j,],0.25,na.rm=TRUE) + } > overall.sd <- sqrt(var(x)) > overall.range <- max(x) - min(x) > overall.iqr <- quantile(x,0.75) - quantile(x,0.25) > postscript(file="/var/fisher/rcomp/tmp/11b941358292494.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.sd,type='b',ylab='S.D.',main='Standard Deviation Plot',xlab='Periodic Index') > mtext(paste('# blocks = ',np)) > abline(overall.sd,0) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/21yvp1358292494.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.range,type='b',ylab='range',main='Range Plot',xlab='Periodic Index') > mtext(paste('# blocks = ',np)) > abline(overall.range,0) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/3im0i1358292494.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.iqr,type='b',ylab='IQR',main='Interquartile Range Plot',xlab='Periodic Index') > mtext(paste('# blocks = ',np)) > abline(overall.iqr,0) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/4yknv1358292494.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(arr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 103.240 103.430 103.430 109.570 109.39 110.56 110.56 110.56 110.980 109.43 [2,] 105.380 105.380 108.370 109.570 109.39 110.56 110.56 110.56 110.980 109.43 [3,] 110.425 110.425 110.425 111.225 110.69 111.25 111.25 111.25 111.365 111.17 [4,] 111.560 111.890 111.890 111.890 112.02 112.02 112.02 112.02 111.930 111.93 [5,] 111.780 111.890 111.890 112.210 112.05 112.05 112.06 112.05 112.020 112.02 [,11] [,12] [1,] 109.43 109.57 [2,] 109.43 109.57 [3,] 111.57 111.32 [4,] 111.93 111.78 [5,] 112.02 111.93 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 106.4387 106.2258 108.1545 109.7285 108.9936 110.3083 110.3083 110.3083 [2,] 114.4113 114.6242 112.6955 112.7215 112.3864 112.1917 112.1917 112.1917 [,9] [,10] [,11] [,12] [1,] 110.7522 109.5574 109.9574 109.8945 [2,] 111.9778 112.7826 113.1826 112.7455 $out [1] 103.43 103.31 103.31 103.31 103.31 104.06 104.80 105.36 105.38 $group [1] 4 5 6 7 8 9 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(103.24, 105.38, 110.425, 111.56, 111.78, 103.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/52b871358292494.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(arr) > names(z) <- c(1:np) > (boxplot(z,notch=TRUE,col='grey',xlab='Block Index',ylab='Value',main='Notched Box Plots - Sequential Blocks')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 103.24 108.370 111.78 109.430 109.39 110.820 NA [2,] 103.31 109.865 111.89 110.065 109.57 110.820 NA [3,] 103.43 111.360 112.02 110.560 111.68 111.270 NA [4,] 104.43 112.050 112.02 111.280 111.93 111.835 NA [5,] 105.38 112.210 112.02 111.370 111.93 111.890 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 102.9192 110.3634 111.9607 110.0058 110.6036 110.8071 NA [2,] 103.9408 112.3566 112.0793 111.1142 112.7564 111.7329 NA $out [1] 105.38 105.38 111.28 $group [1] 2 2 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(103.24, 103.31, 103.43, 104.43, 105.38, 108.37, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6xjxf1358292494.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(cbind(arr.sd,arr.range,arr.iqr)) > names(z) <- list('S.D.','Range','IQR') > (boxplot(z,notch=TRUE,col='grey',ylab='Overall Variability',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 2.515112 6.55 0.7150 [2,] 2.914803 7.59 1.3100 [3,] 3.308731 8.50 1.9750 [4,] 3.371496 8.74 2.5700 [5,] 3.641553 8.78 3.0675 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.100429 7.975477 1.400306 [2,] 3.517032 9.024523 2.549694 $out [1] 5.0625 5.3100 $group [1] 3 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.51511166087446, 2.91480282248295, 3.30873050042618, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/11b941358292494.ps tmp/11b941358292494.png",intern=TRUE)) character(0) > try(system("convert tmp/21yvp1358292494.ps tmp/21yvp1358292494.png",intern=TRUE)) character(0) > try(system("convert tmp/3im0i1358292494.ps tmp/3im0i1358292494.png",intern=TRUE)) character(0) > try(system("convert tmp/4yknv1358292494.ps tmp/4yknv1358292494.png",intern=TRUE)) character(0) > try(system("convert tmp/52b871358292494.ps tmp/52b871358292494.png",intern=TRUE)) character(0) > try(system("convert tmp/6xjxf1358292494.ps tmp/6xjxf1358292494.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.980 0.846 3.843