R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(1.94,1.82,1.8,1.79,1.79,1.78,1.81,1.84,1.87,1.87,1.87,1.84,1.82,1.83,1.83,1.82,1.83,1.87,1.88,1.9,1.98,2.03,2.14,2.42,2.73,2.84,2.85,2.94,3.06,3.24,3.18,3.01,2.87,2.73,2.63,2.39,2.26,2.11,2.01,1.99,1.96,1.93,1.98,2.07,2.24,2.31,2.23,2.26,2.28,2.3,2.33,2.26,2.24,2.47,2.55,2.89,3.21,3.21,2.92,2.68,2.4,2.28,2.24,2.2,2.18,2.23,2.24,2.25,2.23,2.25,2.23,2.21) > 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,] 1.94 1.82 2.73 2.26 2.28 2.40 NA [2,] 1.82 1.83 2.84 2.11 2.30 2.28 NA [3,] 1.80 1.83 2.85 2.01 2.33 2.24 NA [4,] 1.79 1.82 2.94 1.99 2.26 2.20 NA [5,] 1.79 1.83 3.06 1.96 2.24 2.18 NA [6,] 1.78 1.87 3.24 1.93 2.47 2.23 NA [7,] 1.81 1.88 3.18 1.98 2.55 2.24 NA [8,] 1.84 1.90 3.01 2.07 2.89 2.25 NA [9,] 1.87 1.98 2.87 2.24 3.21 2.23 NA [10,] 1.87 2.03 2.73 2.31 3.21 2.25 NA [11,] 1.87 2.14 2.63 2.23 2.92 2.23 NA [12,] 1.84 2.42 2.39 2.26 2.68 2.21 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/fisher/rcomp/tmp/1oc4l1355068549.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/fisher/rcomp/tmp/2yax71355068549.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/fisher/rcomp/tmp/3qz231355068549.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/fisher/rcomp/tmp/4yfbs1355068549.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,] 1.82 1.820 1.800 1.790 1.79 1.78 1.81 1.84 1.870 1.87 1.87 2.210 [2,] 1.94 1.830 1.830 1.820 1.83 1.87 1.88 1.90 1.980 2.03 2.14 2.210 [3,] 2.27 2.195 2.125 2.095 2.07 2.08 2.11 2.16 2.235 2.28 2.23 2.325 [4,] 2.40 2.300 2.330 2.260 2.24 2.47 2.55 2.89 2.870 2.73 2.63 2.420 [5,] 2.73 2.840 2.850 2.260 2.24 3.24 3.18 3.01 3.210 3.21 2.92 2.680 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.973285 1.891835 1.802484 1.811186 1.805537 1.692981 1.677828 1.521418 [2,] 2.566715 2.498165 2.447516 2.378814 2.334463 2.467019 2.542172 2.798582 [,9] [,10] [,11] [,12] [1,] 1.660921 1.828477 1.913934 2.189543 [2,] 2.809079 2.731523 2.546066 2.460457 $out [1] 2.94 3.06 1.84 $group [1] 4 5 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1.82, 1.94, 2.27, 2.4, 2.73, 1.82, 1.83, 2.195, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5go311355068549.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,] 1.780 1.820 2.390 1.930 2.240 2.180 NA [2,] 1.795 1.830 2.730 1.985 2.290 2.220 NA [3,] 1.830 1.875 2.860 2.090 2.510 2.235 NA [4,] 1.870 2.005 3.035 2.250 2.905 2.250 NA [5,] 1.940 2.140 3.240 2.310 3.210 2.280 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.795792 1.795181 2.720887 1.969132 2.229494 2.221317 NA [2,] 1.864208 1.954819 2.999113 2.210868 2.790506 2.248683 NA $out [1] 2.42 2.40 $group [1] 2 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1.78, 1.795, 1.83, 1.87, 1.94, 1.82, 1.83, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6ltir1355068549.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.2786396 0.840 0.19000 [2,] 0.3769416 1.035 0.36500 [3,] 0.4468858 1.160 0.41375 [4,] 0.5127821 1.340 0.55375 [5,] 0.5470893 1.460 0.78750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.3849280 1.020887 0.3276599 [2,] 0.5088436 1.299113 0.4998401 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.27863955210989, 0.376941609314812, 0.446885817511558, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1oc4l1355068549.ps tmp/1oc4l1355068549.png",intern=TRUE)) character(0) > try(system("convert tmp/2yax71355068549.ps tmp/2yax71355068549.png",intern=TRUE)) character(0) > try(system("convert tmp/3qz231355068549.ps tmp/3qz231355068549.png",intern=TRUE)) character(0) > try(system("convert tmp/4yfbs1355068549.ps tmp/4yfbs1355068549.png",intern=TRUE)) character(0) > try(system("convert tmp/5go311355068549.ps tmp/5go311355068549.png",intern=TRUE)) character(0) > try(system("convert tmp/6ltir1355068549.ps tmp/6ltir1355068549.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.210 0.897 4.092