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(23.9,24.06,24.33,24.39,24.39,24.49,24.83,25.08,25.11,25.13,25.17,25.11,25.35,25.36,25.35,25.34,25.39,25.58,25.71,25.66,25.74,25.73,25.72,25.55,25.71,25.92,25.93,26,26.02,26.08,26.17,26.18,26.21,26.28,26.34,26.17,26.38,26.36,26.27,26.26,26.49,26.99,27.14,27.1,27.01,26.93,26.97,26.35,26.93,26.92,27.05,27.01,26.9,26.93,26.95,26.89,26.7,26.55,26.48,25.71,26.17,26.31,26.58,26.49,26.57,26.6,26.69,26.59,26.75,26.79,26.8,26.62) > 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,] 23.90 25.35 25.71 26.38 26.93 26.17 NA [2,] 24.06 25.36 25.92 26.36 26.92 26.31 NA [3,] 24.33 25.35 25.93 26.27 27.05 26.58 NA [4,] 24.39 25.34 26.00 26.26 27.01 26.49 NA [5,] 24.39 25.39 26.02 26.49 26.90 26.57 NA [6,] 24.49 25.58 26.08 26.99 26.93 26.60 NA [7,] 24.83 25.71 26.17 27.14 26.95 26.69 NA [8,] 25.08 25.66 26.18 27.10 26.89 26.59 NA [9,] 25.11 25.74 26.21 27.01 26.70 26.75 NA [10,] 25.13 25.73 26.28 26.93 26.55 26.79 NA [11,] 25.17 25.72 26.34 26.97 26.48 26.80 NA [12,] 25.11 25.55 26.17 26.35 25.71 26.62 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/1w82h1355313661.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/2ewio1355313661.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/3u4qx1355313661.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/49c3e1355313661.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,] 23.90 24.060 24.33 24.39 24.390 24.49 24.83 25.080 25.110 25.130 25.17 [2,] 25.35 25.360 25.35 25.34 25.390 25.58 25.71 25.660 25.740 25.730 25.72 [3,] 25.94 26.115 26.10 26.13 26.255 26.34 26.43 26.385 26.455 26.415 26.41 [4,] 26.38 26.360 26.58 26.49 26.570 26.93 26.95 26.890 26.750 26.790 26.80 [5,] 26.93 26.920 27.05 27.01 26.900 26.99 27.14 27.100 27.010 26.930 26.97 [,12] [1,] 25.11 [2,] 25.55 [3,] 25.94 [4,] 26.35 [5,] 26.62 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 25.27562 25.46997 25.30661 25.38821 25.49386 25.46921 25.63016 25.59161 [2,] 26.60438 26.76003 26.89339 26.87179 27.01614 27.21079 27.22984 27.17839 [,9] [,10] [,11] [,12] [1,] 25.80352 25.73127 25.71337 25.42397 [2,] 27.10648 27.09873 27.10663 26.45603 $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(23.9, 25.35, 25.94, 26.38, 26.93, 24.06, 25.36, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5frzi1355313661.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,] 23.90 25.340 25.710 26.260 26.480 26.310 NA [2,] 24.36 25.355 25.965 26.355 26.625 26.530 NA [3,] 24.66 25.565 26.125 26.710 26.910 26.595 NA [4,] 25.11 25.715 26.195 27.000 26.940 26.720 NA [5,] 25.17 25.740 26.340 27.140 27.050 26.800 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 24.31792 25.4008 26.0201 26.41581 26.76633 26.50834 NA [2,] 25.00208 25.7292 26.2299 27.00419 27.05367 26.68166 NA $out [1] 25.71 26.17 $group [1] 5 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(23.9, 24.36, 24.66, 25.11, 25.17, 25.34, 25.355, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6vwka1355313661.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.5611565 1.510 0.71500 [2,] 0.7040721 1.850 0.85500 [3,] 0.8996563 2.405 0.90750 [4,] 0.9633755 2.670 1.01625 [5,] 1.0534894 3.030 1.14250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.7813863 2.030992 0.8339528 [2,] 1.0179263 2.779008 0.9810472 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.561156543815242, 0.704072139639566, 0.899656309739226, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1w82h1355313661.ps tmp/1w82h1355313661.png",intern=TRUE)) character(0) > try(system("convert tmp/2ewio1355313661.ps tmp/2ewio1355313661.png",intern=TRUE)) character(0) > try(system("convert tmp/3u4qx1355313661.ps tmp/3u4qx1355313661.png",intern=TRUE)) character(0) > try(system("convert tmp/49c3e1355313661.ps tmp/49c3e1355313661.png",intern=TRUE)) character(0) > try(system("convert tmp/5frzi1355313661.ps tmp/5frzi1355313661.png",intern=TRUE)) character(0) > try(system("convert tmp/6vwka1355313661.ps tmp/6vwka1355313661.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.675 1.060 5.682