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(1.4,1.5,1.8,1.8,1.8,1.7,1.5,1.1,1.3,1.6,1.9,1.9,2,2.2,2.2,2,2.3,2.6,3.2,3.2,3.1,2.8,2.3,1.9,1.9,2,2,1.8,1.6,1.4,0.2,0.3,0.4,0.7,1,1.1,0.8,0.8,1,1.1,1,0.8,1.6,1.5,1.6,1.6,1.6,1.9,2,1.9,2,2.1,2.3,2.3,2.6,2.6,2.7,2.6,2.6,2.4,2.5,2.5,2.5,2.4,2.1,2.1,2.3,2.3,2.3,2.9,2.8,2.9,3,3,2.9,2.6,2.8,2.9,3.1,2.8,2.4,1.6,1.5,1.7) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.4 2.0 1.9 0.8 2.0 2.5 3.0 NA [2,] 1.5 2.2 2.0 0.8 1.9 2.5 3.0 NA [3,] 1.8 2.2 2.0 1.0 2.0 2.5 2.9 NA [4,] 1.8 2.0 1.8 1.1 2.1 2.4 2.6 NA [5,] 1.8 2.3 1.6 1.0 2.3 2.1 2.8 NA [6,] 1.7 2.6 1.4 0.8 2.3 2.1 2.9 NA [7,] 1.5 3.2 0.2 1.6 2.6 2.3 3.1 NA [8,] 1.1 3.2 0.3 1.5 2.6 2.3 2.8 NA [9,] 1.3 3.1 0.4 1.6 2.7 2.3 2.4 NA [10,] 1.6 2.8 0.7 1.6 2.6 2.9 1.6 NA [11,] 1.9 2.3 1.0 1.6 2.6 2.8 1.5 NA [12,] 1.9 1.9 1.1 1.9 2.4 2.9 1.7 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/1b6401417684915.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/2wwkd1417684915.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/3cunv1417684915.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/4b1d11417684915.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,] 0.80 0.80 1.80 1.80 1.0 0.80 0.20 0.3 0.40 0.7 1.00 1.70 [2,] 1.65 1.70 1.90 1.80 1.7 1.55 1.55 1.3 1.45 1.6 1.55 1.80 [3,] 2.00 2.00 2.00 2.00 2.1 2.10 2.30 2.3 2.30 1.6 1.90 1.90 [4,] 2.25 2.35 2.35 2.25 2.3 2.45 2.85 2.7 2.55 2.7 2.45 2.15 [5,] 3.00 3.00 2.90 2.60 2.8 2.90 3.20 3.2 3.10 2.9 2.80 2.40 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.64169 1.61183 1.731267 1.731267 1.74169 1.562535 1.523661 1.463943 [2,] 2.35831 2.38817 2.268733 2.268733 2.45831 2.637465 3.076339 3.136057 [,9] [,10] [,11] [,12] [1,] 1.643098 0.9430977 1.362535 1.690986 [2,] 2.956902 2.2569023 2.437465 2.109014 $out [1] 1.0 1.1 1.1 2.9 $group [1] 3 4 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.8, 1.65, 2, 2.25, 3, 0.8, 1.7, 2, 2.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/50g9a1417684915.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] [1,] 1.10 1.90 0.20 0.8 1.90 2.10 1.50 NA [2,] 1.45 2.10 0.55 0.9 2.05 2.30 2.05 NA [3,] 1.65 2.30 1.25 1.3 2.35 2.45 2.80 NA [4,] 1.80 2.95 1.85 1.6 2.60 2.65 2.95 NA [5,] 1.90 3.20 2.00 1.9 2.70 2.90 3.10 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.490363 1.912309 0.6570613 0.9807253 2.099141 2.290363 2.389504 NA [2,] 1.809637 2.687691 1.8429387 1.6192747 2.600859 2.609637 3.210496 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(1.1, 1.45, 1.65, 1.8, 1.9, 1.9, 2.1, 2.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6a73b1417684915.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.4855042 1.50 0.350 [2,] 0.5877387 1.80 0.525 [3,] 0.7086146 2.15 0.775 [4,] 0.8703581 2.45 1.100 [5,] 1.0578505 3.00 1.400 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.5797100 1.853531 0.5127386 [2,] 0.8375192 2.446469 1.0372614 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.485504156227612, 0.587738686192067, 0.708614634591655, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1b6401417684915.ps tmp/1b6401417684915.png",intern=TRUE)) character(0) > try(system("convert tmp/2wwkd1417684915.ps tmp/2wwkd1417684915.png",intern=TRUE)) character(0) > try(system("convert tmp/3cunv1417684915.ps tmp/3cunv1417684915.png",intern=TRUE)) character(0) > try(system("convert tmp/4b1d11417684915.ps tmp/4b1d11417684915.png",intern=TRUE)) character(0) > try(system("convert tmp/50g9a1417684915.ps tmp/50g9a1417684915.png",intern=TRUE)) character(0) > try(system("convert tmp/6a73b1417684915.ps tmp/6a73b1417684915.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.132 0.372 2.534