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(50,45,43,40,43,47,44,41,31,41,40,31,43,22,17,21,29,23,15,24,24,27,17,22,26,12,13,20,15,23,27,17,22,16,20,8,24,18,28,25,11,33,34,23,13,23,26,15,29,23,26,17,32,25,26,32,24,24,28,26,27,45,47,29,40,25,35,26,32,21,32,16,35,19,28,29,29,26,35,38,27,28,29,26,40,20,28,34,38,32,51,27,23,44,37,26) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 50 43 26 24 29 27 35 40 NA [2,] 45 22 12 18 23 45 19 20 NA [3,] 43 17 13 28 26 47 28 28 NA [4,] 40 21 20 25 17 29 29 34 NA [5,] 43 29 15 11 32 40 29 38 NA [6,] 47 23 23 33 25 25 26 32 NA [7,] 44 15 27 34 26 35 35 51 NA [8,] 41 24 17 23 32 26 38 27 NA [9,] 31 24 22 13 24 32 27 23 NA [10,] 41 27 16 23 24 21 28 44 NA [11,] 40 17 20 26 28 32 29 37 NA [12,] 31 22 8 15 26 16 26 26 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/1pq541425993798.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/280y01425993798.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/32jrc1425993798.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/445r61425993798.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,] 24.0 12.0 13.0 17.0 11.0 23.0 15.0 17.0 13.0 16.0 17.0 8.0 [2,] 26.5 18.5 21.5 20.5 22.0 24.0 26.5 23.5 22.5 22.0 23.0 15.5 [3,] 32.0 21.0 28.0 27.0 30.5 25.5 34.5 26.5 24.0 25.5 28.5 24.0 [4,] 41.5 34.0 35.5 31.5 39.0 32.5 39.5 35.0 29.0 34.5 34.5 26.0 [5,] 50.0 45.0 47.0 40.0 43.0 33.0 51.0 41.0 32.0 44.0 40.0 31.0 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 23.62078 12.34148 20.1794 20.85524 21.00356 20.75178 27.23801 20.07593 [2,] 40.37922 29.65852 35.8206 33.14476 39.99644 30.24822 41.76199 32.92407 [,9] [,10] [,11] [,12] [1,] 20.36901 18.51732 22.07593 18.13455 [2,] 27.63099 32.48268 34.92407 29.86545 $out [1] 47 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(24, 26.5, 32, 41.5, 50, 12, 18.5, 21, 34, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5yadh1425993798.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] [1,] 40.0 15.0 8.0 11.0 23.0 16.0 19.0 20.0 NA [2,] 40.0 19.0 14.0 16.5 24.0 25.5 26.5 26.5 NA [3,] 42.0 22.5 18.5 23.5 26.0 30.5 28.5 33.0 NA [4,] 44.5 25.5 22.5 27.0 28.5 37.5 32.0 39.0 NA [5,] 50.0 29.0 27.0 34.0 32.0 47.0 38.0 51.0 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 39.94752 19.53531 14.62309 18.71088 23.94752 25.02672 25.99141 27.29867 [2,] 44.05248 25.46469 22.37691 28.28912 28.05248 35.97328 31.00859 38.70133 [,9] [1,] NA [2,] NA $out [1] 31 31 43 17 $group [1] 1 1 2 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(40, 40, 42, 44.5, 50, 15, 19, 22.5, 25.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/60b2w1425993798.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,] 5.928141 19.0 7.750 [2,] 7.758405 23.0 8.375 [3,] 8.733073 25.0 9.625 [4,] 11.292259 32.5 10.375 [5,] 12.478553 36.0 13.000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.121258 20.66699 8.712787 [2,] 10.344887 29.33301 10.537213 $out [1] 14.00 5.25 $group [1] 3 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(5.92814112035612, 7.75840495170864, 8.73307270102099, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1pq541425993798.ps tmp/1pq541425993798.png",intern=TRUE)) character(0) > try(system("convert tmp/280y01425993798.ps tmp/280y01425993798.png",intern=TRUE)) character(0) > try(system("convert tmp/32jrc1425993798.ps tmp/32jrc1425993798.png",intern=TRUE)) character(0) > try(system("convert tmp/445r61425993798.ps tmp/445r61425993798.png",intern=TRUE)) character(0) > try(system("convert tmp/5yadh1425993798.ps tmp/5yadh1425993798.png",intern=TRUE)) character(0) > try(system("convert tmp/60b2w1425993798.ps tmp/60b2w1425993798.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.086 0.342 2.451