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(7.72,7.67,7.84,7.79,7.83,7.94,8.02,8.06,8.12,8.13,7.97,8.01,8,7.9,7.99,8.02,8.08,8.02,8.07,8.11,8.19,8.16,8.08,8.22,8.15,8.19,8.31,8.3,8.34,8.31,8.38,8.34,8.44,8.64,8.6,8.61,8.54,8.69,8.73,8.91,9.01,9.08,8.94,9.03,9.02,8.96,9.03,8.94,8.95,8.95,8.99,8.93,8.98,8.95,9.02,8.92,9.1,9.06,8.97,8.89) > 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,] 7.72 8.00 8.15 8.54 8.95 NA [2,] 7.67 7.90 8.19 8.69 8.95 NA [3,] 7.84 7.99 8.31 8.73 8.99 NA [4,] 7.79 8.02 8.30 8.91 8.93 NA [5,] 7.83 8.08 8.34 9.01 8.98 NA [6,] 7.94 8.02 8.31 9.08 8.95 NA [7,] 8.02 8.07 8.38 8.94 9.02 NA [8,] 8.06 8.11 8.34 9.03 8.92 NA [9,] 8.12 8.19 8.44 9.02 9.10 NA [10,] 8.13 8.16 8.64 8.96 9.06 NA [11,] 7.97 8.08 8.60 9.03 8.97 NA [12,] 8.01 8.22 8.61 8.94 8.89 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/1kkck1335446167.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/2kw0k1335446167.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/3vvpt1335446167.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/45bt31335446167.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.72 7.67 7.84 7.79 7.83 7.94 8.02 8.06 8.12 8.13 7.97 8.01 [2,] 8.00 7.90 7.99 8.02 8.08 8.02 8.07 8.11 8.19 8.16 8.08 8.22 [3,] 8.15 8.19 8.31 8.30 8.34 8.31 8.38 8.34 8.44 8.64 8.60 8.61 [4,] 8.54 8.69 8.73 8.91 8.98 8.95 8.94 8.92 9.02 8.96 8.97 8.89 [5,] 8.95 8.95 8.99 8.93 9.01 9.08 9.02 9.03 9.10 9.06 9.03 8.94 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.768437 7.631788 7.787118 7.671128 7.704062 7.652864 7.76526 7.767656 [2,] 8.531563 8.748212 8.832882 8.928872 8.975938 8.967136 8.99474 8.912344 [,9] [,10] [,11] [,12] [1,] 7.853524 8.074722 7.971128 8.13658 [2,] 9.026476 9.205278 9.228872 9.08342 $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.72, 8, 8.15, 8.54, 8.95, 7.67, 7.9, 8.19, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5n2801335446167.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,] 7.670 7.900 8.150 8.540 8.890 NA [2,] 7.810 8.010 8.305 8.820 8.940 NA [3,] 7.955 8.075 8.340 8.950 8.960 NA [4,] 8.040 8.135 8.520 9.025 9.005 NA [5,] 8.130 8.220 8.640 9.080 9.100 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 7.850095 8.017987 8.241937 8.856498 8.930353 NA [2,] 8.059905 8.132013 8.438063 9.043502 8.989647 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(7.67, 7.81, 7.955, 8.04, 8.13, 7.9, 8.01, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6x1st1335446167.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.4094264 0.930 0.670 [2,] 0.4576225 0.975 0.765 [3,] 0.4832077 1.100 0.820 [4,] 0.5217492 1.165 0.890 [5,] 0.5342284 1.280 0.930 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.4539591 1.01334 0.7629867 [2,] 0.5124563 1.18666 0.8770133 $out [1] 0.54 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.409426428067363, 0.457622529222845, 0.483207718596394, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kkck1335446167.ps tmp/1kkck1335446167.png",intern=TRUE)) character(0) > try(system("convert tmp/2kw0k1335446167.ps tmp/2kw0k1335446167.png",intern=TRUE)) character(0) > try(system("convert tmp/3vvpt1335446167.ps tmp/3vvpt1335446167.png",intern=TRUE)) character(0) > try(system("convert tmp/45bt31335446167.ps tmp/45bt31335446167.png",intern=TRUE)) character(0) > try(system("convert tmp/5n2801335446167.ps tmp/5n2801335446167.png",intern=TRUE)) character(0) > try(system("convert tmp/6x1st1335446167.ps tmp/6x1st1335446167.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.550 0.354 1.943