R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(9,13,12,5,13,11,8,8,8,8,0,3,0,-1,-1,-4,1,-1,0,-1,6,0,-3,-3,4,1,0,-4,-2,3,2,5,6,6,3,4,7,5,6,1,3,6,0,3,4,7,6,6,6,6,2,2,2,3,-1,-4,4,5,3,-1,-4,0,-1,-1,3,2,-4,-3,-1,3,-2,-10) > 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,] 9 0 4 7 6 -4 NA [2,] 13 -1 1 5 6 0 NA [3,] 12 -1 0 6 2 -1 NA [4,] 5 -4 -4 1 2 -1 NA [5,] 13 1 -2 3 2 3 NA [6,] 11 -1 3 6 3 2 NA [7,] 8 0 2 0 -1 -4 NA [8,] 8 -1 5 3 -4 -3 NA [9,] 8 6 6 4 4 -1 NA [10,] 8 0 6 7 5 3 NA [11,] 0 -3 3 6 3 -2 NA [12,] 3 -3 4 6 -1 -10 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/fisher/rcomp/tmp/1oexi1386062935.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/fisher/rcomp/tmp/2ht621386062935.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/fisher/rcomp/tmp/3tqlu1386062935.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/fisher/rcomp/tmp/478d41386062935.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,] -4 -1 -1 -4 -2.0 -1 -4 -4 4 0.0 -3.0 -10 [2,] 0 0 -1 -4 1.0 2 -1 -3 4 3.0 -2.0 -3 [3,] 5 3 1 0 2.5 3 0 1 5 5.5 1.5 1 [4,] 7 6 6 2 3.0 6 2 5 6 7.0 3.0 4 [5,] 9 13 12 5 3.0 11 2 8 8 8.0 6.0 6 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.4847739 -0.8701938 -3.515226 -3.870194 1.209935 0.4198708 -1.935097 [2,] 9.5152261 6.8701938 5.515226 3.870194 3.790065 5.5801292 1.935097 [,8] [,9] [,10] [,11] [,12] [1,] -4.160258 3.709935 2.919871 -1.725161 -3.515226 [2,] 6.160258 6.290065 8.080129 4.725161 5.515226 $out [1] 13 8 -1 $group [1] 5 7 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4, 0, 5, 7, 9, -1, 0, 3, 6, 13, -1, -1, 1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5cngl1386062935.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,] 0.0 -4 -4.0 0.0 -4.0 -10.0 NA [2,] 6.5 -2 0.5 3.0 0.5 -3.5 NA [3,] 8.0 -1 3.0 5.5 2.5 -1.0 NA [4,] 11.5 0 4.5 6.0 4.5 1.0 NA [5,] 13.0 1 6.0 7.0 6.0 3.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 5.719466 -1.91221343 1.175573 4.13168 0.6755731 -3.05248 NA [2,] 10.280534 -0.08778657 4.824427 6.86832 4.3244269 1.05248 NA $out [1] 6 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(0, 6.5, 8, 11.5, 13, -4, -2, -1, 0, 1, -4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6bpx71386062935.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,] 2.926887 8.0 1.750 [2,] 3.487603 9.0 2.625 [3,] 4.429866 12.0 4.750 [4,] 5.112011 13.5 5.750 [5,] 5.845226 16.0 7.000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.688963 9.94752 3.324667 [2,] 5.170769 14.05248 6.175333 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.92688685580203, 3.48760349044445, 4.42986629603954, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1oexi1386062935.ps tmp/1oexi1386062935.png",intern=TRUE)) character(0) > try(system("convert tmp/2ht621386062935.ps tmp/2ht621386062935.png",intern=TRUE)) character(0) > try(system("convert tmp/3tqlu1386062935.ps tmp/3tqlu1386062935.png",intern=TRUE)) character(0) > try(system("convert tmp/478d41386062935.ps tmp/478d41386062935.png",intern=TRUE)) character(0) > try(system("convert tmp/5cngl1386062935.ps tmp/5cngl1386062935.png",intern=TRUE)) character(0) > try(system("convert tmp/6bpx71386062935.ps tmp/6bpx71386062935.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.915 1.188 6.109