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(2.79,3.08,3.89,3.7,4.61,5.07,5.22,4.93,5.15,4.8,3.89,3.54,3.34,2.8,1.6,1.53,0.69,-0.11,-0.67,-0.2,-0.62,-0.58,-0.31,-0.25,-0.08,0.13,0.94,1.05,1.59,2.03,2.15,2.06,2.56,2.55,2.53,2.6,2.71,2.82,2.93,2.88,2.89,3.27,3.32,3.14,3.04,3.08,3.39,3.23,3.38,3.41,3.14,2.96,2.73,2.21,2.23,2.56,2.39,2.49,2.17,2.16,1.48,1.09,1.25,1.26,1.39,1.69,1.55,1.19,1.08,0.93,0.98,1.01) > 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.79 3.34 -0.08 2.71 3.38 1.48 NA [2,] 3.08 2.80 0.13 2.82 3.41 1.09 NA [3,] 3.89 1.60 0.94 2.93 3.14 1.25 NA [4,] 3.70 1.53 1.05 2.88 2.96 1.26 NA [5,] 4.61 0.69 1.59 2.89 2.73 1.39 NA [6,] 5.07 -0.11 2.03 3.27 2.21 1.69 NA [7,] 5.22 -0.67 2.15 3.32 2.23 1.55 NA [8,] 4.93 -0.20 2.06 3.14 2.56 1.19 NA [9,] 5.15 -0.62 2.56 3.04 2.39 1.08 NA [10,] 4.80 -0.58 2.55 3.08 2.49 0.93 NA [11,] 3.89 -0.31 2.53 3.39 2.17 0.98 NA [12,] 3.54 -0.25 2.60 3.23 2.16 1.01 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/12erf1398700996.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/27n0m1398700996.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/3i9ff1398700996.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/40u4u1398700996.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,] -0.08 0.13 0.940 1.050 0.69 -0.11 -0.67 -0.20 -0.620 -0.58 -0.31 -0.25 [2,] 1.48 1.09 1.250 1.260 1.39 1.69 1.55 1.19 1.080 0.93 0.98 1.01 [3,] 2.75 2.81 2.265 2.205 2.16 2.12 2.19 2.31 2.475 2.52 2.35 2.38 [4,] 3.34 3.08 3.140 2.960 2.89 3.27 3.32 3.14 3.040 3.08 3.39 3.23 [5,] 3.38 3.41 3.890 3.700 4.61 5.07 5.22 4.93 5.150 4.80 3.89 3.54 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.55024 1.526386 1.045889 1.108445 1.192452 1.100849 1.048293 1.052187 [2,] 3.94976 4.093614 3.484111 3.301555 3.127548 3.139151 3.331707 3.567813 [,9] [,10] [,11] [,12] [1,] 1.210737 1.133181 0.7954722 0.9480283 [2,] 3.739263 3.906819 3.9045278 3.8119717 $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(-0.08, 1.48, 2.75, 3.34, 3.38, 0.13, 1.09, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/57dwm1398700996.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.79 -0.670 -0.080 2.710 2.160 0.930 NA [2,] 3.62 -0.445 0.995 2.885 2.220 1.045 NA [3,] 4.25 -0.155 2.045 3.060 2.525 1.220 NA [4,] 5.00 1.565 2.540 3.250 3.050 1.435 NA [5,] 5.22 3.340 2.600 3.390 3.410 1.690 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 3.620573 -1.0717745 1.340315 2.893521 2.146431 1.042118 NA [2,] 4.879427 0.7617745 2.749685 3.226479 2.903569 1.397882 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(2.79, 3.62, 4.25, 5, 5.22, -0.67, -0.445, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6og861398700996.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.089917 2.65 1.23000 [2,] 1.322166 3.37 1.41250 [3,] 1.496052 4.06 1.55000 [4,] 1.796727 5.28 1.68875 [5,] 1.948209 5.89 1.89750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.279602 3.188836 1.424001 [2,] 1.712502 4.931164 1.675999 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.08991742806508, 1.32216649511278, 1.49605182945812, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/12erf1398700996.ps tmp/12erf1398700996.png",intern=TRUE)) character(0) > try(system("convert tmp/27n0m1398700996.ps tmp/27n0m1398700996.png",intern=TRUE)) character(0) > try(system("convert tmp/3i9ff1398700996.ps tmp/3i9ff1398700996.png",intern=TRUE)) character(0) > try(system("convert tmp/40u4u1398700996.ps tmp/40u4u1398700996.png",intern=TRUE)) character(0) > try(system("convert tmp/57dwm1398700996.ps tmp/57dwm1398700996.png",intern=TRUE)) character(0) > try(system("convert tmp/6og861398700996.ps tmp/6og861398700996.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.152 0.779 4.959