R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing 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(0,-2,-4,-6,-2,1,7,2,2,13,7,-1,1,0,0,5,3,6,7,-6,-8,-5,-14,-13,-15,-14,-10,-14,-18,-22,-24,-17,-16,-17,-22,-25,-18,-23,-20,-9,-4,0,3,14,13,12,16,7,2,1,7,10,3,2,12,14,11,13,17,14,7,16,5,5,15,9,4,-9,-14,-4,-19,-10,-22) > 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] 73 > (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] 7 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0 1 -15 -18 2 7 -22 [2,] -2 0 -14 -23 1 16 NA [3,] -4 0 -10 -20 7 5 NA [4,] -6 5 -14 -9 10 5 NA [5,] -2 3 -18 -4 3 15 NA [6,] 1 6 -22 0 2 9 NA [7,] 7 7 -24 3 12 4 NA [8,] 2 -6 -17 14 14 -9 NA [9,] 2 -8 -16 13 11 -14 NA [10,] 13 -5 -17 12 13 -4 NA [11,] 7 -14 -22 16 17 -19 NA [12,] -1 -13 -25 7 14 -10 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/1ayqc1400685739.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/2t41e1400685739.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/3jqtr1400685739.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/4y4mz1400685739.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,] -22.0 -23 -20 -14.0 -4.0 0.0 3.0 -17 -16 -17 -22.0 -25.0 [2,] -16.5 -14 -10 -9.0 -4.0 0.0 3.0 -9 -14 -5 -19.0 -13.0 [3,] 0.0 -1 -2 -0.5 0.5 1.5 5.5 -2 -3 4 -3.5 -5.5 [4,] 1.5 1 5 5.0 3.0 6.0 7.0 14 11 13 16.0 7.0 [5,] 7.0 16 7 10.0 3.0 9.0 12.0 14 13 13 17.0 14.0 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -10.74931 -10.675484 -11.675484 -9.530452 -4.015226 -2.370194 2.919871 [2,] 10.74931 8.675484 7.675484 8.530452 5.015226 5.370194 8.080129 [,8] [,9] [,10] [,11] [,12] [1,] -16.83574 -19.12581 -7.610581 -26.07613 -18.400646 [2,] 12.83574 13.12581 15.610581 19.07613 7.400646 $out [1] -18 15 -22 -24 $group [1] 5 5 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-22, -16.5, 0, 1.5, 7, -23, -14, -1, 1, 16, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/50x9j1400685739.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,] -6.0 -14 -25.0 -23.0 1.0 -19.0 -22 [2,] -2.0 -7 -22.0 -13.5 2.5 -9.5 -22 [3,] 0.5 0 -17.0 1.5 10.5 4.5 -22 [4,] 4.5 4 -14.5 12.5 13.5 8.0 -22 [5,] 13.0 7 -10.0 16.0 17.0 16.0 -22 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.464694 -5.017174 -20.4208 -10.35877 5.482826 -3.481867 -22 [2,] 3.464694 5.017174 -13.5792 13.35877 15.517174 12.481867 -22 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(-6, -2, 0.5, 4.5, 13, -14, -7, 0, 4, 7, -25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/64zcb1400685739.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,] 9.481561 24.0 3.750 [2,] 10.903057 29.0 9.125 [3,] 12.545913 31.0 15.250 [4,] 13.168159 37.5 18.625 [5,] 14.207979 39.0 31.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 11.51278 27.12309 10.91699 [2,] 13.57904 34.87691 19.58301 $out [1] 17.87456 $group [1] 1 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(9.48156105290685, 10.9030566881289, 12.5459131380531, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ayqc1400685739.ps tmp/1ayqc1400685739.png",intern=TRUE)) character(0) > try(system("convert tmp/2t41e1400685739.ps tmp/2t41e1400685739.png",intern=TRUE)) character(0) > try(system("convert tmp/3jqtr1400685739.ps tmp/3jqtr1400685739.png",intern=TRUE)) character(0) > try(system("convert tmp/4y4mz1400685739.ps tmp/4y4mz1400685739.png",intern=TRUE)) character(0) > try(system("convert tmp/50x9j1400685739.ps tmp/50x9j1400685739.png",intern=TRUE)) character(0) > try(system("convert tmp/64zcb1400685739.ps tmp/64zcb1400685739.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.855 0.392 3.291