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(6.81,6.8,6.8,6.85,6.85,6.85,6.85,6.85,6.85,6.86,6.86,6.88,6.88,6.88,6.91,6.91,6.91,6.91,6.99,6.99,6.99,7.02,7.02,7.05,7.05,7.05,7.05,7.1,7.1,7.1,7.1,7.12,7.13,7.18,7.24,7.24,7.24,7.27,7.27,7.27,7.27,7.3,7.3,7.57,7.76,7.94,7.94,7.96,7.96,7.98,7.99,8,8,8.04,8.04,8.04,8.04,8.04,8.07,8.07,8.07,8.07,8.11,8.11,8.12,8.11,8.13,8.15,8.16,8.2,8.2,8.2) > 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,] 6.81 6.88 7.05 7.24 7.96 8.07 NA [2,] 6.80 6.88 7.05 7.27 7.98 8.07 NA [3,] 6.80 6.91 7.05 7.27 7.99 8.11 NA [4,] 6.85 6.91 7.10 7.27 8.00 8.11 NA [5,] 6.85 6.91 7.10 7.27 8.00 8.12 NA [6,] 6.85 6.91 7.10 7.30 8.04 8.11 NA [7,] 6.85 6.99 7.10 7.30 8.04 8.13 NA [8,] 6.85 6.99 7.12 7.57 8.04 8.15 NA [9,] 6.85 6.99 7.13 7.76 8.04 8.16 NA [10,] 6.86 7.02 7.18 7.94 8.04 8.20 NA [11,] 6.86 7.02 7.24 7.94 8.07 8.20 NA [12,] 6.88 7.05 7.24 7.96 8.07 8.20 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/1bcvt1354186797.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/26tkw1354186797.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/3nvnx1354186797.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/4jw6f1354186797.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,] 6.810 6.80 6.80 6.850 6.850 6.85 6.85 6.850 6.850 6.86 6.86 6.88 [2,] 6.880 6.88 6.91 6.910 6.910 6.91 6.99 6.990 6.990 7.02 7.02 7.05 [3,] 7.145 7.16 7.16 7.185 7.185 7.20 7.20 7.345 7.445 7.56 7.59 7.60 [4,] 7.960 7.98 7.99 8.000 8.000 8.04 8.04 8.040 8.040 8.04 8.07 8.07 [5,] 8.070 8.07 8.11 8.110 8.120 8.11 8.13 8.150 8.160 8.20 8.20 8.20 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.448365 6.450464 6.463365 6.481915 6.481915 6.471114 6.522716 6.667716 [2,] 7.841635 7.869536 7.856635 7.888085 7.888085 7.928886 7.877284 8.022284 [,9] [,10] [,11] [,12] [1,] 6.767716 6.902067 6.912716 6.942067 [2,] 8.122284 8.217933 8.267284 8.257933 $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(6.81, 6.88, 7.145, 7.96, 8.07, 6.8, 6.88, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/57ljb1354186797.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,] 6.800 6.880 7.050 7.24 7.960 8.070 NA [2,] 6.830 6.910 7.075 7.27 7.995 8.110 NA [3,] 6.850 6.950 7.100 7.30 8.040 8.125 NA [4,] 6.855 7.005 7.155 7.85 8.040 8.180 NA [5,] 6.880 7.050 7.240 7.96 8.070 8.200 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.838597 6.90667 7.063511 7.035458 8.019475 8.093073 NA [2,] 6.861403 6.99333 7.136489 7.564542 8.060525 8.156927 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(6.8, 6.83, 6.85, 6.855, 6.88, 6.88, 6.91, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6yf2t1354186797.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.5484068 1.260 0.83750 [2,] 0.5511101 1.265 0.86000 [3,] 0.5558417 1.290 0.88875 [4,] 0.5716370 1.315 0.94500 [5,] 0.5844656 1.340 0.96250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.5464792 1.267195 0.8499809 [2,] 0.5652042 1.312805 0.9275191 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.548406783327851, 0.551110084510166, 0.555841712884186, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1bcvt1354186797.ps tmp/1bcvt1354186797.png",intern=TRUE)) character(0) > try(system("convert tmp/26tkw1354186797.ps tmp/26tkw1354186797.png",intern=TRUE)) character(0) > try(system("convert tmp/3nvnx1354186797.ps tmp/3nvnx1354186797.png",intern=TRUE)) character(0) > try(system("convert tmp/4jw6f1354186797.ps tmp/4jw6f1354186797.png",intern=TRUE)) character(0) > try(system("convert tmp/57ljb1354186797.ps tmp/57ljb1354186797.png",intern=TRUE)) character(0) > try(system("convert tmp/6yf2t1354186797.ps tmp/6yf2t1354186797.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.355 0.519 3.868