R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 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(20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.4,24.3,24.1,22.8,22.5,23.8,24.9,25.2,24.3,22.8,20.7,19.8,22.5,22.6,22.5,21.8,21.2,20.6,19.9,18.7,17.6,16.4,15.9,16.8,22.8,24,22.2,17.9,16,16) > 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,] 20.5 18.6 17.4 19.8 24.9 19.9 NA [2,] 20.2 18.4 16.8 21.2 25.2 18.7 NA [3,] 19.4 18.6 15.3 21.5 24.3 17.6 NA [4,] 19.2 19.9 14.3 20.6 22.8 16.4 NA [5,] 18.8 19.2 13.4 19.1 20.7 15.9 NA [6,] 18.8 18.4 15.3 19.6 19.8 16.8 NA [7,] 22.6 21.1 22.1 23.4 22.5 22.8 NA [8,] 23.3 20.5 23.7 24.3 22.6 24.0 NA [9,] 23.0 19.1 22.2 24.1 22.5 22.2 NA [10,] 21.4 18.1 19.5 22.8 21.8 17.9 NA [11,] 19.9 17.0 16.6 22.5 21.2 16.0 NA [12,] 18.8 17.1 17.3 23.8 20.6 16.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/1xqfc1369615168.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/2suv51369615168.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/3gg301369615168.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/49fhl1369615168.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,] 17.40 16.80 15.3 14.30 13.40 15.3 21.10 22.6 22.20 17.90 16.00 16.00 [2,] 18.60 18.40 17.6 16.40 15.90 16.8 22.10 22.6 22.20 18.10 16.60 17.10 [3,] 19.85 19.45 19.0 19.55 18.95 18.6 22.55 23.5 22.35 20.45 18.45 18.05 [4,] 20.50 21.20 21.5 20.60 19.20 19.6 22.80 24.0 23.00 21.80 21.20 20.60 [5,] 20.50 25.20 24.3 22.80 20.70 19.8 23.40 24.3 24.10 22.80 22.50 23.80 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 18.62444 17.64391 16.48437 16.84086 16.82139 16.79391 22.09848 22.59695 [2,] 21.07556 21.25609 21.51563 22.25914 21.07861 20.40609 23.00152 24.40305 [,9] [,10] [,11] [,12] [1,] 21.83397 18.06338 15.48285 15.79239 [2,] 22.86603 22.83662 21.41715 20.30761 $out [1] 24.9 20.5 19.1 $group [1] 1 8 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(17.4, 18.6, 19.85, 20.5, 20.5, 16.8, 18.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5cuwx1369615168.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,] 18.80 17.00 13.40 19.1 19.80 15.90 NA [2,] 19.00 18.25 15.30 20.2 20.95 16.20 NA [3,] 20.05 18.60 17.05 22.0 22.50 17.75 NA [4,] 22.00 19.55 20.80 23.6 23.55 21.05 NA [5,] 23.30 21.10 23.70 24.3 25.20 24.00 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 18.68168 18.00706 14.54141 20.44924 21.31412 15.53788 NA [2,] 21.41832 19.19294 19.55859 23.55076 23.68588 19.96212 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(18.8, 19, 20.05, 22, 23.3, 17, 18.25, 18.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/61eln1369615168.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.773089 2.3 0.5500 [2,] 1.708280 4.7 1.3000 [3,] 2.623098 6.9 2.5125 [4,] 2.899507 8.1 3.1875 [5,] 3.133528 9.0 4.1750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.079771 5.349237 1.651599 [2,] 3.166425 8.450763 3.373401 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.773089041874651, 1.70827950456957, 2.62309810938428, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xqfc1369615168.ps tmp/1xqfc1369615168.png",intern=TRUE)) character(0) > try(system("convert tmp/2suv51369615168.ps tmp/2suv51369615168.png",intern=TRUE)) character(0) > try(system("convert tmp/3gg301369615168.ps tmp/3gg301369615168.png",intern=TRUE)) character(0) > try(system("convert tmp/49fhl1369615168.ps tmp/49fhl1369615168.png",intern=TRUE)) character(0) > try(system("convert tmp/5cuwx1369615168.ps tmp/5cuwx1369615168.png",intern=TRUE)) character(0) > try(system("convert tmp/61eln1369615168.ps tmp/61eln1369615168.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.915 0.821 5.157