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(11236,10954,9580,10337,8961,10372,12782,15119,19940,13957,10849,9429,11816,11329,11334,9898,8961,10783,13149,16244,20067,13601,10573,8623,10962,11911,11677,9679,9116,11394,13240,18983,21545,14360,11839,9726,12347,12624,11918,10028,10228,11026,13878,22165,23533,13445,12164,9606,12177,13142,11210,9485,10082,10680,13579,21709,22205,14687,11222,8196,12794,12627,11080,10425,10865,10771,14771,20993,23882,14825,11648,10091) > 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,] 11236 11816 10962 12347 12177 12794 NA [2,] 10954 11329 11911 12624 13142 12627 NA [3,] 9580 11334 11677 11918 11210 11080 NA [4,] 10337 9898 9679 10028 9485 10425 NA [5,] 8961 8961 9116 10228 10082 10865 NA [6,] 10372 10783 11394 11026 10680 10771 NA [7,] 12782 13149 13240 13878 13579 14771 NA [8,] 15119 16244 18983 22165 21709 20993 NA [9,] 19940 20067 21545 23533 22205 23882 NA [10,] 13957 13601 14360 13445 14687 14825 NA [11,] 10849 10573 11839 12164 11222 11648 NA [12,] 9429 8623 9726 9606 8196 10091 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/1rffn1416409329.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/20dd21416409329.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/3e5xb1416409329.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/4u7vk1416409329.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] [1,] 10962.0 10954.0 11080 9485 8961 10372 12782.0 15119 19940 13445.0 10573 [2,] 11236.0 11329.0 11080 9679 8961 10680 13149.0 16244 20067 13601.0 10849 [3,] 11996.5 12267.5 11272 9963 9599 10777 13409.5 19988 21875 14158.5 11435 [4,] 12347.0 12627.0 11677 10337 10228 11026 13878.0 21709 23533 14687.0 11839 [5,] 12794.0 13142.0 11918 10425 10865 11394 14771.0 22165 23882 14825.0 12164 [,12] [1,] 8196.0 [2,] 8623.0 [3,] 9517.5 [4,] 9726.0 [5,] 10091.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 11279.87 11430.25 10886.92 9538.569 8781.744 10553.82 12939.27 16462.9 [2,] 12713.13 13104.75 11657.08 10387.431 10416.256 11000.18 13879.73 23513.1 [,9] [,10] [,11] [,12] [1,] 19639.32 13457.99 10796.42 8806.029 [2,] 24110.68 14859.01 12073.58 10228.971 $out [1] 9580 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(10962, 11236, 11996.5, 12347, 12794, 10954, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5y4cs1416409329.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,] 8961.0 8623.0 9116 9606.0 8196.0 10091.0 NA [2,] 9958.5 10235.5 10344 10627.0 10381.0 10818.0 NA [3,] 10901.5 11331.5 11758 12255.5 11699.5 12137.5 NA [4,] 13369.5 13375.0 13800 13661.5 14133.0 14798.0 NA [5,] 15119.0 16244.0 18983 13878.0 14687.0 14825.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9345.72 9899.553 10181.7 10871.44 9988.188 10322.2 NA [2,] 12457.28 12763.447 13334.3 13639.56 13410.812 13952.8 NA $out [1] 19940 20067 21545 22165 23533 21709 22205 20993 23882 $group [1] 1 2 3 4 4 5 5 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(8961, 9958.5, 10901.5, 13369.5, 15119, 8623, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6sz2w1416409329.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,] 344.7066 940.0 262.500 [2,] 589.5000 1485.5 578.750 [3,] 709.5832 1899.5 893.375 [4,] 833.8505 2263.0 1171.750 [5,] 846.3473 2338.0 1191.750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 598.1333 1544.877 622.9037 [2,] 821.0331 2254.123 1163.8463 $out [1] 2957.726 1673.732 7046.000 3942.000 4601.250 2764.500 $group [1] 1 1 2 2 3 3 $names [1] "S.D." "Range" "IQR" > dev.off() null device 1 > > try(system("convert tmp/1rffn1416409329.ps tmp/1rffn1416409329.png",intern=TRUE)) character(0) > try(system("convert tmp/20dd21416409329.ps tmp/20dd21416409329.png",intern=TRUE)) character(0) > try(system("convert tmp/3e5xb1416409329.ps tmp/3e5xb1416409329.png",intern=TRUE)) character(0) > try(system("convert tmp/4u7vk1416409329.ps tmp/4u7vk1416409329.png",intern=TRUE)) character(0) > try(system("convert tmp/5y4cs1416409329.ps tmp/5y4cs1416409329.png",intern=TRUE)) character(0) > try(system("convert tmp/6sz2w1416409329.ps tmp/6sz2w1416409329.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.186 0.395 2.600