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(2.25,2.25,2.45,2.5,2.5,2.64,2.75,2.93,3,3.17,3.25,3.39,3.5,3.5,3.65,3.75,3.75,3.9,4,4,4,4,4,4,4,4,4,4,4,4,4.18,4.25,4.25,3.97,3.42,2.75,2.31,2,1.66,1.31,1.09,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.14,1.25,1.25,1.4,1.5,1.5,1.5,1.32,1.11) > 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,] 2.25 3.50 4.00 2.31 1 1.00 NA [2,] 2.25 3.50 4.00 2.00 1 1.00 NA [3,] 2.45 3.65 4.00 1.66 1 1.00 NA [4,] 2.50 3.75 4.00 1.31 1 1.14 NA [5,] 2.50 3.75 4.00 1.09 1 1.25 NA [6,] 2.64 3.90 4.00 1.00 1 1.25 NA [7,] 2.75 4.00 4.18 1.00 1 1.40 NA [8,] 2.93 4.00 4.25 1.00 1 1.50 NA [9,] 3.00 4.00 4.25 1.00 1 1.50 NA [10,] 3.17 4.00 3.97 1.00 1 1.50 NA [11,] 3.25 4.00 3.42 1.00 1 1.32 NA [12,] 3.39 4.00 2.75 1.00 1 1.11 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/17ko11355064556.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/27jsj1355064556.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/3id421355064556.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/4j8ir1355064556.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,] 1.00 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.00 1.000 1.000 1.00 [2,] 1.00 1.000 1.000 1.140 1.090 1.000 1.000 1.000 1.00 1.000 1.000 1.00 [3,] 2.28 2.125 2.055 1.905 1.875 1.945 2.075 2.215 2.25 2.335 2.285 1.93 [4,] 3.50 3.500 3.650 3.750 3.750 3.900 4.000 4.000 4.00 3.970 3.420 3.39 [5,] 4.00 4.000 4.000 4.000 4.000 4.000 4.180 4.250 4.25 4.000 4.000 4.00 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.6674193 0.5124193 0.3456644 0.2214657 0.1592141 0.07440633 0.1399031 [2,] 3.8925807 3.7375807 3.7643356 3.5885343 3.5907859 3.81559367 4.0100969 [,8] [,9] [,10] [,11] [,12] [1,] 0.2799031 0.3149031 0.4192541 0.7240218 0.3883728 [2,] 4.1500969 4.1850969 4.2507459 3.8459782 3.4716272 $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(1, 1, 2.28, 3.5, 4, 1, 1, 2.125, 3.5, 4, 1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/58bql1355064556.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,] 2.250 3.50 3.970 1.000 1 1.000 NA [2,] 2.475 3.70 3.985 1.000 1 1.055 NA [3,] 2.695 3.95 4.000 1.000 1 1.250 NA [4,] 3.085 4.00 4.090 1.485 1 1.450 NA [5,] 3.390 4.00 4.180 2.000 1 1.500 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2.416775 3.813168 3.952109 0.7787882 1 1.069838 NA [2,] 2.973225 4.086832 4.047891 1.2212118 1 1.430162 NA $out [1] 4.25 4.25 3.42 2.75 2.31 $group [1] 3 3 3 3 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(2.25, 2.475, 2.695, 3.085, 3.39, 3.5, 3.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6xj4g1355064556.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.241075 3.00 1.89000 [2,] 1.324652 3.00 2.19375 [3,] 1.366122 3.00 2.30250 [4,] 1.452793 3.09 2.59750 [5,] 1.486747 3.18 2.64500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.307676 2.95895 2.118347 [2,] 1.424568 3.04105 2.486653 $out [1] 3.25 3.25 $group [1] 2 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.24107480301014, 1.32465191552556, 1.36612227216567, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17ko11355064556.ps tmp/17ko11355064556.png",intern=TRUE)) character(0) > try(system("convert tmp/27jsj1355064556.ps tmp/27jsj1355064556.png",intern=TRUE)) character(0) > try(system("convert tmp/3id421355064556.ps tmp/3id421355064556.png",intern=TRUE)) character(0) > try(system("convert tmp/4j8ir1355064556.ps tmp/4j8ir1355064556.png",intern=TRUE)) character(0) > try(system("convert tmp/58bql1355064556.ps tmp/58bql1355064556.png",intern=TRUE)) character(0) > try(system("convert tmp/6xj4g1355064556.ps tmp/6xj4g1355064556.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.192 0.918 5.250