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(98.68,99.21,99.36,100.72,102.27,102.62,102.97,102.88,102.9,103.01,103.02,103.73,104.18,103.73,103.78,103.61,103.84,103.86,104.14,104.05,104.01,104.49,104.83,104.78,104.95,105.28,105.28,105.91,106.81,106.39,107.02,106.92,107.01,106.79,107.41,107.13,107.54,108.48,108.5,108.27,109.42,110.09,109.98,109.99,109.54,108.85,106.76,107.56,106.24,108.85,111.11,111.85,110.68,106.96,106.74,105.73,105.66,104.01,106.86,108.84,110.66,106.93,103.74,101.64,102.17,101.13,100.64,100.43,99.77,99.79,99.47,99.63) > 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,] 98.68 104.18 104.95 107.54 106.24 110.66 NA [2,] 99.21 103.73 105.28 108.48 108.85 106.93 NA [3,] 99.36 103.78 105.28 108.50 111.11 103.74 NA [4,] 100.72 103.61 105.91 108.27 111.85 101.64 NA [5,] 102.27 103.84 106.81 109.42 110.68 102.17 NA [6,] 102.62 103.86 106.39 110.09 106.96 101.13 NA [7,] 102.97 104.14 107.02 109.98 106.74 100.64 NA [8,] 102.88 104.05 106.92 109.99 105.73 100.43 NA [9,] 102.90 104.01 107.01 109.54 105.66 99.77 NA [10,] 103.01 104.49 106.79 108.85 104.01 99.79 NA [11,] 103.02 104.83 107.41 106.76 106.86 99.47 NA [12,] 103.73 104.78 107.13 107.56 108.84 99.63 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/1fme31354914649.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/2cos31354914649.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/3de4l1354914649.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/4zyul1354914649.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] [1,] 104.180 99.210 99.36 100.72 102.170 101.130 100.64 100.43 99.770 99.79 [2,] 104.180 103.730 103.74 101.64 102.270 102.620 102.97 102.88 102.900 103.01 [3,] 105.595 106.105 104.53 104.76 105.325 105.125 105.44 104.89 104.835 104.25 [4,] 107.540 108.480 108.50 108.27 109.420 106.960 107.02 106.92 107.010 106.79 [5,] 110.660 108.850 111.11 111.85 110.680 110.090 109.98 109.99 109.540 108.85 [,11] [,12] [1,] 99.470 99.630 [2,] 103.020 103.730 [3,] 105.795 105.955 [4,] 106.860 107.560 [5,] 107.410 108.840 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 103.4277 103.0411 101.4596 100.4834 100.713 102.3256 102.8276 102.2841 [2,] 107.7623 109.1689 107.6004 109.0366 109.937 107.9244 108.0524 107.4959 [,9] [,10] [,11] [,12] [1,] 102.1839 101.8118 103.3181 103.4845 [2,] 107.4861 106.6882 108.2719 108.4255 $out [1] 98.68 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(104.18, 104.18, 105.595, 107.54, 110.66, 99.21, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5sk311354914649.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,] 98.68 103.610 104.950 106.760 104.010 99.470 NA [2,] 100.04 103.810 105.595 107.915 105.985 99.780 NA [3,] 102.75 104.030 106.800 108.675 106.910 100.885 NA [4,] 102.99 104.335 107.015 109.760 109.765 102.955 NA [5,] 103.73 104.830 107.410 110.090 111.850 106.930 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 101.4045 103.7905 106.1523 107.8335 105.1859 99.43686 NA [2,] 104.0955 104.2695 107.4477 109.5165 108.6341 102.33314 NA $out [1] 110.66 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(98.68, 100.04, 102.75, 102.99, 103.73, 103.61, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6z6uh1354914649.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,] 3.047679 7.94 2.84250 [2,] 3.298959 9.01 3.40625 [3,] 3.368793 9.45 3.59125 [4,] 3.833138 10.45 3.96000 [5,] 4.226510 11.98 3.97500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.125150 8.793206 3.338681 [2,] 3.612435 10.106794 3.843819 $out [1] 5.5475 6.1050 $group [1] 3 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.04767944508605, 3.29895900339635, 3.36879273315994, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1fme31354914649.ps tmp/1fme31354914649.png",intern=TRUE)) character(0) > try(system("convert tmp/2cos31354914649.ps tmp/2cos31354914649.png",intern=TRUE)) character(0) > try(system("convert tmp/3de4l1354914649.ps tmp/3de4l1354914649.png",intern=TRUE)) character(0) > try(system("convert tmp/4zyul1354914649.ps tmp/4zyul1354914649.png",intern=TRUE)) character(0) > try(system("convert tmp/5sk311354914649.ps tmp/5sk311354914649.png",intern=TRUE)) character(0) > try(system("convert tmp/6z6uh1354914649.ps tmp/6z6uh1354914649.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.368 0.960 6.398