R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(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,62,57) > 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] 74 > (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] 7 7 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 19 5 68 65 15 34 62 [2,] 14 0 73 64 8 47 57 [3,] 15 -2 71 60 5 33 NA [4,] 7 6 71 43 6 35 NA [5,] 12 11 70 47 5 31 NA [6,] 12 9 69 40 12 35 NA [7,] 14 17 65 31 8 39 NA [8,] 9 21 57 27 17 46 NA [9,] 8 21 57 24 22 40 NA [10,] 4 41 57 23 24 50 NA [11,] 7 57 55 17 36 62 NA [12,] 3 65 65 16 31 57 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/1sbr71369235599.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/2v6ib1369235599.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/3bpq61369235599.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/4jz8i1369235599.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.0 -2 6 5.0 9.0 8 9 8 4.0 7.0 3 [2,] 17.0 11.0 5 6 11.0 12.0 14 17 21 23.0 17.0 16 [3,] 34.0 47.0 24 21 21.5 23.5 24 24 23 32.5 45.5 44 [4,] 63.5 60.5 60 43 47.0 40.0 39 46 40 50.0 57.0 65 [5,] 68.0 73.0 71 71 70.0 69.0 65 57 57 57.0 62.0 65 $n [1] 7 7 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.23095 17.4394 -11.47678 -2.866195 -1.721163 5.439096 7.874193 [2,] 61.76905 76.5606 59.47678 44.866195 44.721163 41.560904 40.125807 [,8] [,9] [,10] [,11] [,12] [1,] 5.294063 10.74439 15.08413 19.69871 12.39342 [2,] 42.705937 35.25561 49.91587 71.30129 75.60658 $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, 34, 63.5, 68, 0, 11, 47, 60.5, 73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5otqp1369235599.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,] 3.0 -2.0 55.0 16.0 5.0 31.0 57.0 [2,] 7.0 5.5 57.0 23.5 7.0 34.5 57.0 [3,] 10.5 14.0 66.5 35.5 13.5 39.5 59.5 [4,] 14.0 31.0 70.5 53.5 23.0 48.5 62.0 [5,] 19.0 65.0 73.0 65.0 36.0 62.0 62.0 $n [1] 12 12 12 12 12 12 2 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 7.307253 2.369279 60.34256 21.8168 6.202293 33.11451 53.91386 [2,] 13.692747 25.630721 72.65744 49.1832 20.797707 45.88549 65.08614 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(3, 7, 10.5, 14, 19, -2, 5.5, 14, 31, 65, 55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/607gy1369235599.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,] 17.22401 48 14.750 [2,] 20.38822 54 23.875 [3,] 24.33465 61 33.250 [4,] 26.63731 65 44.500 [5,] 29.87753 73 49.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 21.48439 55.98283 23.8428 [2,] 27.18490 66.01717 42.6572 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(17.2240142436851, 20.3882164981958, 24.3346474347207, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1sbr71369235599.ps tmp/1sbr71369235599.png",intern=TRUE)) character(0) > try(system("convert tmp/2v6ib1369235599.ps tmp/2v6ib1369235599.png",intern=TRUE)) character(0) > try(system("convert tmp/3bpq61369235599.ps tmp/3bpq61369235599.png",intern=TRUE)) character(0) > try(system("convert tmp/4jz8i1369235599.ps tmp/4jz8i1369235599.png",intern=TRUE)) character(0) > try(system("convert tmp/5otqp1369235599.ps tmp/5otqp1369235599.png",intern=TRUE)) character(0) > try(system("convert tmp/607gy1369235599.ps tmp/607gy1369235599.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.816 0.846 4.644