R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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) > 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,] 6.0 5.7 4.4 5.9 -7.6 1.6 -1.2 NA [2,] 6.7 13.0 7.9 -5.3 -0.9 1.9 -2.8 NA [3,] -0.6 14.5 -9.7 -2.9 7.3 -0.9 5.5 NA [4,] 5.8 9.7 -4.1 6.6 -3.7 5.5 -17.3 NA [5,] 16.4 -4.7 16.4 -8.1 -2.5 1.7 1.4 NA [6,] 1.5 7.3 -4.9 1.3 9.3 -5.4 -2.2 NA [7,] 5.1 5.2 3.5 6.9 1.3 1.9 -8.6 NA [8,] 14.7 -2.5 3.8 -7.2 9.5 0.2 -5.0 NA [9,] 4.3 11.5 -0.2 -1.9 11.3 -13.3 4.1 NA [10,] 1.5 4.9 3.1 4.0 -1.7 -8.2 0.7 NA [11,] 9.1 -2.4 0.7 -5.7 8.0 0.2 -4.2 NA [12,] 4.3 -0.3 -2.8 3.9 -4.8 5.7 -2.3 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/1pqg51398607854.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/23lsr1398607854.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/324fd1398607854.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/4g4741398607854.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.30 -9.7 -17.3 -8.10 -5.40 1.30 -7.20 -13.30 -1.70 -5.70 -4.80 [2,] 0.2 -1.85 -1.9 -3.9 -3.60 -3.55 1.60 -3.75 -1.05 -0.50 -3.30 -2.55 [3,] 4.4 1.90 -0.6 5.5 1.40 1.30 3.50 0.20 4.10 1.50 0.20 -0.30 [4,] 5.8 7.30 6.4 6.2 9.05 4.40 5.15 6.65 7.80 3.55 4.35 4.10 [5,] 6.0 13.00 14.5 9.7 16.40 9.30 6.90 14.70 11.50 4.90 9.10 5.70 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.05577 -3.564232 -5.556626 -0.5315571 -6.154376 -3.447612 1.379997 [2,] 7.74423 7.364232 4.356626 11.5315571 8.954376 6.047612 5.620003 [,8] [,9] [,10] [,11] [,12] [1,] -6.010712 -1.185077 -0.9185947 -4.368457 -4.271273 [2,] 6.410712 9.385077 3.9185947 4.768457 3.671273 $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, 0.2, 4.4, 5.8, 6, -5.3, -1.85, 1.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5w7191398607854.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,] -0.60 -4.70 -9.70 -8.10 -7.60 -8.20 -8.60 NA [2,] 2.90 -1.35 -3.45 -5.50 -3.10 -3.15 -4.60 NA [3,] 5.45 5.45 1.90 -0.30 0.20 0.90 -2.25 NA [4,] 7.90 10.60 4.10 4.95 8.65 1.90 1.05 NA [5,] 14.70 14.50 7.90 6.90 11.30 5.70 5.50 NA $n [1] 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] [1,] NA [2,] NA $out [1] 16.4 16.4 -13.3 -17.3 $group [1] 1 3 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" 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/620mc1398607854.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,] 4.092560 10.50 3.550 [2,] 5.097647 14.15 6.125 [3,] 6.146450 16.90 8.125 [4,] 8.250281 24.35 9.625 [5,] 9.798785 27.00 12.650 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 4.708512 12.24771 6.528627 [2,] 7.584387 21.55229 9.721373 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(4.09256003243051, 5.0976465249028, 6.14644963319342, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1pqg51398607854.ps tmp/1pqg51398607854.png",intern=TRUE)) character(0) > try(system("convert tmp/23lsr1398607854.ps tmp/23lsr1398607854.png",intern=TRUE)) character(0) > try(system("convert tmp/324fd1398607854.ps tmp/324fd1398607854.png",intern=TRUE)) character(0) > try(system("convert tmp/4g4741398607854.ps tmp/4g4741398607854.png",intern=TRUE)) character(0) > try(system("convert tmp/5w7191398607854.ps tmp/5w7191398607854.png",intern=TRUE)) character(0) > try(system("convert tmp/620mc1398607854.ps tmp/620mc1398607854.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.479 0.922 5.404