R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(20,23,27,23,21,18,16,11,14,-3,2,26,11,11,11,3,8,8,7,3,4,-7,0,-5,5,-1,-4,4,7,6,13,20,21,37,52,59,66,73,71,69,63,68,58,50,50,50,47,60,62,63,56,38,45,39,26,25,19,14,6,4,5,-3,-5,0,-6,4,-3,14,16,17,25,25,30,51,31,31,25,35,39,48,41,47,61,55,63,45,62,55,50,52,45,36,40,32,29,24,28,27,33,33,24,26,38,32,30,26,21,21) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 20 11 5 66 62 5 30 63 28 NA [2,] 23 11 -1 73 63 -3 51 45 27 NA [3,] 27 11 -4 71 56 -5 31 62 33 NA [4,] 23 3 4 69 38 0 31 55 33 NA [5,] 21 8 7 63 45 -6 25 50 24 NA [6,] 18 8 6 68 39 4 35 52 26 NA [7,] 16 7 13 58 26 -3 39 45 38 NA [8,] 11 3 20 50 25 14 48 36 32 NA [9,] 14 4 21 50 19 16 41 40 30 NA [10,] -3 -7 37 50 14 17 47 32 26 NA [11,] 2 0 52 47 6 25 61 29 21 NA [12,] 26 -5 59 60 4 25 55 24 21 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/1nqk71432992373.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/2xt721432992373.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/3igxa1432992373.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/4du791432992373.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,] 5 -3 -5 0 -6 4 -3 3 4 -7 0 -5 [2,] 11 11 11 4 8 8 13 14 16 14 6 21 [3,] 28 27 31 31 24 26 26 25 21 26 25 25 [4,] 62 51 56 38 45 39 39 36 40 37 47 55 [5,] 66 73 71 69 63 68 58 50 50 50 61 60 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1.14 5.933333 7.3 13.09333 4.513333 9.673333 12.30667 13.41333 8.36 [2,] 54.86 48.066667 54.7 48.90667 43.486667 42.326667 39.69333 36.58667 33.64 [,10] [,11] [,12] [1,] 13.88667 3.406667 7.093333 [2,] 38.11333 46.593333 42.906667 $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(5, 11, 28, 62, 66, -3, 11, 27, 51, 73, -5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5o2jp1432992373.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] [,8] [,9] [,10] [1,] -3.0 -7.0 -4.0 47.0 4.0 -6.0 25.0 24.0 21.0 NA [2,] 12.5 1.5 4.5 50.0 16.5 -3.0 31.0 34.0 25.0 NA [3,] 19.0 5.5 10.0 61.5 32.0 4.5 40.0 45.0 27.5 NA [4,] 23.0 9.5 29.0 68.5 50.5 16.5 49.5 53.5 32.5 NA [5,] 27.0 11.0 59.0 73.0 63.0 25.0 61.0 63.0 38.0 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 14.21088 1.851146 -1.174614 53.06203 16.49237 -4.394081 31.56203 36.10592 [2,] 23.78912 9.148854 21.174614 69.93797 47.50763 13.394081 48.43797 53.89408 [,9] [,10] [1,] 24.0792 NA [2,] 30.9208 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(-3, 12.5, 19, 23, 27, -7, 1.5, 5.5, 9.5, 11, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/69leo1432992373.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,] 15.06191 46.0 22.0 [2,] 20.07131 59.0 25.0 [3,] 22.44992 62.5 34.0 [4,] 24.52620 69.0 40.5 [5,] 27.67219 76.0 51.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 20.41801 57.93893 26.93035 [2,] 24.48183 67.06107 41.06965 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(15.0619092784119, 20.0713105732428, 22.4499194636885, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1nqk71432992373.ps tmp/1nqk71432992373.png",intern=TRUE)) character(0) > try(system("convert tmp/2xt721432992373.ps tmp/2xt721432992373.png",intern=TRUE)) character(0) > try(system("convert tmp/3igxa1432992373.ps tmp/3igxa1432992373.png",intern=TRUE)) character(0) > try(system("convert tmp/4du791432992373.ps tmp/4du791432992373.png",intern=TRUE)) character(0) > try(system("convert tmp/5o2jp1432992373.ps tmp/5o2jp1432992373.png",intern=TRUE)) character(0) > try(system("convert tmp/69leo1432992373.ps tmp/69leo1432992373.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.129 0.446 2.563