R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(18.49,18.07,17.8,17.88,18.12,18.68,18.8,19.64,19.56,19.3,20.07,19.82,20.29,19.36,18.74,18.87,18.87,18.91,19.31,20.06,20.72,20.42,20.58,20.58,21.18,19.87,19.83,19.48,19.49,19.4,19.89,20.44,20.07,19.75,19.54,19.07,19.55,18.01,17.5,17.41,17.47,17.6,17.64,18.3,18.27,17.99,18.04,17.62,18.22,17.67,17.73,17.99,18.15,18.41,18.36,19.52,19.96,19.6,19.48,19.13) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 18.49 20.29 21.18 19.55 18.22 NA [2,] 18.07 19.36 19.87 18.01 17.67 NA [3,] 17.80 18.74 19.83 17.50 17.73 NA [4,] 17.88 18.87 19.48 17.41 17.99 NA [5,] 18.12 18.87 19.49 17.47 18.15 NA [6,] 18.68 18.91 19.40 17.60 18.41 NA [7,] 18.80 19.31 19.89 17.64 18.36 NA [8,] 19.64 20.06 20.44 18.30 19.52 NA [9,] 19.56 20.72 20.07 18.27 19.96 NA [10,] 19.30 20.42 19.75 17.99 19.60 NA [11,] 20.07 20.58 19.54 18.04 19.48 NA [12,] 19.82 20.58 19.07 17.62 19.13 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/1xz311335439647.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/2xohb1335439647.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/369gx1335439647.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/47jxv1335439647.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,] 18.22 17.67 17.50 17.41 17.47 18.41 17.64 19.52 19.56 19.30 19.48 19.07 [2,] 18.49 18.01 17.73 17.88 18.12 18.41 18.36 19.52 19.56 19.30 19.48 19.07 [3,] 19.55 18.07 17.80 17.99 18.15 18.68 18.80 19.64 19.96 19.60 19.54 19.13 [4,] 20.29 19.36 18.74 18.87 18.87 18.91 19.31 20.06 20.07 19.75 20.07 19.82 [5,] 21.18 19.87 19.83 19.48 19.49 19.40 19.89 20.44 20.72 20.42 20.58 20.58 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 18.27812 17.11609 17.08634 17.29047 17.62005 18.3267 18.12873 19.25844 [2,] 20.82188 19.02391 18.51366 18.68953 18.67995 19.0333 19.47127 20.02156 [,9] [,10] [,11] [,12] [1,] 19.59964 19.28203 19.12311 18.60005 [2,] 20.32036 19.91797 19.95689 19.65995 $out [1] 17.60 18.30 18.27 17.99 18.04 17.62 $group [1] 6 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(18.22, 18.49, 19.55, 20.29, 21.18, 17.67, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5eimv1335439647.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] [1,] 17.800 18.74 19.070 17.410 17.670 NA [2,] 18.095 18.89 19.485 17.550 18.070 NA [3,] 18.740 19.71 19.790 17.815 18.385 NA [4,] 19.600 20.50 19.980 18.155 19.500 NA [5,] 20.070 20.72 20.440 18.300 19.960 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 18.05356 18.97567 19.56423 17.53906 17.73277 NA [2,] 19.42644 20.44433 20.01577 18.09094 19.03723 NA $out [1] 21.18 19.55 $group [1] 3 4 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(17.8, 18.095, 18.74, 19.6, 20.07, 18.74, 18.89, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6va6b1335439647.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.6668208 1.800 0.450 [2,] 0.8209871 2.105 0.525 [3,] 0.9019391 2.290 0.750 [4,] 0.9638196 2.495 1.000 [5,] 1.0951393 2.960 1.350 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.8367922 2.112118 0.5333493 [2,] 0.9670860 2.467882 0.9666507 $out [1] 1.234597 1.800000 $group [1] 1 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.666820815511933, 0.820987094342573, 0.901939109605215, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xz311335439647.ps tmp/1xz311335439647.png",intern=TRUE)) character(0) > try(system("convert tmp/2xohb1335439647.ps tmp/2xohb1335439647.png",intern=TRUE)) character(0) > try(system("convert tmp/369gx1335439647.ps tmp/369gx1335439647.png",intern=TRUE)) character(0) > try(system("convert tmp/47jxv1335439647.ps tmp/47jxv1335439647.png",intern=TRUE)) character(0) > try(system("convert tmp/5eimv1335439647.ps tmp/5eimv1335439647.png",intern=TRUE)) character(0) > try(system("convert tmp/6va6b1335439647.ps tmp/6va6b1335439647.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.334 0.307 1.691