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(18.3,18.6,18.7,20.1,18.9,20.1,19.8,15.9,19.9,19.6,15.6,14.2,13.6,13.9,15,14.1,13.5,15.3,14.7,12.5,16.1,15.9,15.9,15.7,14.7,15.3,18.4,16.8,16.5,19.3,17.1,15.7,19.1,18.6,18.4,17.1,18.3,19.4,22.3,19.4,21.3,20.3,19.3,17.5,19.9,19.6,19.7,18.1,19.1,20.7,22.5,20,20.2,20.4,19.6,18.1,19.3,21,19.9,17.7,19.4,19.3,21.5,20.9,20.8,20.3,21.4,17.4,21.1,22,20.4,19) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 18.3 13.6 14.7 18.3 19.1 19.4 NA [2,] 18.6 13.9 15.3 19.4 20.7 19.3 NA [3,] 18.7 15.0 18.4 22.3 22.5 21.5 NA [4,] 20.1 14.1 16.8 19.4 20.0 20.9 NA [5,] 18.9 13.5 16.5 21.3 20.2 20.8 NA [6,] 20.1 15.3 19.3 20.3 20.4 20.3 NA [7,] 19.8 14.7 17.1 19.3 19.6 21.4 NA [8,] 15.9 12.5 15.7 17.5 18.1 17.4 NA [9,] 19.9 16.1 19.1 19.9 19.3 21.1 NA [10,] 19.6 15.9 18.6 19.6 21.0 22.0 NA [11,] 15.6 15.9 18.4 19.7 19.9 20.4 NA [12,] 14.2 15.7 17.1 18.1 17.7 19.0 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/1r5wg1416572575.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/26un81416572575.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/3dekd1416572575.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/4j2yj1416572575.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,] 13.6 13.90 15.0 14.1 13.50 19.3 14.70 15.70 19.1 15.9 15.60 14.2 [2,] 14.7 15.30 18.4 16.8 16.50 19.3 17.10 15.70 19.1 18.6 15.90 15.7 [3,] 18.3 18.95 20.1 19.7 19.55 20.2 19.45 16.65 19.6 19.6 19.05 17.4 [4,] 19.1 19.40 22.3 20.1 20.80 20.3 19.80 17.50 19.9 21.0 19.90 18.1 [5,] 19.4 20.70 22.5 20.9 21.30 20.4 21.40 18.10 19.9 22.0 20.40 19.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 15.46186 16.30537 17.58437 17.57139 16.77636 19.55497 17.70841 15.48894 [2,] 21.13814 21.59463 22.61563 21.82861 22.32364 20.84503 21.19159 17.81106 [,9] [,10] [,11] [,12] [1,] 19.08397 18.05192 16.46987 15.85192 [2,] 20.11603 21.14808 21.63013 18.94808 $out [1] 15.3 12.5 16.1 21.1 $group [1] 6 8 9 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(13.6, 14.7, 18.3, 19.1, 19.4, 13.9, 15.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5bnp21416572575.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] [1,] 14.20 12.50 14.7 17.5 17.70 17.40 NA [2,] 17.10 13.75 16.1 18.8 19.20 19.35 NA [3,] 18.80 14.85 17.1 19.5 19.95 20.60 NA [4,] 19.85 15.80 18.5 20.1 20.55 21.25 NA [5,] 20.10 16.10 19.3 21.3 22.50 22.00 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 17.54571 13.91498 16.00534 18.90706 19.33426 19.7334 NA [2,] 20.05429 15.78502 18.19466 20.09294 20.56574 21.4666 NA $out [1] 22.3 $group [1] 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(14.2, 17.1, 18.8, 19.85, 20.1, 12.5, 13.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6rluf1416572575.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,] 1.686021 4.80 0.7500 [2,] 2.015228 5.05 1.7625 [3,] 2.243094 5.95 2.3625 [4,] 2.624845 6.80 3.3125 [5,] 3.005772 7.80 3.6250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.965043 5.151813 1.655535 [2,] 2.521144 6.748187 3.069465 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.68602095676972, 2.01522843157392, 2.24309351965002, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1r5wg1416572575.ps tmp/1r5wg1416572575.png",intern=TRUE)) character(0) > try(system("convert tmp/26un81416572575.ps tmp/26un81416572575.png",intern=TRUE)) character(0) > try(system("convert tmp/3dekd1416572575.ps tmp/3dekd1416572575.png",intern=TRUE)) character(0) > try(system("convert tmp/4j2yj1416572575.ps tmp/4j2yj1416572575.png",intern=TRUE)) character(0) > try(system("convert tmp/5bnp21416572575.ps tmp/5bnp21416572575.png",intern=TRUE)) character(0) > try(system("convert tmp/6rluf1416572575.ps tmp/6rluf1416572575.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.245 0.396 2.664