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(66329,50326,47182,42247,45796,48233,40079,39596,41275,41875,29784,7199,56166,33936,34532,30261,30857,35461,33525,27825,33624,35618,27329,8081,62751,37565,44749,37537,36825,50679,38488,36522,45545,43571,37343,11593,74784,49019,56601,47634,49807,50499,42092,39064,44376,43616,41059,17226,70170,43949,52333,41034,47760,76115,30918,32994,31947,26763,30251,18211,47957,31901,35560,30408,30083,35044,30475,28308,31395,36311,40426,38948) > 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,] 66329 56166 62751 74784 70170 47957 NA [2,] 50326 33936 37565 49019 43949 31901 NA [3,] 47182 34532 44749 56601 52333 35560 NA [4,] 42247 30261 37537 47634 41034 30408 NA [5,] 45796 30857 36825 49807 47760 30083 NA [6,] 48233 35461 50679 50499 76115 35044 NA [7,] 40079 33525 38488 42092 30918 30475 NA [8,] 39596 27825 36522 39064 32994 28308 NA [9,] 41275 33624 45545 44376 31947 31395 NA [10,] 41875 35618 43571 43616 26763 36311 NA [11,] 29784 27329 37343 41059 30251 40426 NA [12,] 7199 8081 11593 17226 18211 38948 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/1p4q61420035884.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/2lsix1420035884.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/3ys8x1420035884.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/42ppm1420035884.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,] 47957 31901 34532.0 30261.0 30083.0 35044 30475.0 27825 31395.0 26763 [2,] 56166 33936 35560.0 30408.0 30857.0 35461 30918.0 28308 31947.0 35618 [3,] 64540 40757 45965.5 39285.5 41310.5 49366 36006.5 34758 37449.5 39093 [4,] 70170 49019 52333.0 42247.0 47760.0 50679 40079.0 39064 44376.0 43571 [5,] 74784 50326 56601.0 47634.0 49807.0 50679 42092.0 39596 45545.0 43616 [,11] [,12] [1,] 27329 7199.0 [2,] 29784 8081.0 [3,] 33797 14409.5 [4,] 40426 18211.0 [5,] 41059 18211.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,] 55506.97 31027.98 35146.37 31648.96 30407.52 39549.9 30097.36 27820.03 [2,] 73573.03 50486.02 56784.63 46922.04 52213.48 59182.1 41915.64 41695.97 [,9] [,10] [,11] [,12] [1,] 29432.39 33963.06 26932.57 7875.323 [2,] 45466.61 44222.94 40661.43 20943.677 $out [1] 76115 38948 $group [1] 6 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(47957, 56166, 64540, 70170, 74784, 31901, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5r9p11420035884.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,] 29784.0 27329.0 36522.0 39064.0 18211.0 28308.0 NA [2,] 39837.5 29043.0 37084.0 41575.5 30584.5 30441.5 NA [3,] 42061.0 33574.5 38026.5 46005.0 37014.0 33472.5 NA [4,] 47707.5 34996.5 45147.0 50153.0 50046.5 37629.5 NA [5,] 50326.0 35618.0 50679.0 56601.0 76115.0 47957.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 38471.44 30859.07 34348.91 42092.74 28137.25 30194 NA [2,] 45650.56 36289.93 41704.09 49917.26 45890.75 36751 NA $out [1] 66329 7199 56166 8081 62751 11593 74784 17226 $group [1] 1 1 2 2 3 3 4 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(29784, 39837.5, 42061, 47707.5, 50326, 27329, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ypsp1420035884.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,] 4947.504 11617 7355.750 [2,] 6204.559 13940 8977.375 [3,] 7347.867 17899 10494.500 [4,] 9295.963 24448 12444.125 [5,] 11730.169 31749 14920.000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 5937.856 13106.23 8913.292 [2,] 8757.877 22691.77 12075.708 $out [1] 14955.03 41071.00 $group [1] 1 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(4947.5044517413, 6204.5589236131, 7347.86662883483, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1p4q61420035884.ps tmp/1p4q61420035884.png",intern=TRUE)) character(0) > try(system("convert tmp/2lsix1420035884.ps tmp/2lsix1420035884.png",intern=TRUE)) character(0) > try(system("convert tmp/3ys8x1420035884.ps tmp/3ys8x1420035884.png",intern=TRUE)) character(0) > try(system("convert tmp/42ppm1420035884.ps tmp/42ppm1420035884.png",intern=TRUE)) character(0) > try(system("convert tmp/5r9p11420035884.ps tmp/5r9p11420035884.png",intern=TRUE)) character(0) > try(system("convert tmp/6ypsp1420035884.ps tmp/6ypsp1420035884.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.275 0.412 2.699