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(3.65,3.66,3.69,3.7,3.7,3.71,3.71,3.71,3.72,3.72,3.73,3.74,3.78,3.78,3.79,3.79,3.8,3.81,3.83,3.84,3.88,3.91,3.96,3.96,3.97,3.98,3.99,3.99,4,4,4.02,4.02,4.02,4.03,4.03,4.03,4.04,4.04,4.05,4.05,4.05,4.05,4.06,4.06,4.06,4.06,4.07,4.07,4.08,4.08,4.08,4.09,4.09,4.09,4.09,4.1,4.1,4.11,4.11,4.12,4.12,4.12,4.12,4.12,4.15,4.15,4.15,4.15,4.16,4.16,4.16,4.2) > 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,] 3.65 3.78 3.97 4.04 4.08 4.12 NA [2,] 3.66 3.78 3.98 4.04 4.08 4.12 NA [3,] 3.69 3.79 3.99 4.05 4.08 4.12 NA [4,] 3.70 3.79 3.99 4.05 4.09 4.12 NA [5,] 3.70 3.80 4.00 4.05 4.09 4.15 NA [6,] 3.71 3.81 4.00 4.05 4.09 4.15 NA [7,] 3.71 3.83 4.02 4.06 4.09 4.15 NA [8,] 3.71 3.84 4.02 4.06 4.10 4.15 NA [9,] 3.72 3.88 4.02 4.06 4.10 4.16 NA [10,] 3.72 3.91 4.03 4.06 4.11 4.16 NA [11,] 3.73 3.96 4.03 4.07 4.11 4.16 NA [12,] 3.74 3.96 4.03 4.07 4.12 4.20 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/1j6061354981319.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/2o5iq1354981319.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/30kvg1354981319.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/47ud01354981319.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] [,12] [1,] 3.650 3.66 3.69 3.70 3.700 3.710 3.71 3.71 3.72 3.720 3.96 3.74 [2,] 3.780 3.78 3.79 3.79 3.800 3.810 3.83 3.84 3.88 3.910 3.96 3.96 [3,] 4.005 4.01 4.02 4.02 4.025 4.025 4.04 4.04 4.04 4.045 4.05 4.05 [4,] 4.080 4.08 4.08 4.09 4.090 4.090 4.09 4.10 4.10 4.110 4.11 4.12 [5,] 4.120 4.12 4.12 4.12 4.150 4.150 4.15 4.15 4.16 4.160 4.16 4.20 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.81149 3.81649 3.832941 3.82649 3.837941 3.844391 3.872292 3.872292 [2,] 4.19851 4.20351 4.207059 4.21351 4.212059 4.205609 4.207708 4.207708 [,9] [,10] [,11] [,12] [1,] 3.898093 3.915994 3.953245 3.946795 [2,] 4.181907 4.174006 4.146755 4.153205 $out [1] 3.73 $group [1] 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3.65, 3.78, 4.005, 4.08, 4.12, 3.66, 3.78, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/54auw1354981319.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,] 3.660 3.780 3.970 4.040 4.080 4.12 NA [2,] 3.695 3.790 3.990 4.050 4.085 4.12 NA [3,] 3.710 3.820 4.010 4.055 4.090 4.15 NA [4,] 3.720 3.895 4.025 4.060 4.105 4.16 NA [5,] 3.740 3.960 4.030 4.070 4.120 4.20 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 3.698597 3.772109 3.994036 4.050439 4.080878 4.131756 NA [2,] 3.721403 3.867891 4.025964 4.059561 4.099122 4.168244 NA $out [1] 3.65 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(3.66, 3.695, 3.71, 3.72, 3.74, 3.78, 3.79, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6qbp61354981319.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.1532319 0.420 0.12250 [2,] 0.1613921 0.435 0.16625 [3,] 0.1707657 0.440 0.21375 [4,] 0.1750032 0.455 0.23625 [5,] 0.1857956 0.470 0.24250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.1645576 0.4308779 0.1818225 [2,] 0.1769738 0.4491221 0.2456775 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.153231850475024, 0.161392072395019, 0.170765689150696, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1j6061354981319.ps tmp/1j6061354981319.png",intern=TRUE)) character(0) > try(system("convert tmp/2o5iq1354981319.ps tmp/2o5iq1354981319.png",intern=TRUE)) character(0) > try(system("convert tmp/30kvg1354981319.ps tmp/30kvg1354981319.png",intern=TRUE)) character(0) > try(system("convert tmp/47ud01354981319.ps tmp/47ud01354981319.png",intern=TRUE)) character(0) > try(system("convert tmp/54auw1354981319.ps tmp/54auw1354981319.png",intern=TRUE)) character(0) > try(system("convert tmp/6qbp61354981319.ps tmp/6qbp61354981319.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.248 0.562 3.786