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(65,65.3,62.9,63.5,62.1,59.3,61.6,61.5,60.1,59.5,62.7,65.5,63.8,63.8,62.7,62.3,62.4,64.8,66.4,65.1,67.4,68.8,68.6,71.5,75,84.3,84,79.1,78.8,82.7,85.3,84.5,80.8,70.1,68.2,68.1,72.3,73.1,71.5,74.1,80.3,80.6,81.4,87.4,89.3,93.2,92.8,96.8,100.3,95.6,89,87.4,86.7,92.8,98.6,100.8,105.5,107.8,113.7,120.3,126.5,134.8,134.5,133.1,128.8,127.1,129.1,128.4,126.5,117.1,114.2,109.1) > 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,] 65.0 63.8 75.0 72.3 100.3 126.5 NA [2,] 65.3 63.8 84.3 73.1 95.6 134.8 NA [3,] 62.9 62.7 84.0 71.5 89.0 134.5 NA [4,] 63.5 62.3 79.1 74.1 87.4 133.1 NA [5,] 62.1 62.4 78.8 80.3 86.7 128.8 NA [6,] 59.3 64.8 82.7 80.6 92.8 127.1 NA [7,] 61.6 66.4 85.3 81.4 98.6 129.1 NA [8,] 61.5 65.1 84.5 87.4 100.8 128.4 NA [9,] 60.1 67.4 80.8 89.3 105.5 126.5 NA [10,] 59.5 68.8 70.1 93.2 107.8 117.1 NA [11,] 62.7 68.6 68.2 92.8 113.7 114.2 NA [12,] 65.5 71.5 68.1 96.8 120.3 109.1 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/fisher/rcomp/tmp/11yn81355521421.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/fisher/rcomp/tmp/2nuce1355521422.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/fisher/rcomp/tmp/3ryh11355521422.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/fisher/rcomp/tmp/4qo6k1355521422.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,] 63.80 63.8 62.70 62.3 62.10 59.30 61.60 61.50 60.10 59.50 62.7 [2,] 65.00 65.3 62.90 63.5 62.40 64.80 66.40 65.10 67.40 68.80 68.2 [3,] 73.65 78.7 77.75 76.6 79.55 81.65 83.35 85.95 85.05 81.65 80.7 [4,] 100.30 95.6 89.00 87.4 86.70 92.80 98.60 100.80 105.50 107.80 113.7 [5,] 126.50 134.8 89.00 87.4 86.70 127.10 129.10 128.40 126.50 117.10 114.2 [,12] [1,] 65.50 [2,] 68.10 [3,] 84.15 [4,] 109.10 [5,] 120.30 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 50.88036 59.15552 60.91466 61.18373 63.87572 63.5891 62.57996 62.92235 [2,] 96.41964 98.24448 94.58534 92.01627 95.22428 99.7109 104.12004 108.97765 [,9] [,10] [,11] [,12] [1,] 60.47427 56.49374 51.35103 57.70368 [2,] 109.62573 106.80626 110.04897 110.59632 $out [1] 134.5 133.1 128.8 $group [1] 3 4 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(63.8, 65, 73.65, 100.3, 126.5, 63.8, 65.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5cc9n1355521422.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,] 59.30 62.30 68.10 71.50 86.70 109.10 NA [2,] 60.80 63.25 72.55 73.60 90.90 121.80 NA [3,] 62.40 64.95 79.95 81.00 99.45 127.75 NA [4,] 64.25 68.00 84.15 91.05 106.65 131.10 NA [5,] 65.50 71.50 85.30 96.80 120.30 134.80 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 60.82643 62.78349 74.65916 73.04094 92.26632 123.5082 NA [2,] 63.97357 67.11651 85.24084 88.95906 106.63368 131.9918 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(59.3, 60.8, 62.4, 64.25, 65.5, 62.3, 63.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6jaj61355521422.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,] 23.40357 51.50 18.6000 [2,] 23.85886 60.15 22.1125 [3,] 24.58850 66.80 26.3375 [4,] 25.46654 69.30 32.8625 [5,] 26.94565 71.80 40.1750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 23.85523 62.62662 21.43435 [2,] 25.32177 70.97338 31.24065 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(23.4035681040306, 23.8588640087102, 24.5885002155018, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/11yn81355521421.ps tmp/11yn81355521421.png",intern=TRUE)) character(0) > try(system("convert tmp/2nuce1355521422.ps tmp/2nuce1355521422.png",intern=TRUE)) character(0) > try(system("convert tmp/3ryh11355521422.ps tmp/3ryh11355521422.png",intern=TRUE)) character(0) > try(system("convert tmp/4qo6k1355521422.ps tmp/4qo6k1355521422.png",intern=TRUE)) character(0) > try(system("convert tmp/5cc9n1355521422.ps tmp/5cc9n1355521422.png",intern=TRUE)) character(0) > try(system("convert tmp/6jaj61355521422.ps tmp/6jaj61355521422.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.089 0.886 3.970