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(-4,-5,-6,-6,-7,-12,-16,-18,-19,-20,-24,-17,-23,-25,-24,-17,-14,-16,-13,-10,-10,-12,-12,-20,-16,-12,-14,-7,-9,-9,-4,-3,1,-1,-2,1,-3,-2,0,-2,-4,-4,-7,-9,-13,-8,-13,-15,-15,-15,-10,-12,-11,-11,-17,-18,-19,-22,-24,-24,-20,-25,-22,-17,-9,-11,-13,-11,-9,-7,-3,-3,-6,-4,-8,-1,-2,-2,-1,1,2,2,-1,1,-1,-8,1,2,-2,-2,-2,-2,-6,-4,-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] 95 > (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] 8 8 8 8 8 8 8 8 8 8 8 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -4 -23 -16 -3 -15 -20 -6 -1 [2,] -5 -25 -12 -2 -15 -25 -4 -8 [3,] -6 -24 -14 0 -10 -22 -8 1 [4,] -6 -17 -7 -2 -12 -17 -1 2 [5,] -7 -14 -9 -4 -11 -9 -2 -2 [6,] -12 -16 -9 -4 -11 -11 -2 -2 [7,] -16 -13 -4 -7 -17 -13 -1 -2 [8,] -18 -10 -3 -9 -18 -11 1 -2 [9,] -19 -10 1 -13 -19 -9 2 -6 [10,] -20 -12 -1 -8 -22 -7 2 -4 [11,] -24 -12 -2 -13 -24 -3 -1 -5 [12,] -17 -20 1 -15 -24 -3 1 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/15yln1426199198.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/2pzps1426199198.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/37trt1426199198.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/4wia91426199198.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,] -23.0 -25.0 -24 -17.0 -14 -16.0 -17.0 -18.0 -19.0 -22.0 -24.0 -24.0 [2,] -18.0 -20.0 -18 -14.5 -10 -11.5 -14.5 -14.5 -16.0 -16.0 -18.5 -18.5 [3,] -10.5 -10.0 -9 -6.5 -8 -10.0 -10.0 -9.5 -9.5 -7.5 -8.5 -15.0 [4,] -3.5 -4.5 -3 -1.5 -3 -3.0 -3.0 -2.5 -2.5 -2.5 -2.5 -1.0 [5,] -1.0 -2.0 1 2.0 -2 -2.0 -1.0 1.0 2.0 2.0 -1.0 1.0 $n [1] 8 8 8 8 8 8 8 8 8 8 8 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -18.599908 -18.658523 -17.3792154 -13.7619866 -11.9103 -14.748222 [2,] -2.400092 -1.341477 -0.6207846 0.7619866 -4.0897 -5.251778 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -16.424065 -16.203372 -17.041294 -15.04129382 -17.4378297 -25.450718 [2,] -3.575935 -2.796628 -1.958706 0.04129382 0.4378297 -4.549282 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-23, -18, -10.5, -3.5, -1, -25, -20, -10, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5xhfg1426199198.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,] -24.0 -25.0 -16.0 -15.0 -24.0 -25.0 -8 -8.0 [2,] -18.5 -21.5 -10.5 -11.0 -20.5 -18.5 -3 -4.5 [3,] -14.0 -15.0 -5.5 -5.5 -16.0 -11.0 -1 -2.0 [4,] -6.0 -12.0 -1.5 -2.5 -11.5 -8.0 1 -1.5 [5,] -4.0 -10.0 1.0 0.0 -10.0 -3.0 2 2.0 $n [1] 12 12 12 12 12 12 12 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -19.701334 -19.33301 -9.60496 -9.376907 -20.10496 -15.78912 -2.8244269 [2,] -8.298666 -10.66699 -1.39504 -1.623093 -11.89504 -6.21088 0.8244269 [,8] [1,] -3.4291638 [2,] -0.5708362 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(-24, -18.5, -14, -6, -4, -25, -21.5, -15, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6lfv21426199198.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.334249 12.0 6.000 [2,] 6.743967 17.5 10.125 [3,] 8.237615 21.5 11.125 [4,] 9.148734 23.5 12.875 [5,] 10.440307 25.0 13.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.140785 18.76336 9.870707 [2,] 9.334446 24.23664 12.379293 $out [1] 17.5 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(4.33424898750802, 6.74396678855804, 8.23761520876162, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15yln1426199198.ps tmp/15yln1426199198.png",intern=TRUE)) character(0) > try(system("convert tmp/2pzps1426199198.ps tmp/2pzps1426199198.png",intern=TRUE)) character(0) > try(system("convert tmp/37trt1426199198.ps tmp/37trt1426199198.png",intern=TRUE)) character(0) > try(system("convert tmp/4wia91426199198.ps tmp/4wia91426199198.png",intern=TRUE)) character(0) > try(system("convert tmp/5xhfg1426199198.ps tmp/5xhfg1426199198.png",intern=TRUE)) character(0) > try(system("convert tmp/6lfv21426199198.ps tmp/6lfv21426199198.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.045 0.349 2.419