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(7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3,8.1,7.9,7.9,8.3,8.6,8.7,8.5,8.3,8,8,8.8,8.7,8.5,8.1,7.8,7.7,7.5,7.2,6.9,6.6,6.5,6.6,7.7,8,7.7,7.3,7,7,7.3,7.3,7.1,7.1,7,7,7.5,7.8,7.9,8.1,8.3,8.4,8.6,8.5,8.4,8.3,8,8,8.7,8.7,8.6,8.5,8.5,8.6) > 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,] 7.3 7.7 8.6 7.5 7.3 8.6 NA [2,] 7.1 8.0 8.7 7.2 7.3 8.5 NA [3,] 6.8 8.0 8.5 6.9 7.1 8.4 NA [4,] 6.4 7.7 8.3 6.6 7.1 8.3 NA [5,] 6.1 7.3 8.0 6.5 7.0 8.0 NA [6,] 6.5 7.4 8.0 6.6 7.0 8.0 NA [7,] 7.7 8.1 8.8 7.7 7.5 8.7 NA [8,] 7.9 8.3 8.7 8.0 7.8 8.7 NA [9,] 7.5 8.1 8.5 7.7 7.9 8.6 NA [10,] 6.9 7.9 8.1 7.3 8.1 8.5 NA [11,] 6.6 7.9 7.8 7.0 8.3 8.5 NA [12,] 6.9 8.3 7.7 7.0 8.4 8.6 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/1ik501416778127.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/29uje1416778127.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/370df1416778127.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/4e5911416778127.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,] 7.3 7.10 6.80 6.4 6.10 6.5 7.5 7.80 7.5 6.9 6.60 6.9 [2,] 7.3 7.20 6.90 6.6 6.50 6.6 7.7 7.90 7.7 7.3 7.00 7.0 [3,] 7.6 7.65 7.55 7.4 7.15 7.2 7.9 8.15 8.0 8.0 7.85 8.0 [4,] 8.6 8.50 8.40 8.3 8.00 8.0 8.7 8.70 8.5 8.1 8.30 8.4 [5,] 8.6 8.70 8.50 8.3 8.00 8.0 8.8 8.70 8.6 8.5 8.50 8.6 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.761458 6.811458 6.582452 6.303445 6.182452 6.296955 7.254968 7.633974 [2,] 8.438542 8.488542 8.517548 8.496555 8.117548 8.103045 8.545032 8.666026 [,9] [,10] [,11] [,12] [1,] 7.483974 7.483974 7.011458 7.096955 [2,] 8.516026 8.516026 8.688542 8.903045 $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(7.3, 7.3, 7.6, 8.6, 8.6, 7.1, 7.2, 7.65, 8.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5qsdu1416778127.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,] 6.10 7.30 7.70 6.50 7.0 8.00 NA [2,] 6.55 7.70 8.00 6.75 7.1 8.35 NA [3,] 6.90 7.95 8.40 7.10 7.4 8.50 NA [4,] 7.40 8.10 8.65 7.60 8.0 8.60 NA [5,] 7.90 8.30 8.80 8.00 8.4 8.70 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.512309 7.767557 8.103531 6.712309 6.989504 8.385973 NA [2,] 7.287691 8.132443 8.696469 7.487691 7.810496 8.614027 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(6.1, 6.55, 6.9, 7.4, 7.9, 7.3, 7.7, 7.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6wg581416778127.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,] 0.3983298 0.9 0.6500 [2,] 0.5713933 1.3 0.7625 [3,] 0.6805704 1.6 1.0875 [4,] 0.7572421 1.8 1.2000 [5,] 0.8294577 1.9 1.4250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.5958035 1.371947 0.8879533 [2,] 0.7653372 1.828053 1.2870467 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.398329846567724, 0.571393270594575, 0.680570359401009, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ik501416778127.ps tmp/1ik501416778127.png",intern=TRUE)) character(0) > try(system("convert tmp/29uje1416778127.ps tmp/29uje1416778127.png",intern=TRUE)) character(0) > try(system("convert tmp/370df1416778127.ps tmp/370df1416778127.png",intern=TRUE)) character(0) > try(system("convert tmp/4e5911416778127.ps tmp/4e5911416778127.png",intern=TRUE)) character(0) > try(system("convert tmp/5qsdu1416778127.ps tmp/5qsdu1416778127.png",intern=TRUE)) character(0) > try(system("convert tmp/6wg581416778127.ps tmp/6wg581416778127.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.062 0.375 2.468