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(123.2,136.9,146.8,149.6,146.5,157,147.9,133.6,128.7,100.8,91.8,89.3,96.7,91.6,93.3,93.3,101,100.4,86.9,83.9,80.3,87.7,92.7,95.5,92,87.4,86.8,83.7,85,81.7,90.9,101.5,113.8,120.1,122.1,132.5,140,149.4,144.3,154.4,151.4,145.5,136.8,146.6,145.1,133.6,131.4,127.5,130.1,131.1,132.3,128.6,125.1,128.7,156.1,163.2,159.8,157.4,156.2,152.5,149.4,145.9,144.8,135.9,137.6,136,117.7,111.5,107.8,107.3,102.6,101) > 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,] 123.2 96.7 92.0 140.0 130.1 149.4 NA [2,] 136.9 91.6 87.4 149.4 131.1 145.9 NA [3,] 146.8 93.3 86.8 144.3 132.3 144.8 NA [4,] 149.6 93.3 83.7 154.4 128.6 135.9 NA [5,] 146.5 101.0 85.0 151.4 125.1 137.6 NA [6,] 157.0 100.4 81.7 145.5 128.7 136.0 NA [7,] 147.9 86.9 90.9 136.8 156.1 117.7 NA [8,] 133.6 83.9 101.5 146.6 163.2 111.5 NA [9,] 128.7 80.3 113.8 145.1 159.8 107.8 NA [10,] 100.8 87.7 120.1 133.6 157.4 107.3 NA [11,] 91.8 92.7 122.1 131.4 156.2 102.6 NA [12,] 89.3 95.5 132.5 127.5 152.5 101.0 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/11xpl1426192944.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/254t31426192944.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/3kqv41426192944.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/4ib4m1426192944.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,] 92.00 87.4 86.8 83.70 85.00 81.70 86.90 83.90 80.30 87.7 91.80 [2,] 96.70 91.6 93.3 93.30 101.00 100.40 90.90 101.50 107.80 100.8 92.70 [3,] 126.65 134.0 138.3 132.25 131.35 132.35 127.25 122.55 121.25 113.7 112.35 [4,] 140.00 145.9 144.8 149.60 146.50 145.50 147.90 146.60 145.10 133.6 131.40 [5,] 149.40 149.4 146.8 154.40 151.40 157.00 156.10 163.20 159.80 157.4 156.20 [,12] [1,] 89.30 [2,] 95.50 [3,] 114.25 [4,] 132.50 [5,] 152.50 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 98.7201 98.97475 105.0808 95.93468 102.001 103.259 90.48316 93.45904 [2,] 154.5799 169.02525 171.5192 168.56532 160.699 161.441 164.01684 151.64096 [,9] [,10] [,11] [,12] [1,] 97.1903 92.54294 87.38725 90.3838 [2,] 145.3097 134.85706 137.31275 138.1162 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(92, 96.7, 126.65, 140, 149.4, 87.4, 91.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5tnx41426192944.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,] 89.30 80.3 81.70 127.5 125.1 101.00 NA [2,] 112.00 87.3 85.90 135.2 129.4 107.55 NA [3,] 135.25 93.0 91.45 144.7 142.4 126.80 NA [4,] 147.35 96.1 116.95 148.0 156.8 141.20 NA [5,] 157.00 101.0 132.50 154.4 163.2 149.40 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 119.1266 88.98626 77.28789 138.8618 129.9027 111.452 NA [2,] 151.3734 97.01374 105.61211 150.5382 154.8973 142.148 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(89.3, 112, 135.25, 147.35, 157, 80.3, 87.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6f7dl1426192944.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.15962 57.4 27.800 [2,] 25.15263 62.6 34.050 [3,] 27.36259 67.8 36.450 [4,] 28.85289 73.0 41.900 [5,] 29.69104 79.5 47.525 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 25.67488 63.05649 32.86956 [2,] 29.05030 72.54351 40.03044 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(23.1596200314254, 25.152629661984, 27.3625905311682, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/11xpl1426192944.ps tmp/11xpl1426192944.png",intern=TRUE)) character(0) > try(system("convert tmp/254t31426192944.ps tmp/254t31426192944.png",intern=TRUE)) character(0) > try(system("convert tmp/3kqv41426192944.ps tmp/3kqv41426192944.png",intern=TRUE)) character(0) > try(system("convert tmp/4ib4m1426192944.ps tmp/4ib4m1426192944.png",intern=TRUE)) character(0) > try(system("convert tmp/5tnx41426192944.ps tmp/5tnx41426192944.png",intern=TRUE)) character(0) > try(system("convert tmp/6f7dl1426192944.ps tmp/6f7dl1426192944.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.228 0.352 2.598