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(402.55,403.04,399.25,401.26,402.76,402.27,402.27,406.11,406.39,407.88,407.77,407.77,407.77,408.06,403.74,403.44,404.3,403.29,403.29,400.66,400.84,401.31,402,402,402,403.33,403.79,403.04,402.91,406.55,406.55,404.69,404.74,404.2,404.18,404.18,404.18,404.82,406.46,407.25,407.34,404.3,404.3,404.7,406.82,406.82,406.76,406.76,406.76,407.67,406.03,401.97,401.84,402.24,402.24,401.57,401.63,402.06,402.11,402.43) > 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,] 402.55 407.77 402.00 404.18 406.76 NA [2,] 403.04 408.06 403.33 404.82 407.67 NA [3,] 399.25 403.74 403.79 406.46 406.03 NA [4,] 401.26 403.44 403.04 407.25 401.97 NA [5,] 402.76 404.30 402.91 407.34 401.84 NA [6,] 402.27 403.29 406.55 404.30 402.24 NA [7,] 402.27 403.29 406.55 404.30 402.24 NA [8,] 406.11 400.66 404.69 404.70 401.57 NA [9,] 406.39 400.84 404.74 406.82 401.63 NA [10,] 407.88 401.31 404.20 406.82 402.06 NA [11,] 407.77 402.00 404.18 406.76 402.11 NA [12,] 407.77 402.00 404.18 406.76 402.43 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/1ldqd1335805265.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/24x6q1335805265.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/3kks81335805265.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/41zae1335805265.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] [1,] 402.00 403.04 403.74 401.26 401.84 402.24 402.24 400.66 400.84 401.31 [2,] 402.55 403.33 403.74 401.97 402.76 402.27 402.27 401.57 401.63 402.06 [3,] 404.18 404.82 403.79 403.04 402.91 403.29 403.29 404.69 404.74 404.20 [4,] 406.76 407.67 406.03 403.44 404.30 404.30 404.30 404.70 406.39 406.82 [5,] 407.77 408.06 406.46 403.44 404.30 406.55 406.55 406.11 406.82 407.88 [,11] [,12] [1,] 402.00 402.00 [2,] 402.11 402.43 [3,] 404.18 404.18 [4,] 406.76 406.76 [5,] 407.77 407.77 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 401.2052 401.7534 402.1719 402.0013 401.8218 401.8556 401.8556 402.4783 [2,] 407.1548 407.8866 405.4081 404.0787 403.9982 404.7244 404.7244 406.9017 [,9] [,10] [,11] [,12] [1,] 401.3766 400.8366 400.8943 401.1204 [2,] 408.1034 407.5634 407.4657 407.2396 $out [1] 399.25 407.25 407.34 $group [1] 3 4 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(402, 402.55, 404.18, 406.76, 407.77, 403.04, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/52hu41335805265.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,] 399.25 400.660 402.000 404.18 401.570 NA [2,] 402.27 401.655 403.185 404.50 401.905 NA [3,] 402.90 403.290 404.180 406.61 402.175 NA [4,] 407.08 404.020 404.715 406.82 404.230 NA [5,] 407.88 404.300 406.550 407.34 407.670 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 400.7061 402.2113 403.4822 405.5518 401.1146 NA [2,] 405.0939 404.3687 404.8778 407.6682 403.2354 NA $out [1] 407.77 408.06 $group [1] 2 2 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(399.25, 402.27, 402.9, 407.08, 407.88, 400.66, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6rshl1335805265.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.790433 4.310 1.470 [2,] 2.232873 5.235 2.030 [3,] 2.454518 5.770 3.670 [4,] 2.683458 5.985 4.495 [5,] 2.872974 6.570 4.760 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.249003 5.42792 2.545697 [2,] 2.660033 6.11208 4.794303 $out [1] 7.21 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.79043290854475, 2.23287264131889, 2.45451798034876, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ldqd1335805265.ps tmp/1ldqd1335805265.png",intern=TRUE)) character(0) > try(system("convert tmp/24x6q1335805265.ps tmp/24x6q1335805265.png",intern=TRUE)) character(0) > try(system("convert tmp/3kks81335805265.ps tmp/3kks81335805265.png",intern=TRUE)) character(0) > try(system("convert tmp/41zae1335805265.ps tmp/41zae1335805265.png",intern=TRUE)) character(0) > try(system("convert tmp/52hu41335805265.ps tmp/52hu41335805265.png",intern=TRUE)) character(0) > try(system("convert tmp/6rshl1335805265.ps tmp/6rshl1335805265.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.520 0.428 1.952