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(7.66,7.53,7.54,7.56,7.57,7.56,7.57,7.61,7.61,7.6,7.61,7.61,7.62,7.7,7.73,7.75,7.76,7.76,7.77,7.79,7.79,7.79,7.83,7.83,7.88,7.95,8.01,8.05,8.1,8.1,8.16,8.18,8.2,7.99,8.01,8.02,8.03,8.04,8.07,8.08,8.08,8.1,8.11,8.15,8.16,8.17,8.18,8.15,8.15,8.17,8.16,8.15,8.16,8.15,8.18,8.19,8.18,8.2,8.21,8.22,8.23,8.25,8.28,8.28,8.29,8.3,8.34,8.38,8.39,8.44,8.46,8.46) > 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,] 7.66 7.62 7.88 8.03 8.15 8.23 NA [2,] 7.53 7.70 7.95 8.04 8.17 8.25 NA [3,] 7.54 7.73 8.01 8.07 8.16 8.28 NA [4,] 7.56 7.75 8.05 8.08 8.15 8.28 NA [5,] 7.57 7.76 8.10 8.08 8.16 8.29 NA [6,] 7.56 7.76 8.10 8.10 8.15 8.30 NA [7,] 7.57 7.77 8.16 8.11 8.18 8.34 NA [8,] 7.61 7.79 8.18 8.15 8.19 8.38 NA [9,] 7.61 7.79 8.20 8.16 8.18 8.39 NA [10,] 7.60 7.79 7.99 8.17 8.20 8.44 NA [11,] 7.61 7.83 8.01 8.18 8.21 8.46 NA [12,] 7.61 7.83 8.02 8.15 8.22 8.46 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/10rz71355322945.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/269tv1355322945.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/3ppg91355322945.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/4cvgr1355322945.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] [,11] [,12] [1,] 7.620 7.530 7.54 7.560 7.57 7.56 7.570 7.610 7.61 7.60 7.610 7.610 [2,] 7.660 7.700 7.73 7.750 7.76 7.76 7.770 7.790 7.79 7.79 7.830 7.830 [3,] 7.955 7.995 8.04 8.065 8.09 8.10 8.135 8.165 8.17 8.08 8.095 8.085 [4,] 8.150 8.170 8.16 8.150 8.16 8.15 8.180 8.190 8.20 8.20 8.210 8.220 [5,] 8.230 8.250 8.28 8.280 8.29 8.30 8.340 8.380 8.39 8.44 8.460 8.460 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.638934 7.691835 7.762636 7.806987 7.831987 7.848437 7.870537 7.906987 [2,] 8.271066 8.298165 8.317364 8.323013 8.348013 8.351563 8.399463 8.423013 [,9] [,10] [,11] [,12] [1,] 7.905537 7.815537 7.849888 7.833437 [2,] 8.434463 8.344463 8.340112 8.336563 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(7.62, 7.66, 7.955, 8.15, 8.23, 7.53, 7.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/55d9e1355322945.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,] 7.530 7.700 7.880 8.030 8.150 8.230 NA [2,] 7.560 7.740 8.000 8.075 8.155 8.280 NA [3,] 7.585 7.765 8.035 8.105 8.175 8.320 NA [4,] 7.610 7.790 8.130 8.155 8.195 8.415 NA [5,] 7.660 7.830 8.200 8.180 8.220 8.460 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 7.562195 7.742195 7.975706 8.068511 8.156756 8.258426 NA [2,] 7.607805 7.787805 8.094294 8.141489 8.193244 8.381574 NA $out [1] 7.62 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(7.53, 7.56, 7.585, 7.61, 7.66, 7.7, 7.74, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6w9h81355322945.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,] 0.2529361 0.610 0.2925 [2,] 0.2741909 0.720 0.3075 [3,] 0.2832775 0.755 0.3225 [4,] 0.2962936 0.810 0.3450 [5,] 0.3035402 0.850 0.3750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2731963 0.7139504 0.305396 [2,] 0.2933586 0.7960496 0.339604 $out [1] 0.405 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.252936092060162, 0.274190870829342, 0.28327745019338, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/10rz71355322945.ps tmp/10rz71355322945.png",intern=TRUE)) character(0) > try(system("convert tmp/269tv1355322945.ps tmp/269tv1355322945.png",intern=TRUE)) character(0) > try(system("convert tmp/3ppg91355322945.ps tmp/3ppg91355322945.png",intern=TRUE)) character(0) > try(system("convert tmp/4cvgr1355322945.ps tmp/4cvgr1355322945.png",intern=TRUE)) character(0) > try(system("convert tmp/55d9e1355322945.ps tmp/55d9e1355322945.png",intern=TRUE)) character(0) > try(system("convert tmp/6w9h81355322945.ps tmp/6w9h81355322945.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.224 0.868 4.082