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(85,82,92.4,100.3,105.2,104.5,105.1,105,106.5,106,99.4,107.4,89.6,85.3,96.3,107.7,112.7,110.1,110.4,111.6,113.3,109,106.5,113,95.6,93.8,106.4,116.6,119.1,120.9,117.3,117.6,115.3,112.3,107.7,113.4,94.3,97.8,106.6,113,122.4,114.6,115,118.7,110.4,111.6,105.1,107.5,92.9,91,100.2,112.2,116.5,111.2,113.3,112.2,102.2,105.3,96,101.3,86.2,84.4,93.4,104.8,106.2,101.9,105.5,106.4,103.9,108.6,96.4,102.2,90.3,88.5,100.2,111.6,111.5,112.9,110.7,105.5,110.7,108.9,101.3,109.6,94.4,91.4,105.8,112.9,116.1,113.7,112.9,110.7,114.3,109.7,105.7,114) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 85.0 89.6 95.6 94.3 92.9 86.2 90.3 94.4 NA [2,] 82.0 85.3 93.8 97.8 91.0 84.4 88.5 91.4 NA [3,] 92.4 96.3 106.4 106.6 100.2 93.4 100.2 105.8 NA [4,] 100.3 107.7 116.6 113.0 112.2 104.8 111.6 112.9 NA [5,] 105.2 112.7 119.1 122.4 116.5 106.2 111.5 116.1 NA [6,] 104.5 110.1 120.9 114.6 111.2 101.9 112.9 113.7 NA [7,] 105.1 110.4 117.3 115.0 113.3 105.5 110.7 112.9 NA [8,] 105.0 111.6 117.6 118.7 112.2 106.4 105.5 110.7 NA [9,] 106.5 113.3 115.3 110.4 102.2 103.9 110.7 114.3 NA [10,] 106.0 109.0 112.3 111.6 105.3 108.6 108.9 109.7 NA [11,] 99.4 106.5 107.7 105.1 96.0 96.4 101.3 105.7 NA [12,] 107.4 113.0 113.4 107.5 101.3 102.2 109.6 114.0 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/1ir9i1400154747.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/2n79q1400154747.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/3t7ou1400154747.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/43vw81400154747.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,] 85.00 82.00 92.40 100.30 105.20 101.90 105.10 105.00 102.20 105.30 96.0 [2,] 87.90 84.85 94.85 106.25 108.85 107.30 107.95 105.95 105.20 107.30 97.9 [3,] 91.60 89.75 100.20 111.90 114.40 112.05 111.80 111.15 110.55 108.95 103.2 [4,] 94.35 92.60 106.10 112.95 117.80 114.15 114.15 114.90 113.80 110.65 106.1 [5,] 95.60 97.80 106.60 116.60 122.40 120.90 117.30 118.70 115.30 112.30 107.7 [,12] [1,] 101.30 [2,] 104.80 [3,] 108.55 [4,] 113.20 [5,] 114.00 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 87.99694 85.42074 93.91559 108.1573 109.4004 108.2235 108.3366 106.1504 [2,] 95.20306 94.07926 106.48441 115.6427 119.3996 115.8765 115.2634 116.1496 [,9] [,10] [,11] [,12] [1,] 105.7459 107.0786 98.61936 103.8576 [2,] 115.3541 110.8214 107.78064 113.2424 $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(85, 87.9, 91.6, 94.35, 95.6, 82, 84.85, 89.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5x6jd1400154747.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] [,8] [,9] [1,] 82.00 85.30 93.80 94.30 91.00 84.40 88.50 94.40 NA [2,] 95.90 101.40 107.05 105.85 98.10 94.90 100.75 105.75 NA [3,] 104.75 109.55 114.35 111.00 103.75 103.05 109.25 111.80 NA [4,] 105.60 112.15 117.45 114.80 112.20 105.85 111.10 113.85 NA [5,] 107.40 113.30 120.90 122.40 116.50 108.60 112.90 116.10 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 100.3258 104.6469 109.6065 106.9178 97.3189 98.05563 104.5293 108.1055 [2,] 109.1742 114.4531 119.0935 115.0822 110.1811 108.04437 113.9707 115.4945 [,9] [1,] NA [2,] NA $out [1] 91.4 $group [1] 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(82, 95.9, 104.75, 105.6, 107.4, 85.3, 101.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/65q8f1400154747.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,] 3.940608 7.00 4.5500 [2,] 4.465852 11.95 5.4000 [3,] 5.079526 13.40 6.9500 [4,] 5.521815 16.05 7.3125 [5,] 6.009383 19.00 7.7000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 4.597894 11.52996 6.077696 [2,] 5.561158 15.27004 7.822304 $out [1] 2.418825 10.375000 2.225000 $group [1] 1 3 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.94060818366186, 4.46585179621758, 5.07952584763419, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ir9i1400154747.ps tmp/1ir9i1400154747.png",intern=TRUE)) character(0) > try(system("convert tmp/2n79q1400154747.ps tmp/2n79q1400154747.png",intern=TRUE)) character(0) > try(system("convert tmp/3t7ou1400154747.ps tmp/3t7ou1400154747.png",intern=TRUE)) character(0) > try(system("convert tmp/43vw81400154747.ps tmp/43vw81400154747.png",intern=TRUE)) character(0) > try(system("convert tmp/5x6jd1400154747.ps tmp/5x6jd1400154747.png",intern=TRUE)) character(0) > try(system("convert tmp/65q8f1400154747.ps tmp/65q8f1400154747.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.795 0.565 3.397