R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(65,65.3,62.9,63.5,62.1,59.3,61.6,61.5,60.1,59.5,62.7,65.5,63.8,63.8,62.7,62.3,62.4,64.8,66.4,65.1,67.4,68.8,68.6,71.5,75,84.3,84,79.1,78.8,82.7,85.3,84.5,80.8,70.1,68.2,68.1,72.3,73.1,71.5,74.1,80.3,80.6,81.4,87.4,89.3,93.2,92.8,96.8,100.3,95.6,89,87.4,86.7,92.8,98.6,100.8,105.5,107.8,113.7,120.3) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 65.0 63.8 75.0 72.3 100.3 NA [2,] 65.3 63.8 84.3 73.1 95.6 NA [3,] 62.9 62.7 84.0 71.5 89.0 NA [4,] 63.5 62.3 79.1 74.1 87.4 NA [5,] 62.1 62.4 78.8 80.3 86.7 NA [6,] 59.3 64.8 82.7 80.6 92.8 NA [7,] 61.6 66.4 85.3 81.4 98.6 NA [8,] 61.5 65.1 84.5 87.4 100.8 NA [9,] 60.1 67.4 80.8 89.3 105.5 NA [10,] 59.5 68.8 70.1 93.2 107.8 NA [11,] 62.7 68.6 68.2 92.8 113.7 NA [12,] 65.5 71.5 68.1 96.8 120.3 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/1qqp31335456748.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/2l8vt1335456748.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/3vh701335456748.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/456ic1335456748.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,] 63.8 63.8 62.7 62.3 62.1 59.3 61.6 61.5 60.1 59.5 62.7 65.5 [2,] 65.0 65.3 62.9 63.5 62.4 64.8 66.4 65.1 67.4 68.8 68.2 68.1 [3,] 72.3 73.1 71.5 74.1 78.8 80.6 81.4 84.5 80.8 70.1 68.6 71.5 [4,] 75.0 84.3 84.0 79.1 80.3 82.7 85.3 87.4 89.3 93.2 92.8 96.8 [5,] 75.0 95.6 89.0 87.4 86.7 92.8 98.6 100.8 105.5 107.8 113.7 120.3 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 65.23403 59.67465 56.59079 63.07708 66.15191 67.95191 68.04531 68.74288 [2,] 79.36597 86.52535 86.40921 85.12292 91.44809 93.24809 94.75469 100.25712 [,9] [,10] [,11] [,12] [1,] 65.32552 52.85902 51.2177 51.22065 [2,] 96.27448 87.34098 85.9823 91.77935 $out [1] 100.3 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(63.8, 65, 72.3, 75, 75, 63.8, 65.3, 73.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/54cye1335456748.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] [1,] 59.30 62.30 68.10 71.50 86.70 NA [2,] 60.80 63.25 72.55 73.60 90.90 NA [3,] 62.40 64.95 79.95 81.00 99.45 NA [4,] 64.25 68.00 84.15 91.05 106.65 NA [5,] 65.50 71.50 85.30 96.80 120.30 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 60.82643 62.78349 74.65916 73.04094 92.26632 NA [2,] 63.97357 67.11651 85.24084 88.95906 106.63368 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(59.3, 60.8, 62.4, 64.25, 65.5, 62.3, 63.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/62s901335456748.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,] 10.60811 24.60 10.00 [2,] 12.75832 29.05 17.90 [3,] 14.84475 36.75 20.05 [4,] 18.95086 46.85 23.35 [5,] 23.62135 54.80 28.70 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 12.02030 28.6313 17.56422 [2,] 17.66921 44.8687 22.53578 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(10.6081101050093, 12.7583204576583, 14.8447525182958, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qqp31335456748.ps tmp/1qqp31335456748.png",intern=TRUE)) character(0) > try(system("convert tmp/2l8vt1335456748.ps tmp/2l8vt1335456748.png",intern=TRUE)) character(0) > try(system("convert tmp/3vh701335456748.ps tmp/3vh701335456748.png",intern=TRUE)) character(0) > try(system("convert tmp/456ic1335456748.ps tmp/456ic1335456748.png",intern=TRUE)) character(0) > try(system("convert tmp/54cye1335456748.ps tmp/54cye1335456748.png",intern=TRUE)) character(0) > try(system("convert tmp/62s901335456748.ps tmp/62s901335456748.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.376 0.345 1.753