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(32.98,32.7,32.74,32.87,32.95,32.94,32.94,32.97,32.87,32.96,32.97,32.99,32.99,33.04,33.23,33.03,33.05,33.03,33.04,33.11,33.14,33.08,33.09,33.07,33.07,33.02,33,33.08,33.35,33.36,33.36,33.35,33.41,33.47,33.47,33.48,33.48,33.55,33.68,33.72,33.79,33.83,33.83,33.84,33.91,34.06,34.16,34.16,34.16,34.29,34.48,34.48,34.39,34.29,34.29,34.25,34.2,34.1,34.09,34.06,34.06,34.04,34.19,34.21,34.17,34.08,34.08,34.08,34.3,34.28,34.45,34.41) > 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,] 32.98 32.99 33.07 33.48 34.16 34.06 NA [2,] 32.70 33.04 33.02 33.55 34.29 34.04 NA [3,] 32.74 33.23 33.00 33.68 34.48 34.19 NA [4,] 32.87 33.03 33.08 33.72 34.48 34.21 NA [5,] 32.95 33.05 33.35 33.79 34.39 34.17 NA [6,] 32.94 33.03 33.36 33.83 34.29 34.08 NA [7,] 32.94 33.04 33.36 33.83 34.29 34.08 NA [8,] 32.97 33.11 33.35 33.84 34.25 34.08 NA [9,] 32.87 33.14 33.41 33.91 34.20 34.30 NA [10,] 32.96 33.08 33.47 34.06 34.10 34.28 NA [11,] 32.97 33.09 33.47 34.16 34.09 34.45 NA [12,] 32.99 33.07 33.48 34.16 34.06 34.41 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/191xi1353958708.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/2c69z1353958708.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/3sik41353958708.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/4digl1353958708.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,] 32.980 32.700 32.740 32.87 32.95 32.940 32.940 32.970 32.87 32.960 32.97 [2,] 32.990 33.020 33.000 33.03 33.05 33.030 33.040 33.110 33.14 33.080 33.09 [3,] 33.275 33.295 33.455 33.40 33.57 33.595 33.595 33.595 33.66 33.765 33.78 [4,] 34.060 34.040 34.190 34.21 34.17 34.080 34.080 34.080 34.20 34.100 34.16 [5,] 34.160 34.290 34.480 34.48 34.39 34.290 34.290 34.250 34.30 34.280 34.45 [,12] [1,] 32.99 [2,] 33.07 [3,] 33.77 [4,] 34.16 [5,] 34.41 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 32.58482 32.63707 32.68741 32.63886 32.84756 32.91772 32.92417 32.96932 [2,] 33.96518 33.95293 34.22259 34.16114 34.29244 34.27228 34.26583 34.22068 [,9] [,10] [,11] [,12] [1,] 32.97627 33.10707 33.08982 33.06691 [2,] 34.34373 34.42293 34.47018 34.47309 $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(32.98, 32.99, 33.275, 34.06, 34.16, 32.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56rk81353958708.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,] 32.740 32.990 33.000 33.480 34.06 34.04 NA [2,] 32.870 33.035 33.075 33.700 34.13 34.08 NA [3,] 32.945 33.060 33.355 33.830 34.27 34.18 NA [4,] 32.970 33.100 33.440 33.985 34.34 34.29 NA [5,] 32.990 33.140 33.480 34.160 34.48 34.45 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 32.89939 33.03035 33.18852 33.70001 34.17422 34.08422 NA [2,] 32.99061 33.08965 33.52148 33.95999 34.36578 34.27578 NA $out [1] 32.70 33.23 $group [1] 1 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(32.74, 32.87, 32.945, 32.97, 32.99, 32.99, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ar441353958708.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.5310367 1.180 0.85000 [2,] 0.5605599 1.335 0.90125 [3,] 0.5906450 1.425 0.91625 [4,] 0.6214475 1.535 0.96000 [5,] 0.6859057 1.740 1.04500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.5628737 1.333779 0.8894537 [2,] 0.6184163 1.516221 0.9430463 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.53103672189407, 0.560559859438121, 0.590644985505706, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/191xi1353958708.ps tmp/191xi1353958708.png",intern=TRUE)) character(0) > try(system("convert tmp/2c69z1353958708.ps tmp/2c69z1353958708.png",intern=TRUE)) character(0) > try(system("convert tmp/3sik41353958708.ps tmp/3sik41353958708.png",intern=TRUE)) character(0) > try(system("convert tmp/4digl1353958708.ps tmp/4digl1353958708.png",intern=TRUE)) character(0) > try(system("convert tmp/56rk81353958708.ps tmp/56rk81353958708.png",intern=TRUE)) character(0) > try(system("convert tmp/6ar441353958708.ps tmp/6ar441353958708.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.009 0.498 3.559