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(7.8,8,8.1,8.2,8.1,7.7,6.9,6.6,6.7,7,7.1,7,6.9,6.8,6.8,7,7,6.8,6.7,6.6,6.4,6.4,6.4,6.5,6.6,6.5,6.3,6.2,6.1,6.5,7.1,7.2,6.9,6.2,6,6.2,6.9,7.4,7.8,7.8,7.7,7.7,7.6,7.6,7.7,8,8.2,8.4,8.2,8.1,8.1,8.2,8.3,8.4,8.5,8.3,8.1,7.9,7.7,7.6,7.4,7.3,7,6.8,6.8,6.9,7.3,7.5,7.5,7.2,7,6.9,7,7.1,7.1,7.2,7.3,7.3,7.2,7.5,8,8.7,9,9,8.8,8.5,8.5,8.5,8.5,8.6,8.7,8.8,8.8,8.7,8.7,8.8) > 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,] 7.8 6.9 6.6 6.9 8.2 7.4 7.0 8.8 NA [2,] 8.0 6.8 6.5 7.4 8.1 7.3 7.1 8.5 NA [3,] 8.1 6.8 6.3 7.8 8.1 7.0 7.1 8.5 NA [4,] 8.2 7.0 6.2 7.8 8.2 6.8 7.2 8.5 NA [5,] 8.1 7.0 6.1 7.7 8.3 6.8 7.3 8.5 NA [6,] 7.7 6.8 6.5 7.7 8.4 6.9 7.3 8.6 NA [7,] 6.9 6.7 7.1 7.6 8.5 7.3 7.2 8.7 NA [8,] 6.6 6.6 7.2 7.6 8.3 7.5 7.5 8.8 NA [9,] 6.7 6.4 6.9 7.7 8.1 7.5 8.0 8.8 NA [10,] 7.0 6.4 6.2 8.0 7.9 7.2 8.7 8.7 NA [11,] 7.1 6.4 6.0 8.2 7.7 7.0 9.0 8.7 NA [12,] 7.0 6.5 6.2 8.4 7.6 6.9 9.0 8.8 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/1xq101425895968.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/2aqa01425895968.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/3gobv1425895968.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/4a1an1425895968.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,] 6.6 6.50 6.30 6.2 6.1 6.50 6.70 6.60 6.40 6.20 6.00 6.2 [2,] 6.9 6.95 6.90 6.9 6.9 6.85 7.00 6.90 6.80 6.70 6.70 6.7 [3,] 7.2 7.35 7.45 7.5 7.5 7.50 7.25 7.50 7.60 7.55 7.40 7.3 [4,] 8.0 8.05 8.10 8.2 8.2 8.05 8.05 7.95 8.05 8.35 8.45 8.6 [5,] 8.8 8.50 8.50 8.5 8.5 8.60 8.70 8.80 8.80 8.70 9.00 9.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,] 6.585524 6.735524 6.779663 6.773801 6.773801 6.829663 6.663455 6.913455 [2,] 7.814476 7.964476 8.120337 8.226199 8.226199 8.170337 7.836545 8.086545 [,9] [,10] [,11] [,12] [1,] 6.901732 6.628286 6.422425 6.238633 [2,] 8.298268 8.471714 8.377575 8.361367 $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(6.6, 6.9, 7.2, 8, 8.8, 6.5, 6.95, 7.35, 8.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56nd61425895968.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,] 6.60 6.40 6.00 7.4 7.60 6.80 7.00 8.5 NA [2,] 6.95 6.45 6.20 7.6 8.00 6.90 7.15 8.5 NA [3,] 7.40 6.75 6.40 7.7 8.15 7.10 7.30 8.7 NA [4,] 8.05 6.85 6.75 7.9 8.30 7.35 8.35 8.8 NA [5,] 8.20 7.00 7.20 8.2 8.50 7.50 9.00 8.8 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.898283 6.567557 6.149141 7.563168 8.013168 6.894752 6.752672 8.563168 [2,] 7.901717 6.932443 6.650859 7.836832 8.286832 7.305248 7.847328 8.836832 [,9] [1,] NA [2,] NA $out [1] 6.9 8.4 $group [1] 4 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(6.6, 6.95, 7.4, 8.05, 8.2, 6.4, 6.45, 6.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6yi1d1425895968.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.6864765 2.00 0.7250 [2,] 0.7572822 2.15 1.0000 [3,] 0.7875214 2.25 1.1625 [4,] 0.8958361 2.45 1.2875 [5,] 1.0749585 2.80 1.7000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.7243260 2.113168 1.031369 [2,] 0.8507168 2.386832 1.293631 $out [1] 3 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.686476510887299, 0.757282180517358, 0.787521423442711, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xq101425895968.ps tmp/1xq101425895968.png",intern=TRUE)) character(0) > try(system("convert tmp/2aqa01425895968.ps tmp/2aqa01425895968.png",intern=TRUE)) character(0) > try(system("convert tmp/3gobv1425895968.ps tmp/3gobv1425895968.png",intern=TRUE)) character(0) > try(system("convert tmp/4a1an1425895968.ps tmp/4a1an1425895968.png",intern=TRUE)) character(0) > try(system("convert tmp/56nd61425895968.ps tmp/56nd61425895968.png",intern=TRUE)) character(0) > try(system("convert tmp/6yi1d1425895968.ps tmp/6yi1d1425895968.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.096 0.332 2.459