R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(86.9,85.8,84.4,80.4,84.4,90.7,91.6,91.9,92.5,92.5,92,92,94.5,95.5,96.3,100,103.1,109.2,108.7,107.5,104.5,103.8,102.5,100.8,100.7,102.7,106.5,105.5,110.1,110.1,109,106.9,108,106.1,101.7,100.6,102.6,100.5,105.2,104.3,104.1,104.8,105.2,102.7,101,93.9,90.2,92.4,94.4,93.3,93.9,95.1,97.6,99.3,101.1,100.6,99.3,97,96.4,98.7) > 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,] 86.9 94.5 100.7 102.6 94.4 NA [2,] 85.8 95.5 102.7 100.5 93.3 NA [3,] 84.4 96.3 106.5 105.2 93.9 NA [4,] 80.4 100.0 105.5 104.3 95.1 NA [5,] 84.4 103.1 110.1 104.1 97.6 NA [6,] 90.7 109.2 110.1 104.8 99.3 NA [7,] 91.6 108.7 109.0 105.2 101.1 NA [8,] 91.9 107.5 106.9 102.7 100.6 NA [9,] 92.5 104.5 108.0 101.0 99.3 NA [10,] 92.5 103.8 106.1 93.9 97.0 NA [11,] 92.0 102.5 101.7 90.2 96.4 NA [12,] 92.0 100.8 100.6 92.4 98.7 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/www/rcomp/tmp/1zgy91337774739.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/www/rcomp/tmp/2wdrb1337774739.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/www/rcomp/tmp/35iij1337774739.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/www/rcomp/tmp/47koi1337774739.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,] 86.9 85.8 84.4 95.1 97.6 90.7 91.6 91.9 92.5 92.5 90.2 92.0 [2,] 94.4 93.3 93.9 95.1 97.6 99.3 101.1 100.6 99.3 93.9 92.0 92.4 [3,] 94.5 95.5 96.3 100.0 103.1 104.8 105.2 102.7 101.0 97.0 96.4 98.7 [4,] 100.7 100.5 105.2 104.3 104.1 109.2 108.7 106.9 104.5 103.8 101.7 100.6 [5,] 102.6 102.7 106.5 105.5 110.1 110.1 109.0 107.5 108.0 106.1 102.5 100.8 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 90.04844 90.4125 88.31545 93.4993 98.50712 97.80468 99.82986 [2,] 98.95156 100.5875 104.28455 106.5007 107.69288 111.79532 110.57014 [,8] [,9] [,10] [,11] [,12] [1,] 98.24844 97.3257 90.00468 89.546 92.9059 [2,] 107.15156 104.6743 103.99532 103.254 104.4941 $out [1] 80.4 84.4 $group [1] 4 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(86.9, 94.4, 94.5, 100.7, 102.6, 85.8, 93.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5292g1337774739.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,] 80.40 94.50 100.6 90.20 93.30 NA [2,] 85.10 98.15 102.2 97.20 94.75 NA [3,] 91.15 102.80 106.3 102.65 97.30 NA [4,] 92.00 106.00 108.5 104.55 99.30 NA [5,] 92.50 109.20 110.1 105.20 101.10 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 88.00286 99.21956 103.4265 99.29762 95.22471 NA [2,] 94.29714 106.38044 109.1735 106.00238 99.37529 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(80.4, 85.1, 91.15, 92, 92.5, 94.5, 98.15, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6qgxu1337774739.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.370355 8.80 5.2 [2,] 5.931229 14.55 6.4 [3,] 6.463573 16.30 7.9 [4,] 8.521038 20.75 9.8 [5,] 10.169710 25.70 11.3 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 5.282344 13.47214 6.349237 [2,] 7.644802 19.12786 9.450763 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(4.37035467668243, 5.93122915001901, 6.4635728869768, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zgy91337774739.ps tmp/1zgy91337774739.png",intern=TRUE)) character(0) > try(system("convert tmp/2wdrb1337774739.ps tmp/2wdrb1337774739.png",intern=TRUE)) character(0) > try(system("convert tmp/35iij1337774739.ps tmp/35iij1337774739.png",intern=TRUE)) character(0) > try(system("convert tmp/47koi1337774739.ps tmp/47koi1337774739.png",intern=TRUE)) character(0) > try(system("convert tmp/5292g1337774739.ps tmp/5292g1337774739.png",intern=TRUE)) character(0) > try(system("convert tmp/6qgxu1337774739.ps tmp/6qgxu1337774739.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.390 1.080 2.417