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(6,6.7,-0.6,5.8,16.4,1.5,5.1,14.7,4.3,1.5,9.1,4.3,5.7,13,14.5,9.7,-4.7,7.3,5.2,-2.5,11.5,4.9,-2.4,-0.3,4.4,7.9,-9.7,-4.1,16.4,-4.9,3.5,3.8,-0.2,3.1,0.7,-2.8,5.9,-5.3,-2.9,6.6,-8.1,1.3,6.9,-7.2,-1.9,4,-5.7,3.9,-7.6,-0.9,7.3,-3.7,-2.5,9.3,1.3,9.5,11.3,-1.7,8,-4.8,1.6,1.9,-0.9,5.5,1.7,-5.4,1.9,0.2,-13.3,-8.2,0.2,5.7,-1.2,-2.8,5.5,-17.3,1.4,-2.2,-8.6,-5,4.1,0.7,-4.2,-2.3,-3.4,-4.2,-14.2,1.6,-4.9,-1.8,-0.5,-2.3,-5.3,-0.2,5.1,-1.5) > 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,] 6.0 5.7 4.4 5.9 -7.6 1.6 -1.2 -3.4 NA [2,] 6.7 13.0 7.9 -5.3 -0.9 1.9 -2.8 -4.2 NA [3,] -0.6 14.5 -9.7 -2.9 7.3 -0.9 5.5 -14.2 NA [4,] 5.8 9.7 -4.1 6.6 -3.7 5.5 -17.3 1.6 NA [5,] 16.4 -4.7 16.4 -8.1 -2.5 1.7 1.4 -4.9 NA [6,] 1.5 7.3 -4.9 1.3 9.3 -5.4 -2.2 -1.8 NA [7,] 5.1 5.2 3.5 6.9 1.3 1.9 -8.6 -0.5 NA [8,] 14.7 -2.5 3.8 -7.2 9.5 0.2 -5.0 -2.3 NA [9,] 4.3 11.5 -0.2 -1.9 11.3 -13.3 4.1 -5.3 NA [10,] 1.5 4.9 3.1 4.0 -1.7 -8.2 0.7 -0.2 NA [11,] 9.1 -2.4 0.7 -5.7 8.0 0.2 -4.2 5.1 NA [12,] 4.3 -0.3 -2.8 3.9 -4.8 5.7 -2.3 -1.5 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/16y3p1425995722.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/25px71425995722.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/3q4a41425995722.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/4vwei1425995722.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,] -7.6 -5.3 -14.20 -17.30 -8.10 -5.40 -0.50 -7.20 -13.30 -1.70 -5.70 -4.80 [2,] -2.3 -3.5 -6.30 -3.90 -4.80 -3.55 0.40 -3.75 -3.60 -0.95 -3.30 -2.55 [3,] 3.0 0.5 -0.75 3.55 -0.55 -0.25 2.70 -1.05 1.95 1.10 0.45 -0.90 [4,] 5.8 7.3 6.40 6.20 9.05 4.40 5.15 6.65 7.80 3.55 6.55 4.10 [5,] 6.0 13.0 14.50 9.70 16.40 9.30 6.90 14.70 11.50 4.90 9.10 5.70 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -1.524776 -5.533035 -7.844402 -2.092005 -8.286809 -4.690984 0.0465818 [2,] 7.524776 6.533035 6.344402 9.192005 7.186809 4.190984 5.3534182 [,8] [,9] [,10] [,11] [,12] [1,] -6.859589 -4.418204 -1.413765 -5.052351 -4.614785 [2,] 4.759589 8.318204 3.613765 5.952351 2.814785 $out [1] -8.6 -8.2 $group [1] 7 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-7.6, -2.3, 3, 5.8, 6, -5.3, -3.5, 0.5, 7.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5x8mr1425995722.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,] -0.60 -4.70 -9.70 -8.10 -7.60 -8.20 -8.60 -5.30 NA [2,] 2.90 -1.35 -3.45 -5.50 -3.10 -3.15 -4.60 -4.55 NA [3,] 5.45 5.45 1.90 -0.30 0.20 0.90 -2.25 -2.05 NA [4,] 7.90 10.60 4.10 4.95 8.65 1.90 1.05 -0.35 NA [5,] 14.70 14.50 7.90 6.90 11.30 5.70 5.50 5.10 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 3.169466 -0.0004752163 -1.543606 -5.066315 -5.159254 -1.403339 -4.8270029 [2,] 7.730534 10.9004752163 5.343606 4.466315 5.559254 3.203339 0.3270029 [,8] [,9] [1,] -3.9656482 NA [2,] -0.1343518 NA $out [1] 16.4 16.4 -13.3 -17.3 -14.2 $group [1] 1 3 6 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(-0.6, 2.9, 5.45, 7.9, 14.7, -4.7, -1.35, 5.45, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6p1tv1425995722.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,] 3.856257 10.50 3.9000 [2,] 4.961411 14.15 6.1250 [3,] 6.047980 16.90 8.5125 [4,] 8.541712 24.65 9.9625 [5,] 9.486221 28.70 10.5500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 4.414980 12.11088 6.76219 [2,] 7.680979 21.68912 10.26281 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.85625651191856, 4.96141070268489, 6.04797976202188, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/16y3p1425995722.ps tmp/16y3p1425995722.png",intern=TRUE)) character(0) > try(system("convert tmp/25px71425995722.ps tmp/25px71425995722.png",intern=TRUE)) character(0) > try(system("convert tmp/3q4a41425995722.ps tmp/3q4a41425995722.png",intern=TRUE)) character(0) > try(system("convert tmp/4vwei1425995722.ps tmp/4vwei1425995722.png",intern=TRUE)) character(0) > try(system("convert tmp/5x8mr1425995722.ps tmp/5x8mr1425995722.png",intern=TRUE)) character(0) > try(system("convert tmp/6p1tv1425995722.ps tmp/6p1tv1425995722.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.126 0.375 2.519