R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(12693.7,13154,15405.1,13869.4,12827.7,15716.7,13012.5,12837.6,15052.7,15002.6,14839.6,15022.6,14097.8,14776.8,16833.3,15385.5,15172.6,16858.9,14143.5,14731.8,16471.6,15214,17637.4,17972.4,16896.2,16698,19691.6,15930.7,17444.6,17699.4,15189.8,15672.7,17180.8,17664.9,17862.9,16162.3,17463.6,16772.1,19106.9,16721.3,18161.3,18509.9,17802.7,16409.9,17967.7,20286.6,19537.3,18021.9,20194.3,19049.6,20244.7,21473.3,19673.6,21053.2,20159.5,18203.6,21289.5,20432.3,17180.4,15816.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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 12693.7 14097.8 16896.2 17463.6 20194.3 NA [2,] 13154.0 14776.8 16698.0 16772.1 19049.6 NA [3,] 15405.1 16833.3 19691.6 19106.9 20244.7 NA [4,] 13869.4 15385.5 15930.7 16721.3 21473.3 NA [5,] 12827.7 15172.6 17444.6 18161.3 19673.6 NA [6,] 15716.7 16858.9 17699.4 18509.9 21053.2 NA [7,] 13012.5 14143.5 15189.8 17802.7 20159.5 NA [8,] 12837.6 14731.8 15672.7 16409.9 18203.6 NA [9,] 15052.7 16471.6 17180.8 17967.7 21289.5 NA [10,] 15002.6 15214.0 17664.9 20286.6 20432.3 NA [11,] 14839.6 17637.4 17862.9 19537.3 17180.4 NA [12,] 15022.6 17972.4 16162.3 18021.9 15816.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/16y6v1335460705.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/2s14p1335460705.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/3vtti1335460705.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/4yuhh1335460705.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] [1,] 12693.7 13154.0 15405.1 13869.4 12827.7 15716.7 13012.5 12837.6 15052.7 [2,] 14097.8 14776.8 16833.3 15385.5 15172.6 16858.9 14143.5 14731.8 16471.6 [3,] 16896.2 16698.0 19106.9 15930.7 17444.6 17699.4 15189.8 15672.7 17180.8 [4,] 17463.6 16772.1 19691.6 16721.3 18161.3 18509.9 17802.7 16409.9 17967.7 [5,] 20194.3 19049.6 20244.7 16721.3 19673.6 18509.9 20159.5 18203.6 17967.7 [,10] [,11] [,12] [1,] 15002.6 17180.4 15022.6 [2,] 15214.0 17180.4 15816.8 [3,] 17664.9 17637.4 16162.3 [4,] 20286.6 17862.9 17972.4 [5,] 20432.3 17862.9 18021.9 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 14517.93 15288.13 17087.23 14986.83 15332.79 16532.81 12604.22 14486.96 [2,] 19274.47 18107.87 21126.57 16874.57 19556.41 18865.99 17775.38 16858.44 [,9] [,10] [,11] [,12] [1,] 16123.66 14080.61 17155.15 14639.16 [2,] 18237.94 21249.19 18119.65 17685.44 $out [1] 21473.3 21053.2 21289.5 14839.6 19537.3 $group [1] 4 6 9 11 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(12693.7, 14097.8, 16896.2, 17463.6, 20194.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5pn221335460705.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] [1,] 12693.70 14097.80 15189.80 16409.90 15816.80 NA [2,] 12925.05 14754.30 16046.50 17117.85 18626.60 NA [3,] 14354.50 15299.75 17038.50 17994.80 20176.90 NA [4,] 15037.65 16846.10 17682.15 18808.40 20742.75 NA [5,] 15716.70 17972.40 19691.60 20286.60 21473.30 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 13390.93 14345.67 16292.47 17223.73 19211.71 NA [2,] 15318.07 16253.83 17784.53 18765.87 21142.09 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(12693.7, 12925.05, 14354.5, 15037.65, 15716.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6me751335460705.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,] 1341.497 2999.30 682.50 [2,] 2000.066 5088.05 1573.55 [3,] 2280.502 5662.65 2075.45 [4,] 2781.426 6996.45 3177.25 [5,] 2946.409 7603.90 5072.60 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1924.118 4792.216 1343.992 [2,] 2636.885 6533.084 2806.908 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1341.4965952249, 2000.06562221145, 2280.50168593939, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/16y6v1335460705.ps tmp/16y6v1335460705.png",intern=TRUE)) character(0) > try(system("convert tmp/2s14p1335460705.ps tmp/2s14p1335460705.png",intern=TRUE)) character(0) > try(system("convert tmp/3vtti1335460705.ps tmp/3vtti1335460705.png",intern=TRUE)) character(0) > try(system("convert tmp/4yuhh1335460705.ps tmp/4yuhh1335460705.png",intern=TRUE)) character(0) > try(system("convert tmp/5pn221335460705.ps tmp/5pn221335460705.png",intern=TRUE)) character(0) > try(system("convert tmp/6me751335460705.ps tmp/6me751335460705.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.423 0.363 1.807