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(24,24,31,25,28,24,25,16,17,11,12,39,19,14,15,7,12,12,14,9,8,4,7,3,5,0,-2,6,11,9,17,21,21,41,57,65,68,73,71,71,70,69,65,57,57,57,55,65,65,64,60,43,47,40,31,27,24,23,17,16,15,8,5,6,5,12,8,17,22,24,36,31,34,47,33,35,31,35,39,46,40,50,62,57,59,52,63,56,55,54,48,39,40,38,34,32) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 24 19 5 68 65 15 34 59 NA [2,] 24 14 0 73 64 8 47 52 NA [3,] 31 15 -2 71 60 5 33 63 NA [4,] 25 7 6 71 43 6 35 56 NA [5,] 28 12 11 70 47 5 31 55 NA [6,] 24 12 9 69 40 12 35 54 NA [7,] 25 14 17 65 31 8 39 48 NA [8,] 16 9 21 57 27 17 46 39 NA [9,] 17 8 21 57 24 22 40 40 NA [10,] 11 4 41 57 23 24 50 38 NA [11,] 12 7 57 55 17 36 62 34 NA [12,] 39 3 65 65 16 31 57 32 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/1d6zv1426192626.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/2tjrq1426192626.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/32lr91426192626.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/4si9y1426192626.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,] 5 0.0 -2.0 6.0 5.0 9.0 8.0 9.0 8 4.0 7.0 3.0 [2,] 17 11.0 10.0 6.5 11.5 12.0 15.5 16.5 19 17.0 14.5 23.5 [3,] 29 35.5 32.0 30.0 29.5 29.5 28.0 24.0 23 31.0 35.0 35.5 [4,] 62 58.0 61.5 49.5 51.0 47.0 43.5 42.5 40 45.5 56.0 61.0 [5,] 68 73.0 71.0 71.0 70.0 69.0 65.0 57.0 57 57.0 62.0 65.0 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 3.862354 9.245125 3.231361 5.979583 7.434733 9.948498 12.3588 [2,] 54.137646 61.754875 60.768639 54.020417 51.565267 49.051502 43.6412 [,8] [,9] [,10] [,11] [,12] [1,] 9.476027 11.2691 15.07949 11.8175 14.55196 [2,] 38.523973 34.7309 46.92051 58.1825 56.44804 $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(5, 17, 29, 62, 68, 0, 11, 35.5, 58, 73, -2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5oe2z1426192626.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] [,9] [1,] 11.0 3.0 -2.0 55.0 16.0 5.0 31.0 32.0 NA [2,] 16.5 7.0 5.5 57.0 23.5 7.0 34.5 38.5 NA [3,] 24.0 10.5 14.0 66.5 35.5 13.5 39.5 50.0 NA [4,] 26.5 14.0 31.0 70.5 53.5 23.0 48.5 55.5 NA [5,] 39.0 19.0 65.0 73.0 65.0 36.0 62.0 63.0 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 19.43893 7.307253 2.369279 60.34256 21.8168 6.202293 33.11451 42.24619 [2,] 28.56107 13.692747 25.630721 72.65744 49.1832 20.797707 45.88549 57.75381 [,9] [1,] NA [2,] NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(11, 16.5, 24, 26.5, 39, 3, 7, 10.5, 14, 19, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6pz4l1426192626.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,] 15.80179 48 20.000 [2,] 18.87178 54 24.500 [3,] 22.24502 61 34.500 [4,] 24.61089 65 41.125 [5,] 27.75402 73 48.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 19.62737 55.98283 26.91723 [2,] 24.86267 66.01717 42.08277 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(15.8017856133865, 18.8717782204316, 22.2450224855589, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1d6zv1426192626.ps tmp/1d6zv1426192626.png",intern=TRUE)) character(0) > try(system("convert tmp/2tjrq1426192626.ps tmp/2tjrq1426192626.png",intern=TRUE)) character(0) > try(system("convert tmp/32lr91426192626.ps tmp/32lr91426192626.png",intern=TRUE)) character(0) > try(system("convert tmp/4si9y1426192626.ps tmp/4si9y1426192626.png",intern=TRUE)) character(0) > try(system("convert tmp/5oe2z1426192626.ps tmp/5oe2z1426192626.png",intern=TRUE)) character(0) > try(system("convert tmp/6pz4l1426192626.ps tmp/6pz4l1426192626.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.179 0.415 2.617