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(53,47,49,44,48,51,47,44,33,47,41,36,46,24,17,22,30,24,18,24,24,28,19,22,26,14,16,21,15,23,29,17,24,18,22,8,26,22,34,25,20,35,38,24,14,25,31,17,32,27,30,19,36,27,28,38,26,25,30,27,30,50,48,34,41,26,39,33,38,28,36,20,39,22,32,32,31,28,44,40,32,35,32,31,41,23,36,36,42,36,64,30,25,51,38,27) > 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,] 53 46 26 26 32 30 39 41 NA [2,] 47 24 14 22 27 50 22 23 NA [3,] 49 17 16 34 30 48 32 36 NA [4,] 44 22 21 25 19 34 32 36 NA [5,] 48 30 15 20 36 41 31 42 NA [6,] 51 24 23 35 27 26 28 36 NA [7,] 47 18 29 38 28 39 44 64 NA [8,] 44 24 17 24 38 33 40 30 NA [9,] 33 24 24 14 26 38 32 25 NA [10,] 47 28 18 25 25 28 35 51 NA [11,] 41 19 22 31 30 36 32 38 NA [12,] 36 22 8 17 27 20 31 27 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/1m1yi1420276249.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/2tv6e1420276249.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/354q91420276249.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/4vq741420276249.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,] 26.0 14.0 16.0 19.0 15.0 23.0 18.0 17.0 14.0 18 19.0 8.0 [2,] 28.0 22.0 23.5 21.5 25.0 25.0 28.5 24.0 24.0 25 26.0 18.5 [3,] 35.5 23.5 33.0 28.5 33.5 27.5 38.5 31.5 25.5 28 31.5 24.5 [4,] 43.5 37.0 42.0 35.0 41.5 35.5 45.5 39.0 32.5 41 37.0 29.0 [5,] 53.0 50.0 49.0 44.0 48.0 51.0 64.0 44.0 38.0 51 41.0 36.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,] 26.84148 15.12078 22.66563 20.95871 24.28286 21.63455 29.00356 23.12078 [2,] 44.15852 31.87922 43.33437 36.04129 42.71714 33.36545 47.99644 39.87922 [,9] [,10] [,11] [,12] [1,] 20.75178 19.06217 25.35524 18.63455 [2,] 30.24822 36.93783 37.64476 30.36545 $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(26, 28, 35.5, 43.5, 53, 14, 22, 23.5, 37, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5o3581420276249.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,] 36.0 17.0 8.0 14.0 25.0 20 22 23.0 NA [2,] 42.5 20.5 15.5 21.0 26.5 29 31 28.5 NA [3,] 47.0 24.0 19.5 25.0 27.5 35 32 36.0 NA [4,] 48.5 26.0 23.5 32.5 31.0 40 37 41.5 NA [5,] 53.0 30.0 29.0 38.0 36.0 50 44 51.0 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 44.26336 21.49141 15.85115 19.75477 25.44752 29.98283 29.26336 30.07061 [2,] 49.73664 26.50859 23.14885 30.24523 29.55248 40.01717 34.73664 41.92939 [,9] [1,] NA [2,] NA $out [1] 33 46 19 38 64 $group [1] 1 2 5 5 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(36, 42.5, 47, 48.5, 53, 17, 20.5, 24, 26, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/65c101420276249.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,] 7.309485 22 8.25 [2,] 8.745910 26 9.25 [3,] 9.541106 28 12.50 [4,] 11.845428 33 13.50 [5,] 14.009563 36 16.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 8.127395 24.80725 10.56155 [2,] 10.954818 31.19275 14.43845 $out [1] 46 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(7.30948503169488, 8.74590953513089, 9.54110623957726, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1m1yi1420276249.ps tmp/1m1yi1420276249.png",intern=TRUE)) character(0) > try(system("convert tmp/2tv6e1420276249.ps tmp/2tv6e1420276249.png",intern=TRUE)) character(0) > try(system("convert tmp/354q91420276249.ps tmp/354q91420276249.png",intern=TRUE)) character(0) > try(system("convert tmp/4vq741420276249.ps tmp/4vq741420276249.png",intern=TRUE)) character(0) > try(system("convert tmp/5o3581420276249.ps tmp/5o3581420276249.png",intern=TRUE)) character(0) > try(system("convert tmp/65c101420276249.ps tmp/65c101420276249.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.106 0.388 2.521