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(111.4,117,141.7,120,132.1,146.7,122.5,99.6,122.7,139,117.8,125.5,134.5,121.3,126.7,117.7,123,132.1,113.1,89.2,121.7,105.3,85.3,105.3,72.2,92.1,97.2,78.6,78.1,93,81,65.9,88.6,85.7,76.3,96.8,76.8,85.6,119.2,91.4,95.7,112.3,95.2,82.8,111.3,108.2,97,124.4,99.3,117.6,131.5,114.2,116.8,116.5,105.4,89.2,115.8,111.4,106.4,128.4,107.7,111,129.8,130.5,142.9,159.9,84.1,75,100.7,106.8,97.4,113,76.9,87.3,103.7,92.1,92.9,112.2,88.7,74.6,101.5,119.7,120.7,153.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] 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,] 111.4 134.5 72.2 76.8 99.3 107.7 76.9 NA [2,] 117.0 121.3 92.1 85.6 117.6 111.0 87.3 NA [3,] 141.7 126.7 97.2 119.2 131.5 129.8 103.7 NA [4,] 120.0 117.7 78.6 91.4 114.2 130.5 92.1 NA [5,] 132.1 123.0 78.1 95.7 116.8 142.9 92.9 NA [6,] 146.7 132.1 93.0 112.3 116.5 159.9 112.2 NA [7,] 122.5 113.1 81.0 95.2 105.4 84.1 88.7 NA [8,] 99.6 89.2 65.9 82.8 89.2 75.0 74.6 NA [9,] 122.7 121.7 88.6 111.3 115.8 100.7 101.5 NA [10,] 139.0 105.3 85.7 108.2 111.4 106.8 119.7 NA [11,] 117.8 85.3 76.3 97.0 106.4 97.4 120.7 NA [12,] 125.5 105.3 96.8 124.4 128.4 113.0 153.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/1vq7n1416503863.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/2qbos1416503863.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/3dldg1416503863.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/4e9cx1416503863.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,] 72.20 85.6 97.20 78.60 78.10 93.00 81.00 65.9 88.60 105.30 76.30 [2,] 76.85 89.7 111.45 91.75 94.30 112.25 86.40 74.8 101.10 106.05 91.15 [3,] 99.30 111.0 126.70 114.20 116.80 116.50 95.20 82.8 111.30 108.20 97.40 [4,] 109.55 117.3 130.65 118.85 127.55 139.40 109.25 89.2 118.75 115.55 112.10 [5,] 134.50 121.3 141.70 130.50 142.90 159.90 122.50 99.6 122.70 119.70 120.70 [,12] [1,] 96.80 [2,] 109.15 [3,] 124.40 [4,] 126.95 [5,] 153.50 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 79.77209 94.51773 115.2341 98.01632 96.94364 100.2865 81.55435 [2,] 118.82791 127.48227 138.1659 130.38368 136.65636 132.7135 108.84565 [,8] [,9] [,10] [,11] [,12] [1,] 74.20055 100.7597 102.5268 84.889 113.7701 [2,] 91.39945 121.8403 113.8732 109.911 135.0299 $out [1] 139.0 85.7 $group [1] 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(72.2, 76.85, 99.3, 109.55, 134.5, 85.6, 89.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5d6041416503863.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,] 99.60 85.30 65.90 76.80 89.2 75.00 74.60 NA [2,] 117.40 105.30 77.20 88.50 105.9 99.05 88.00 NA [3,] 122.60 119.50 83.35 96.35 115.0 109.35 97.20 NA [4,] 135.55 124.85 92.55 111.80 117.2 130.15 115.95 NA [5,] 146.70 134.50 97.20 124.40 131.5 159.90 153.50 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 114.3217 110.5831 76.34876 85.72271 109.846 95.16508 84.45182 NA [2,] 130.8783 128.4169 90.35124 106.97729 120.154 123.53492 109.94818 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(99.6, 117.4, 122.6, 135.55, 146.7, 85.3, 105.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6q4f71416503863.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,] 11.37464 33.7 9.500 [2,] 15.58956 38.6 17.725 [3,] 16.16960 48.2 21.900 [4,] 20.95389 59.5 27.375 [5,] 23.38688 66.9 33.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 13.72289 38.66737 17.49857 [2,] 18.61631 57.73263 26.30143 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(11.3746376185082, 15.5895561490605, 16.1695966897164, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1vq7n1416503863.ps tmp/1vq7n1416503863.png",intern=TRUE)) character(0) > try(system("convert tmp/2qbos1416503863.ps tmp/2qbos1416503863.png",intern=TRUE)) character(0) > try(system("convert tmp/3dldg1416503863.ps tmp/3dldg1416503863.png",intern=TRUE)) character(0) > try(system("convert tmp/4e9cx1416503863.ps tmp/4e9cx1416503863.png",intern=TRUE)) character(0) > try(system("convert tmp/5d6041416503863.ps tmp/5d6041416503863.png",intern=TRUE)) character(0) > try(system("convert tmp/6q4f71416503863.ps tmp/6q4f71416503863.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.075 0.402 2.512