R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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,2.2,1.9,2.3,2.2,2.3,2.1,2.4,2.3,1.9,1.6,1.8,1.8,2,2.3,2.2,2.2,2,2,1.9,1.5,1.6,1.5,2,1.5,1.5,1.9,1.1,1.5,2.1,2.3,2.6,2.9,3.2,3.2,3.1,3,3.3,2.7,3.6,3.1,2.7,2.6,2.2,2.7,2.1,1.8,1.7,1.7,1.2,1.2,1.2,1.5,1.3,1.1,1.2,1.3,1.6,1.9,1.6,2.1,2.2,2.3,2.1,1.7,1.7,2.2,2,1.5,1.5,1.7,2.2,2.6,2.6,2.3,2.3,2.7,2.7,2.5,2.5,2.7,2.6,2.6,2.4,1.4,1.8,2.1,1.7,1.6,1.7,1.8,2,1.9,2,2.1,2.3) > 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,] 2.0 1.8 1.5 3.0 1.7 2.1 2.6 1.4 NA [2,] 2.2 2.0 1.5 3.3 1.2 2.2 2.6 1.8 NA [3,] 1.9 2.3 1.9 2.7 1.2 2.3 2.3 2.1 NA [4,] 2.3 2.2 1.1 3.6 1.2 2.1 2.3 1.7 NA [5,] 2.2 2.2 1.5 3.1 1.5 1.7 2.7 1.6 NA [6,] 2.3 2.0 2.1 2.7 1.3 1.7 2.7 1.7 NA [7,] 2.1 2.0 2.3 2.6 1.1 2.2 2.5 1.8 NA [8,] 2.4 1.9 2.6 2.2 1.2 2.0 2.5 2.0 NA [9,] 2.3 1.5 2.9 2.7 1.3 1.5 2.7 1.9 NA [10,] 1.9 1.6 3.2 2.1 1.6 1.5 2.6 2.0 NA [11,] 1.6 1.5 3.2 1.8 1.9 1.7 2.6 2.1 NA [12,] 1.8 2.0 3.1 1.7 1.6 2.2 2.4 2.3 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/1jgdv1426159801.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/27i781426159801.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/3oeg71426159801.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/4obmf1426159801.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,] 1.40 1.20 1.9 1.10 1.50 1.30 1.80 1.20 1.3 1.50 1.50 1.60 [2,] 1.60 1.65 1.9 1.45 1.55 1.70 1.90 1.95 1.5 1.60 1.65 1.75 [3,] 1.90 2.10 2.2 2.15 1.95 2.05 2.15 2.10 2.1 1.95 1.85 2.10 [4,] 2.35 2.40 2.3 2.30 2.45 2.50 2.40 2.45 2.7 2.35 2.35 2.35 [5,] 3.00 3.30 2.7 2.30 3.10 2.70 2.60 2.60 2.9 3.20 3.20 3.10 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.481039 1.681039 1.976554 1.675178 1.447247 1.603109 1.870693 1.820693 [2,] 2.318961 2.518961 2.423446 2.624822 2.452753 2.496891 2.429307 2.379307 [,9] [,10] [,11] [,12] [1,] 1.429663 1.531039 1.45897 1.764831 [2,] 2.770337 2.368961 2.24103 2.435169 $out [1] 1.2 3.6 1.1 $group [1] 3 4 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1.4, 1.6, 1.9, 2.35, 3, 1.2, 1.65, 2.1, 2.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5d5ut1426159801.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,] 1.60 1.5 1.1 1.70 1.1 1.50 2.30 1.40 NA [2,] 1.90 1.7 1.5 2.15 1.2 1.70 2.45 1.70 NA [3,] 2.15 2.0 2.2 2.70 1.3 2.05 2.60 1.85 NA [4,] 2.30 2.1 3.0 3.05 1.6 2.20 2.65 2.05 NA [5,] 2.40 2.3 3.2 3.60 1.9 2.30 2.70 2.30 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.967557 1.817557 1.51584 2.289504 1.117557 1.821947 2.508779 1.690363 [2,] 2.332443 2.182443 2.88416 3.110496 1.482443 2.278053 2.691221 2.009637 [,9] [1,] NA [2,] NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(1.6, 1.9, 2.15, 2.3, 2.4, 1.5, 1.7, 2, 2.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6xwsr1426159801.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.4421942 1.4 0.4000 [2,] 0.4775833 1.5 0.5000 [3,] 0.5635185 1.6 0.5750 [4,] 0.6149602 1.7 0.7125 [5,] 0.7836499 1.7 0.7500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.5008599 1.508779 0.4780773 [2,] 0.6261770 1.691221 0.6719227 $out [1] 2.1 2.5 1.2 $group [1] 2 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.442194204265178, 0.477583265708813, 0.563518463499081, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1jgdv1426159801.ps tmp/1jgdv1426159801.png",intern=TRUE)) character(0) > try(system("convert tmp/27i781426159801.ps tmp/27i781426159801.png",intern=TRUE)) character(0) > try(system("convert tmp/3oeg71426159801.ps tmp/3oeg71426159801.png",intern=TRUE)) character(0) > try(system("convert tmp/4obmf1426159801.ps tmp/4obmf1426159801.png",intern=TRUE)) character(0) > try(system("convert tmp/5d5ut1426159801.ps tmp/5d5ut1426159801.png",intern=TRUE)) character(0) > try(system("convert tmp/6xwsr1426159801.ps tmp/6xwsr1426159801.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.306 0.389 2.713