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(52.21,52.53,53.06,53.23,53.25,53.27,53.35,53.6,53.98,54.18,54.27,54.32,54.4,54.73,54.96,55.27,55.27,55.26,55.37,55.53,55.55,55.54,55.6,55.56,55.64,56.13,56.69,56.8,56.93,57,57.01,57.21,57.17,57.36,57.29,57.26,57.29,57.68,58.19,58.34,58.46,58.67,58.72,58.74,58.77,58.84,59.13,59.12,59.12,59.33,59.49,59.67,59.7,59.73,59.74,59.62,59.6,59.98,60.05,60.06,60.1,60.18,60.38,60.52,60.78,60.72,60.72,60.86,60.99,61.11,61.17,61.19) > 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,] 52.21 54.40 55.64 57.29 59.12 60.10 NA [2,] 52.53 54.73 56.13 57.68 59.33 60.18 NA [3,] 53.06 54.96 56.69 58.19 59.49 60.38 NA [4,] 53.23 55.27 56.80 58.34 59.67 60.52 NA [5,] 53.25 55.27 56.93 58.46 59.70 60.78 NA [6,] 53.27 55.26 57.00 58.67 59.73 60.72 NA [7,] 53.35 55.37 57.01 58.72 59.74 60.72 NA [8,] 53.60 55.53 57.21 58.74 59.62 60.86 NA [9,] 53.98 55.55 57.17 58.77 59.60 60.99 NA [10,] 54.18 55.54 57.36 58.84 59.98 61.11 NA [11,] 54.27 55.60 57.29 59.13 60.05 61.17 NA [12,] 54.32 55.56 57.26 59.12 60.06 61.19 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/1rlrn1353927053.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/2mfev1353927053.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/3562c1353927053.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/4pfal1353927053.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] [1,] 52.210 52.530 53.06 53.23 53.250 53.270 53.350 53.600 53.98 54.18 54.27 [2,] 54.400 54.730 54.96 55.27 55.270 55.260 55.370 55.530 55.55 55.54 55.60 [3,] 56.465 56.905 57.44 57.57 57.695 57.835 57.865 57.975 57.97 58.10 58.21 [4,] 59.120 59.330 59.49 59.67 59.700 59.730 59.740 59.620 59.60 59.98 60.05 [5,] 60.100 60.180 60.38 60.52 60.780 60.720 60.720 60.860 60.99 61.11 61.17 [,12] [1,] 54.32 [2,] 55.56 [3,] 58.19 [4,] 60.06 [5,] 61.19 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 53.42045 53.93785 54.518 54.73186 54.83751 54.95171 55.04621 55.33682 [2,] 59.50955 59.87215 60.362 60.40814 60.55249 60.71829 60.68379 60.61318 [,9] [,10] [,11] [,12] [1,] 55.35762 55.23606 55.33961 55.28735 [2,] 60.58238 60.96394 61.08039 61.09265 $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(52.21, 54.4, 56.465, 59.12, 60.1, 52.53, 54.73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5tf261353927053.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,] 52.210 54.730 56.130 57.680 59.120 60.10 NA [2,] 53.145 55.110 56.745 58.265 59.545 60.45 NA [3,] 53.310 55.320 57.005 58.695 59.685 60.75 NA [4,] 54.080 55.545 57.235 58.805 59.860 61.05 NA [5,] 54.320 55.600 57.360 59.130 60.060 61.19 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 52.88354 55.12159 56.78151 58.4487 59.54133 60.47634 NA [2,] 53.73646 55.51841 57.22849 58.9413 59.82867 61.02366 NA $out [1] 54.40 55.64 57.29 $group [1] 2 3 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(52.21, 53.145, 53.31, 54.08, 54.32, 54.73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ilzp1353927053.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,] 2.619830 6.870 3.6850 [2,] 2.671010 6.970 3.6925 [3,] 2.769909 7.305 3.7375 [4,] 2.822562 7.490 3.8175 [5,] 2.966230 7.890 3.9525 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.700785 7.067825 3.680487 [2,] 2.839032 7.542175 3.794513 $out [1] 3.4500 3.4375 $group [1] 3 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.6198295109924, 2.67101041046007, 2.76990869266602, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1rlrn1353927053.ps tmp/1rlrn1353927053.png",intern=TRUE)) character(0) > try(system("convert tmp/2mfev1353927053.ps tmp/2mfev1353927053.png",intern=TRUE)) character(0) > try(system("convert tmp/3562c1353927053.ps tmp/3562c1353927053.png",intern=TRUE)) character(0) > try(system("convert tmp/4pfal1353927053.ps tmp/4pfal1353927053.png",intern=TRUE)) character(0) > try(system("convert tmp/5tf261353927053.ps tmp/5tf261353927053.png",intern=TRUE)) character(0) > try(system("convert tmp/6ilzp1353927053.ps tmp/6ilzp1353927053.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.327 0.734 4.080