R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(20.1,20.1,20.1,20.3,20.7,20.6,20.3,19.9,19.7,19.4,19.1,18.8,18.9,18.7,18.8,19.5,19.3,19.1,19.1,19,18.8,19.2,18.9,18.7,18.5,18.4,18.3,18.3,18.3,18.5,19.2,19.4,19.1,19.5,18.8,19.3,20.4,20.9,21.1,20.6,20.4,20.8,21.1,21.6,22,22.2,22.4,22.8,22.7,22.8,22.9,22.9,22.6,21.9,20.8,20.3,20.4,21.2,21.4,20.9,20,19.5,19.2,19.3,19.4,19.5,20,20.1,19.5,18.6,18.4,18.4,19.3,19.8,19.8,19.8,20.1,20.3,19.7,20.2,20.6,21,21.4,21.9) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 20.1 18.9 18.5 20.4 22.7 20.0 19.3 NA [2,] 20.1 18.7 18.4 20.9 22.8 19.5 19.8 NA [3,] 20.1 18.8 18.3 21.1 22.9 19.2 19.8 NA [4,] 20.3 19.5 18.3 20.6 22.9 19.3 19.8 NA [5,] 20.7 19.3 18.3 20.4 22.6 19.4 20.1 NA [6,] 20.6 19.1 18.5 20.8 21.9 19.5 20.3 NA [7,] 20.3 19.1 19.2 21.1 20.8 20.0 19.7 NA [8,] 19.9 19.0 19.4 21.6 20.3 20.1 20.2 NA [9,] 19.7 18.8 19.1 22.0 20.4 19.5 20.6 NA [10,] 19.4 19.2 19.5 22.2 21.2 18.6 21.0 NA [11,] 19.1 18.9 18.8 22.4 21.4 18.4 21.4 NA [12,] 18.8 18.7 19.3 22.8 20.9 18.4 21.9 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/1axsn1386239591.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/2qt8u1386239591.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/3ae3v1386239591.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/4lrb91386239591.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,] 18.50 18.4 18.3 18.30 18.30 18.5 19.10 19.00 18.8 18.6 18.40 18.40 [2,] 19.10 19.1 19.0 19.40 19.35 19.3 19.45 19.65 19.3 19.3 18.85 18.75 [3,] 20.00 19.8 19.8 19.80 20.10 20.3 20.00 20.10 19.7 19.5 19.10 19.30 [4,] 20.25 20.5 20.6 20.45 20.55 20.7 20.55 20.25 20.5 21.1 21.40 21.40 [5,] 20.40 20.9 22.9 20.60 20.70 21.9 21.10 20.30 22.0 22.2 22.40 22.80 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 19.31324 18.96394 18.84451 19.17296 19.38338 19.46394 19.3431 19.74169 [2,] 20.68676 20.63606 20.75549 20.42704 20.81662 21.13606 20.6569 20.45831 [,9] [,10] [,11] [,12] [1,] 18.98338 18.42507 17.57718 17.71746 [2,] 20.41662 20.57493 20.62282 20.88254 $out [1] 22.7 22.8 22.9 22.6 21.6 $group [1] 1 2 4 5 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(18.5, 19.1, 20, 20.25, 20.4, 18.4, 19.1, 19.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/52prn1386239591.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] [1,] 18.80 18.70 18.30 20.4 20.30 18.40 19.30 NA [2,] 19.55 18.80 18.35 20.7 20.85 18.90 19.80 NA [3,] 20.10 18.95 18.65 21.1 21.65 19.45 20.15 NA [4,] 20.30 19.15 19.25 22.1 22.75 19.75 20.80 NA [5,] 20.70 19.50 19.50 22.8 22.90 20.10 21.90 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 19.75792 18.79036 18.2395 20.46145 20.7834 19.06231 19.69389 NA [2,] 20.44208 19.10964 19.0605 21.73855 22.5166 19.83769 20.60611 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(18.8, 19.55, 20.1, 20.3, 20.7, 18.7, 18.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6u2d41386239591.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,] 0.7609518 2.0 0.600 [2,] 1.1194150 3.3 1.125 [3,] 1.3685715 4.1 1.300 [4,] 1.5223318 4.4 1.700 [5,] 1.7487410 4.6 2.550 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.184798 3.598283 1.037739 [2,] 1.552345 4.601717 1.562261 $out [1] 2.65 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.760951784969074, 1.11941497418885, 1.36857154949307, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1axsn1386239591.ps tmp/1axsn1386239591.png",intern=TRUE)) character(0) > try(system("convert tmp/2qt8u1386239591.ps tmp/2qt8u1386239591.png",intern=TRUE)) character(0) > try(system("convert tmp/3ae3v1386239591.ps tmp/3ae3v1386239591.png",intern=TRUE)) character(0) > try(system("convert tmp/4lrb91386239591.ps tmp/4lrb91386239591.png",intern=TRUE)) character(0) > try(system("convert tmp/52prn1386239591.ps tmp/52prn1386239591.png",intern=TRUE)) character(0) > try(system("convert tmp/6u2d41386239591.ps tmp/6u2d41386239591.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.395 0.900 5.340