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(26.73,26.85,27.01,27.09,27.11,27.16,27.13,27.19,27.49,27.63,27.72,27.77,27.81,27.92,28.07,28.14,28.17,28.2,28.21,28.2,28.19,28.24,28.25,28.26,28.33,28.67,28.81,28.99,29.16,29.25,29.25,29.38,29.48,29.65,29.69,29.73,29.81,30.05,30.29,30.37,30.5,30.67,30.76,30.84,30.86,31.09,31.2,31.19,31.18,31.31,31.39,31.39,31.37,31.36,31.37,31.35,31.34,31.47,31.48,31.54) > 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,] 26.73 27.81 28.33 29.81 31.18 NA [2,] 26.85 27.92 28.67 30.05 31.31 NA [3,] 27.01 28.07 28.81 30.29 31.39 NA [4,] 27.09 28.14 28.99 30.37 31.39 NA [5,] 27.11 28.17 29.16 30.50 31.37 NA [6,] 27.16 28.20 29.25 30.67 31.36 NA [7,] 27.13 28.21 29.25 30.76 31.37 NA [8,] 27.19 28.20 29.38 30.84 31.35 NA [9,] 27.49 28.19 29.48 30.86 31.34 NA [10,] 27.63 28.24 29.65 31.09 31.47 NA [11,] 27.72 28.25 29.69 31.20 31.48 NA [12,] 27.77 28.26 29.73 31.19 31.54 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/1wwx81338298826.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/2phht1338298826.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/36ovk1338298826.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/4vv6x1338298826.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,] 26.73 26.85 27.01 27.09 27.11 27.16 27.13 27.19 27.49 27.63 27.72 27.77 [2,] 27.81 27.92 28.07 28.14 28.17 28.20 28.21 28.20 28.19 28.24 28.25 28.26 [3,] 28.33 28.67 28.81 28.99 29.16 29.25 29.25 29.38 29.48 29.65 29.69 29.73 [4,] 29.81 30.05 30.29 30.37 30.50 30.67 30.76 30.84 30.86 31.09 31.20 31.19 [5,] 31.18 31.31 31.39 31.39 31.37 31.36 31.37 31.35 31.34 31.47 31.48 31.54 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 26.91681 27.16495 27.24135 27.41429 27.51363 27.5047 27.44818 27.51458 [2,] 29.74319 30.17505 30.37865 30.56571 30.80637 30.9953 31.05182 31.24542 [,9] [,10] [,11] [,12] [1,] 27.59338 27.6362 27.60554 27.65967 [2,] 31.36662 31.6638 31.77446 31.80033 $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(26.73, 27.81, 28.33, 29.81, 31.18, 26.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/53af71338298826.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,] 26.730 28.070 28.330 29.810 31.310 NA [2,] 27.050 28.105 28.900 30.330 31.345 NA [3,] 27.145 28.195 29.250 30.715 31.370 NA [4,] 27.560 28.225 29.565 30.975 31.430 NA [5,] 27.770 28.260 29.730 31.200 31.540 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 26.91239 28.14027 28.94669 30.42081 31.33123 NA [2,] 27.37761 28.24973 29.55331 31.00919 31.40877 NA $out [1] 27.81 27.92 31.18 $group [1] 2 2 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(26.73, 27.05, 27.145, 27.56, 27.77, 28.07, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6x6h41338298826.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,] 1.657399 3.760 2.000 [2,] 1.691338 3.845 2.225 [3,] 1.721876 4.220 2.510 [4,] 1.745444 4.340 2.760 [5,] 1.755591 4.460 2.950 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.697198 3.994227 2.265983 [2,] 1.746554 4.445773 2.754017 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.65739856401531, 1.69133816508714, 1.72187608237701, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1wwx81338298826.ps tmp/1wwx81338298826.png",intern=TRUE)) character(0) > try(system("convert tmp/2phht1338298826.ps tmp/2phht1338298826.png",intern=TRUE)) character(0) > try(system("convert tmp/36ovk1338298826.ps tmp/36ovk1338298826.png",intern=TRUE)) character(0) > try(system("convert tmp/4vv6x1338298826.ps tmp/4vv6x1338298826.png",intern=TRUE)) character(0) > try(system("convert tmp/53af71338298826.ps tmp/53af71338298826.png",intern=TRUE)) character(0) > try(system("convert tmp/6x6h41338298826.ps tmp/6x6h41338298826.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.623 0.417 2.044