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(49.98,50.12,50.37,50.39,50.34,50.32,50.32,50.32,50.67,50.86,50.95,51.02,51.02,51.06,50.9,51.23,51.29,51.3,51.3,51.3,51.46,51.47,51.77,51.82,51.82,51.84,51.9,51.94,52.22,52.27,52.27,52.28,52.53,52.73,52.72,52.67,52.67,52.65,52.69,52.73,52.84,52.83,52.83,52.84,52.82,53.09,53.4,53.43,53.43,53.42,53.6,53.69,54.05,54.04,54.04,54.08,54.05,54.39,54.38,54.46,54.46,54.69,54.91,55.52,56.01,56.07,56.07,56.09,56.29,56.45,56.87,56.87) > 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,] 49.98 51.02 51.82 52.67 53.43 54.46 NA [2,] 50.12 51.06 51.84 52.65 53.42 54.69 NA [3,] 50.37 50.90 51.90 52.69 53.60 54.91 NA [4,] 50.39 51.23 51.94 52.73 53.69 55.52 NA [5,] 50.34 51.29 52.22 52.84 54.05 56.01 NA [6,] 50.32 51.30 52.27 52.83 54.04 56.07 NA [7,] 50.32 51.30 52.27 52.83 54.04 56.07 NA [8,] 50.32 51.30 52.28 52.84 54.08 56.09 NA [9,] 50.67 51.46 52.53 52.82 54.05 56.29 NA [10,] 50.86 51.47 52.73 53.09 54.39 56.45 NA [11,] 50.95 51.77 52.72 53.40 54.38 56.87 NA [12,] 51.02 51.82 52.67 53.43 54.46 56.87 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/1qcas1354204134.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/2evep1354204134.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/352sl1354204134.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/49yym1354204134.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,] 49.980 50.120 50.370 50.390 50.34 50.32 50.32 50.32 50.670 50.86 50.95 [2,] 51.020 51.060 50.900 51.230 51.29 51.30 51.30 51.30 51.460 51.47 51.77 [3,] 52.245 52.245 52.295 52.335 52.53 52.55 52.55 52.56 52.675 52.91 53.06 [4,] 53.430 53.420 53.600 53.690 54.05 54.04 54.04 54.08 54.050 54.39 54.38 [5,] 54.460 54.690 54.910 55.520 56.01 56.07 56.07 56.09 56.290 56.45 56.87 [,12] [1,] 51.02 [2,] 51.82 [3,] 53.05 [4,] 54.46 [5,] 56.87 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 50.69047 50.72272 50.55341 50.74822 50.74971 50.78261 50.78261 50.76681 [2,] 53.79953 53.76728 54.03659 53.92178 54.31029 54.31739 54.31739 54.35319 [,9] [,10] [,11] [,12] [1,] 51.00437 51.02651 51.37647 51.34711 [2,] 54.34563 54.79349 54.74353 54.75289 $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(49.98, 51.02, 52.245, 53.43, 54.46, 50.12, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5pcc11354204134.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,] 49.980 50.900 51.82 52.650 53.420 54.460 NA [2,] 50.320 51.145 51.92 52.710 53.645 55.215 NA [3,] 50.355 51.300 52.27 52.830 54.045 56.070 NA [4,] 50.765 51.465 52.60 52.965 54.230 56.370 NA [5,] 51.020 51.820 52.73 53.090 54.460 56.870 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 50.15203 51.15405 51.95985 52.71369 53.77818 55.5432 NA [2,] 50.55797 51.44595 52.58015 52.94631 54.31182 56.5968 NA $out [1] 53.40 53.43 $group [1] 4 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(49.98, 50.32, 50.355, 50.765, 51.02, 50.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6y1xu1354204134.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,] 1.631024 4.480 1.97250 [2,] 1.769806 4.850 2.03125 [3,] 2.029988 5.645 2.18250 [4,] 2.050491 5.760 2.22375 [5,] 2.102716 5.920 2.28000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.901966 5.229943 2.094699 [2,] 2.158011 6.060057 2.270301 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.6310242180912, 1.76980616663902, 2.02998816964153, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qcas1354204134.ps tmp/1qcas1354204134.png",intern=TRUE)) character(0) > try(system("convert tmp/2evep1354204134.ps tmp/2evep1354204134.png",intern=TRUE)) character(0) > try(system("convert tmp/352sl1354204134.ps tmp/352sl1354204134.png",intern=TRUE)) character(0) > try(system("convert tmp/49yym1354204134.ps tmp/49yym1354204134.png",intern=TRUE)) character(0) > try(system("convert tmp/5pcc11354204134.ps tmp/5pcc11354204134.png",intern=TRUE)) character(0) > try(system("convert tmp/6y1xu1354204134.ps tmp/6y1xu1354204134.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.101 0.781 3.871