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(19.4,19.4,19.4,19.5,19.5,19.5,28.7,28.7,28.7,21.8,21.8,21.8,20,20,20,22.6,22.6,22.6,22.4,22.4,22.4,18.6,18.6,18.6,16.2,16.2,16.2,13.8,13.8,13.8,24.1,24.1,24.1,19.9,19.9,19.9,22.3,22.3,22.3,20.9,20.9,20.9,23.5,23.5,23.5,23.1,23.1,23.1,25.7,25.7,25.7,19.7,19.7,19.7,23.1,23.1,23.1,20.7,20.7,20.7,18,18,18,16.9,16.9,16.9,24.4,24.4,24.4,15.5,15.5,15.5,18.4,18.4,18.4,16.2,16.2,16.2,20.6,20.6,20.6,19.8,19.8,19.8) > 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,] 19.4 20.0 16.2 22.3 25.7 18.0 18.4 NA [2,] 19.4 20.0 16.2 22.3 25.7 18.0 18.4 NA [3,] 19.4 20.0 16.2 22.3 25.7 18.0 18.4 NA [4,] 19.5 22.6 13.8 20.9 19.7 16.9 16.2 NA [5,] 19.5 22.6 13.8 20.9 19.7 16.9 16.2 NA [6,] 19.5 22.6 13.8 20.9 19.7 16.9 16.2 NA [7,] 28.7 22.4 24.1 23.5 23.1 24.4 20.6 NA [8,] 28.7 22.4 24.1 23.5 23.1 24.4 20.6 NA [9,] 28.7 22.4 24.1 23.5 23.1 24.4 20.6 NA [10,] 21.8 18.6 19.9 23.1 20.7 15.5 19.8 NA [11,] 21.8 18.6 19.9 23.1 20.7 15.5 19.8 NA [12,] 21.8 18.6 19.9 23.1 20.7 15.5 19.8 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/1o8591385552027.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/23gli1385552027.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/3c3qv1385552027.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/4xxmm1385552027.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,] 16.20 16.20 16.20 13.80 13.80 13.80 20.60 20.60 20.60 18.60 18.60 18.60 [2,] 18.20 18.20 18.20 16.55 16.55 16.55 22.75 22.75 22.75 19.20 19.20 19.20 [3,] 19.40 19.40 19.40 19.50 19.50 19.50 23.50 23.50 23.50 19.90 19.90 19.90 [4,] 21.15 21.15 21.15 20.30 20.30 20.30 24.25 24.25 24.25 21.25 21.25 21.25 [5,] 22.30 22.30 22.30 22.60 22.60 22.60 24.40 24.40 24.40 23.10 23.10 23.10 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 17.63831 17.63831 17.63831 17.26056 17.26056 17.26056 22.60422 22.60422 [2,] 21.16169 21.16169 21.16169 21.73944 21.73944 21.73944 24.39578 24.39578 [,9] [,10] [,11] [,12] [1,] 22.60422 18.67577 18.67577 18.67577 [2,] 24.39578 21.12423 21.12423 21.12423 $out [1] 25.7 25.7 25.7 28.7 28.7 28.7 15.5 15.5 15.5 $group [1] 1 2 3 7 8 9 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(16.2, 18.2, 19.4, 21.15, 22.3, 16.2, 18.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5rp4l1385552027.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,] 19.40 18.6 13.80 20.9 19.7 15.50 16.2 NA [2,] 19.45 19.3 15.00 21.6 20.2 16.20 17.3 NA [3,] 20.65 21.2 18.05 22.7 21.9 17.45 19.1 NA [4,] 25.25 22.5 22.00 23.3 24.4 21.20 20.2 NA [5,] 28.70 22.6 24.10 23.5 25.7 24.40 20.6 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 18.00458 19.74046 14.85725 21.92462 19.98435 15.16947 17.77729 NA [2,] 23.29542 22.65954 21.24275 23.47538 23.81565 19.73053 20.42271 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(19.4, 19.45, 20.65, 25.25, 28.7, 18.6, 19.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jsgs1385552027.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,] 2.434083 7.60 1.500 [2,] 2.462605 7.85 1.775 [3,] 2.758681 8.45 2.500 [4,] 3.082884 9.15 3.350 [5,] 3.139533 9.50 3.750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.475768 7.857061 1.781632 [2,] 3.041594 9.042939 3.218368 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" > dev.off() null device 1 > > try(system("convert tmp/1o8591385552027.ps tmp/1o8591385552027.png",intern=TRUE)) character(0) > try(system("convert tmp/23gli1385552027.ps tmp/23gli1385552027.png",intern=TRUE)) character(0) > try(system("convert tmp/3c3qv1385552027.ps tmp/3c3qv1385552027.png",intern=TRUE)) character(0) > try(system("convert tmp/4xxmm1385552027.ps tmp/4xxmm1385552027.png",intern=TRUE)) character(0) > try(system("convert tmp/5rp4l1385552027.ps tmp/5rp4l1385552027.png",intern=TRUE)) character(0) > try(system("convert tmp/6jsgs1385552027.ps tmp/6jsgs1385552027.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.091 0.915 4.982