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(10,9.99,9.95,9.96,9.97,9.95,9.94,9.9,9.9,9.92,9.87,9.96,9.94,9.96,9.96,9.89,9.82,9.83,9.83,9.82,9.77,9.66,9.69,9.67,9.7,9.77,9.79,9.81,9.77,9.78,9.77,9.79,9.77,9.77,9.8,9.8,9.8,9.8,9.76,9.78,9.77,9.79,9.81,9.82,9.84,9.87,9.99,9.99,9.99,10.08,10.06,10.08,10.07,10.04,10.04,10.12,10.1,10.11,10.13,10.16,10.15,10.25,10.41,10.46,10.46,10.5,10.5,10.48,10.5,10.5,10.53,10.53) > 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,] 10.00 9.94 9.70 9.80 9.99 10.15 NA [2,] 9.99 9.96 9.77 9.80 10.08 10.25 NA [3,] 9.95 9.96 9.79 9.76 10.06 10.41 NA [4,] 9.96 9.89 9.81 9.78 10.08 10.46 NA [5,] 9.97 9.82 9.77 9.77 10.07 10.46 NA [6,] 9.95 9.83 9.78 9.79 10.04 10.50 NA [7,] 9.94 9.83 9.77 9.81 10.04 10.50 NA [8,] 9.90 9.82 9.79 9.82 10.12 10.48 NA [9,] 9.90 9.77 9.77 9.84 10.10 10.50 NA [10,] 9.92 9.66 9.77 9.87 10.11 10.50 NA [11,] 9.87 9.69 9.80 9.99 10.13 10.53 NA [12,] 9.96 9.67 9.80 9.99 10.16 10.53 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/wessaorg/rcomp/tmp/1ks8l1355076009.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/wessaorg/rcomp/tmp/2nj7g1355076009.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/wessaorg/rcomp/tmp/31c8b1355076009.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/wessaorg/rcomp/tmp/4myh11355076010.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] [1,] 9.700 9.770 9.760 9.780 9.770 9.78 9.770 9.79 9.77 9.660 9.69 [2,] 9.800 9.800 9.790 9.810 9.770 9.79 9.810 9.82 9.77 9.770 9.80 [3,] 9.965 9.975 9.955 9.925 9.895 9.89 9.885 9.86 9.87 9.895 9.93 [4,] 10.000 10.080 10.060 10.080 10.070 10.04 10.040 10.12 10.10 10.110 10.13 [5,] 10.150 10.250 10.410 10.460 10.460 10.04 10.040 10.48 10.50 10.500 10.53 [,12] [1,] 9.670 [2,] 9.800 [3,] 9.975 [4,] 10.160 [5,] 10.530 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9.835994 9.794391 9.780841 9.750841 9.70149 9.728742 9.736643 [2,] 10.094006 10.155609 10.129159 10.099159 10.08851 10.051258 10.033357 [,8] [,9] [,10] [,11] [,12] [1,] 9.66649 9.657139 9.675689 9.717139 9.742788 [2,] 10.05351 10.082861 10.114311 10.142861 10.207212 $out [1] 10.5 10.5 $group [1] 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(9.7, 9.8, 9.965, 10, 10.15, 9.77, 9.8, 9.975, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5tkhh1355076010.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,] 9.870 9.660 9.770 9.760 9.990 10.410 NA [2,] 9.910 9.730 9.770 9.785 10.050 10.435 NA [3,] 9.950 9.825 9.775 9.805 10.080 10.490 NA [4,] 9.965 9.915 9.795 9.855 10.115 10.500 NA [5,] 10.000 9.960 9.810 9.870 10.160 10.530 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9.924914 9.74062 9.763597 9.773073 10.05035 10.46035 NA [2,] 9.975086 9.90938 9.786403 9.836927 10.10965 10.51965 NA $out [1] 9.70 9.99 9.99 10.15 10.25 $group [1] 3 4 4 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(9.87, 9.91, 9.95, 9.965, 10, 9.66, 9.73, 9.825, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6g1hp1355076010.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.1787456 0.650 0.16250 [2,] 0.2433433 0.665 0.21125 [3,] 0.2709140 0.705 0.23250 [4,] 0.2910916 0.785 0.26500 [5,] 0.3016897 0.860 0.27750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2491356 0.6502672 0.2079843 [2,] 0.2926923 0.7597328 0.2570157 $out [1] 0.1592482 0.4500000 0.4800000 $group [1] 1 2 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.178745629317195, 0.243343301014599, 0.270913964757171, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ks8l1355076009.ps tmp/1ks8l1355076009.png",intern=TRUE)) character(0) > try(system("convert tmp/2nj7g1355076009.ps tmp/2nj7g1355076009.png",intern=TRUE)) character(0) > try(system("convert tmp/31c8b1355076009.ps tmp/31c8b1355076009.png",intern=TRUE)) character(0) > try(system("convert tmp/4myh11355076010.ps tmp/4myh11355076010.png",intern=TRUE)) character(0) > try(system("convert tmp/5tkhh1355076010.ps tmp/5tkhh1355076010.png",intern=TRUE)) character(0) > try(system("convert tmp/6g1hp1355076010.ps tmp/6g1hp1355076010.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.094 0.746 5.863