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(-23.5,5.9,8.4,7.8,4.8,3.5,8.7,6.8,6,3.6,8.7,8.9,8.1,7,7.9,8,7.5,6.3,7.6,8.4,6.8,8.8,8.7,8.7,7.4,2.8,4.8,-21.1,8.5,9.4,1.8,4.8,5.8,3.3,-9,-6,-0.9,-17.3,-9.2,-8.1,-20.9,-14.6,-13.9,-20.8,-16.1,-5,-7.2,-9.7,-1.4,0.2,2.6,-4.8,-6.2,-2,-0.8,-3.1,0.6,0.2,0.3,-0.1,4.3,-3.2,-1.3,1.5,2.5,-2.2,1.7,5.7,2.7,-4.8,-3.1,-0.5,-3.4,-4.7,-5.6,-1.7,-1.8,-5.4,-4.8,-2.8,-4.9,-6.8,-7.6,-6.6,-5.6,-1.4,0.1,-3.7,-5.6,-3.1,-3.8,-5.1,-4.1,-0.3,-0.3,-2.4) > 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,] -23.5 8.1 7.4 -0.9 -1.4 4.3 -3.4 -5.6 NA [2,] 5.9 7.0 2.8 -17.3 0.2 -3.2 -4.7 -1.4 NA [3,] 8.4 7.9 4.8 -9.2 2.6 -1.3 -5.6 0.1 NA [4,] 7.8 8.0 -21.1 -8.1 -4.8 1.5 -1.7 -3.7 NA [5,] 4.8 7.5 8.5 -20.9 -6.2 2.5 -1.8 -5.6 NA [6,] 3.5 6.3 9.4 -14.6 -2.0 -2.2 -5.4 -3.1 NA [7,] 8.7 7.6 1.8 -13.9 -0.8 1.7 -4.8 -3.8 NA [8,] 6.8 8.4 4.8 -20.8 -3.1 5.7 -2.8 -5.1 NA [9,] 6.0 6.8 5.8 -16.1 0.6 2.7 -4.9 -4.1 NA [10,] 3.6 8.8 3.3 -5.0 0.2 -4.8 -6.8 -0.3 NA [11,] 8.7 8.7 -9.0 -7.2 0.3 -3.1 -7.6 -0.3 NA [12,] 8.9 8.7 -6.0 -9.7 -0.1 -0.5 -6.6 -2.4 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/1un9g1426196390.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/2bkbv1426196390.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/3yqji1426196390.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/4dio11426196390.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,] -5.60 -4.70 -9.20 -21.10 -20.90 -14.60 -13.90 -5.10 -16.10 -6.80 -9.0 [2,] -4.50 -3.95 -3.45 -6.45 -5.90 -4.25 -4.30 -4.10 -4.50 -4.90 -7.4 [3,] -1.15 -0.60 1.35 -2.70 0.35 -2.10 0.45 1.00 1.65 -0.05 -1.7 [4,] 5.85 4.35 6.35 4.65 6.15 4.90 4.70 6.25 5.90 3.45 4.5 [5,] 8.10 7.00 8.40 8.00 8.50 9.40 8.70 8.40 6.80 8.80 8.7 [,12] [1,] -9.70 [2,] -6.30 [3,] -1.45 [4,] 4.30 [5,] 8.90 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -6.931659 -5.236499 -4.124421 -8.900619 -6.381303 -7.211321 -4.577529 [2,] 4.631659 4.036499 6.824421 3.500619 7.081303 3.011321 5.477529 [,8] [,9] [,10] [,11] [,12] [1,] -4.781659 -4.159589 -4.71443 -8.347511 -7.371312 [2,] 6.781659 7.459589 4.61443 4.947511 4.471312 $out [1] -23.5 -17.3 -20.8 $group [1] 1 2 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-5.6, -4.5, -1.15, 5.85, 8.1, -4.7, -3.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ufu81426196390.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,] 3.50 6.30 -9.00 -20.90 -6.20 -4.80 -7.60 -5.60 NA [2,] 4.20 7.25 -2.10 -16.70 -2.55 -2.65 -6.10 -4.60 NA [3,] 6.40 7.95 4.05 -11.80 -0.45 0.50 -4.85 -3.40 NA [4,] 8.55 8.55 6.60 -7.65 0.25 2.60 -3.10 -0.85 NA [5,] 8.90 8.80 9.40 -0.90 2.60 5.70 -1.70 0.10 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 4.415936 7.357061 0.0818716 -15.927766 -1.7270988 -1.89456 -6.21832 [2,] 8.384064 8.542939 8.0181284 -7.672234 0.8270988 2.89456 -3.48168 [,8] [,9] [1,] -5.1104 NA [2,] -1.6896 NA $out [1] -23.5 -21.1 $group [1] 1 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(3.5, 4.2, 6.4, 8.55, 8.9, 6.3, 7.25, 7.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6an581426196390.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,] 5.285763 15.60 7.1500 [2,] 6.905386 18.15 7.9125 [3,] 7.576871 23.45 8.4750 [4,] 9.487246 29.15 9.6375 [5,] 10.061773 31.60 11.2250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 6.399268 18.43283 7.688216 [2,] 8.754475 28.46717 9.261784 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(5.28576254804221, 6.90538587894965, 7.57687133426079, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1un9g1426196390.ps tmp/1un9g1426196390.png",intern=TRUE)) character(0) > try(system("convert tmp/2bkbv1426196390.ps tmp/2bkbv1426196390.png",intern=TRUE)) character(0) > try(system("convert tmp/3yqji1426196390.ps tmp/3yqji1426196390.png",intern=TRUE)) character(0) > try(system("convert tmp/4dio11426196390.ps tmp/4dio11426196390.png",intern=TRUE)) character(0) > try(system("convert tmp/5ufu81426196390.ps tmp/5ufu81426196390.png",intern=TRUE)) character(0) > try(system("convert tmp/6an581426196390.ps tmp/6an581426196390.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.095 0.335 2.465