R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(31956,29506,34506,27165,26736,23691,18157,17328,18205,20995,17382,9367,31124,26551,30651,25859,25100,25778,20418,18688,20424,24776,19814,12738,31566,30111,30019,31934,25826,26835,20205,17789,20520,22518,15572,11509,25447,24090,27786,26195,20516,22759,19028,16971,20036,22485,18730,14538,27561,25985,34670,32066,27186,29586,21359,21553,19573,24256,22380,16167,27297,28287,33474,28229,28785,25597,18130,20198,22849,23118,21925,20801) > 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,] 31956 31124 31566 25447 27561 27297 NA [2,] 29506 26551 30111 24090 25985 28287 NA [3,] 34506 30651 30019 27786 34670 33474 NA [4,] 27165 25859 31934 26195 32066 28229 NA [5,] 26736 25100 25826 20516 27186 28785 NA [6,] 23691 25778 26835 22759 29586 25597 NA [7,] 18157 20418 20205 19028 21359 18130 NA [8,] 17328 18688 17789 16971 21553 20198 NA [9,] 18205 20424 20520 20036 19573 22849 NA [10,] 20995 24776 22518 22485 24256 23118 NA [11,] 17382 19814 15572 18730 22380 21925 NA [12,] 9367 12738 11509 14538 16167 20801 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/17xl71353925533.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/2qvif1353925533.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/3145z1353925533.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/4y2c71353925533.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] [1,] 25447.0 24090 27786.0 25859 25100 22759.0 18130.0 16971.0 18205 20995 [2,] 27297.0 25985 30019.0 26195 25100 23691.0 18157.0 17328.0 19573 22485 [3,] 29342.5 27419 32062.5 27697 26281 25687.5 19616.5 18238.5 20230 22818 [4,] 31566.0 29506 34506.0 31934 27186 26835.0 20418.0 20198.0 20520 24256 [5,] 31956.0 30111 34670.0 32066 28785 29586.0 21359.0 21553.0 20520 24776 [,11] [,12] [1,] 15572 9367 [2,] 17382 11509 [3,] 19272 13638 [4,] 21925 16167 [5,] 22380 20801 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 26588.86 25147.84 29168.24 23995.16 24935.46 23659.52 18158.08 16387.26 [2,] 32096.14 29690.16 34956.76 31398.84 27626.54 27715.48 21074.92 20089.74 [,9] [,10] [,11] [,12] [1,] 19619.15 21675.65 16341.62 10633.44 [2,] 20840.85 23960.35 22202.38 16642.56 $out [1] 20516 22849 $group [1] 5 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(25447, 27297, 29342.5, 31566, 31956, 24090, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5lzg71353925533.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,] 9367.0 12738 11509 14538.0 16167.0 18130.0 NA [2,] 17769.5 20116 18997 18879.0 21456.0 21363.0 NA [3,] 22343.0 24938 24172 21500.5 25120.5 24357.5 NA [4,] 28335.5 26205 30065 24768.5 28573.5 28258.0 NA [5,] 34506.0 31124 31934 27786.0 34670.0 33474.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 17523.78 22160.77 19123.81 18814.26 21874.16 21212.64 NA [2,] 27162.22 27715.23 29220.19 24186.74 28366.84 27502.36 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(9367, 17769.5, 22343, 28335.5, 34506, 12738, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6wsae1353925533.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,] 1317.897 3229.0 807.25 [2,] 1655.995 4613.0 1891.00 [3,] 2520.257 6358.0 2739.00 [4,] 2785.118 6855.5 4007.25 [5,] 4007.300 8269.0 4570.25 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2005.257 5335.181 1773.764 [2,] 3035.258 7380.819 3704.236 $out [1] 11434 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1317.8969231317, 1655.99513304043, 2520.25732766239, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17xl71353925533.ps tmp/17xl71353925533.png",intern=TRUE)) character(0) > try(system("convert tmp/2qvif1353925533.ps tmp/2qvif1353925533.png",intern=TRUE)) character(0) > try(system("convert tmp/3145z1353925533.ps tmp/3145z1353925533.png",intern=TRUE)) character(0) > try(system("convert tmp/4y2c71353925533.ps tmp/4y2c71353925533.png",intern=TRUE)) character(0) > try(system("convert tmp/5lzg71353925533.ps tmp/5lzg71353925533.png",intern=TRUE)) character(0) > try(system("convert tmp/6wsae1353925533.ps tmp/6wsae1353925533.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.078 0.676 3.783