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(83.7,86.4,85.9,80.4,81.8,87.5,83.7,87,99.7,101.4,101.9,115.7,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) > 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,] 83.7 123.2 96.7 92.0 140.0 130.1 NA [2,] 86.4 136.9 91.6 87.4 149.4 131.1 NA [3,] 85.9 146.8 93.3 86.8 144.3 132.3 NA [4,] 80.4 149.6 93.3 83.7 154.4 128.6 NA [5,] 81.8 146.5 101.0 85.0 151.4 125.1 NA [6,] 87.5 157.0 100.4 81.7 145.5 128.7 NA [7,] 83.7 147.9 86.9 90.9 136.8 156.1 NA [8,] 87.0 133.6 83.9 101.5 146.6 163.2 NA [9,] 99.7 128.7 80.3 113.8 145.1 159.8 NA [10,] 101.4 100.8 87.7 120.1 133.6 157.4 NA [11,] 101.9 91.8 92.7 122.1 131.4 156.2 NA [12,] 115.7 89.3 95.5 132.5 127.5 152.5 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/1kb6l1386251194.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/2htsj1386251194.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/3f9dt1386251194.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/4t0ll1386251194.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,] 83.70 86.40 85.9 80.40 81.80 81.70 83.70 83.90 80.30 87.70 91.8 [2,] 92.00 87.40 86.8 83.70 85.00 87.50 86.90 87.00 99.70 100.80 92.7 [3,] 109.95 111.35 112.8 110.95 113.05 114.55 113.85 117.55 121.25 110.75 112.0 [4,] 130.10 136.90 144.3 149.60 146.50 145.50 147.90 146.60 145.10 133.60 131.4 [5,] 140.00 149.40 146.8 154.40 151.40 157.00 156.10 163.20 159.80 157.40 156.2 [,12] [1,] 89.3 [2,] 95.5 [3,] 121.6 [4,] 132.5 [5,] 152.5 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 85.37427 79.4209 75.71064 68.44237 73.38051 77.13813 74.50303 [2,] 134.52573 143.2791 149.88936 153.45763 152.71949 151.96187 153.19697 [,8] [,9] [,10] [,11] [,12] [1,] 79.10607 91.96553 89.59294 87.03725 97.7338 [2,] 155.99393 150.53447 131.90706 136.96275 145.4662 $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(83.7, 92, 109.95, 130.1, 140, 86.4, 87.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56ch91386251194.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,] 80.40 89.30 80.3 81.70 127.5 125.1 NA [2,] 83.70 112.00 87.3 85.90 135.2 129.4 NA [3,] 86.70 135.25 93.0 91.45 144.7 142.4 NA [4,] 100.55 147.35 96.1 116.95 148.0 156.8 NA [5,] 115.70 157.00 101.0 132.50 154.4 163.2 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 79.0146 119.1266 88.98626 77.28789 138.8618 129.9027 NA [2,] 94.3854 151.3734 97.01374 105.61211 150.5382 154.8973 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(80.4, 83.7, 86.7, 100.55, 115.7, 89.3, 112, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6a7pk1386251194.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.08859 56.30 29.2750 [2,] 25.49323 63.10 34.6375 [3,] 29.30719 69.65 48.7875 [4,] 32.28597 74.65 52.8000 [5,] 33.41323 79.50 58.2500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 26.20897 64.38197 40.50346 [2,] 32.40541 74.91803 57.07154 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(23.0885902557952, 25.4932256771137, 29.3071913587069, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kb6l1386251194.ps tmp/1kb6l1386251194.png",intern=TRUE)) character(0) > try(system("convert tmp/2htsj1386251194.ps tmp/2htsj1386251194.png",intern=TRUE)) character(0) > try(system("convert tmp/3f9dt1386251194.ps tmp/3f9dt1386251194.png",intern=TRUE)) character(0) > try(system("convert tmp/4t0ll1386251194.ps tmp/4t0ll1386251194.png",intern=TRUE)) character(0) > try(system("convert tmp/56ch91386251194.ps tmp/56ch91386251194.png",intern=TRUE)) character(0) > try(system("convert tmp/6a7pk1386251194.ps tmp/6a7pk1386251194.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.159 1.054 6.208