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(75.6,74,75.3,83.1,84.9,83.5,88.2,87.4,77.8,74.5,75.3,78.7,71.4,75.8,79.2,84.4,84.4,87.2,92.4,88.5,94.8,100.9,110,107.9,111.2,116.7,125.8,131.5,146.2,155.4,157.5,137.2,121.3,89.1,69.6,56.7,58.5,56.4,60.5,64.6,73.2,84.6,80.4,88.4,84.6,90.8,94.9,93.1,96.6,93.1,98.3,105,95.6,94.3,95.3,97.1,98.1,104.4,107.8,114.3,118.7,124.1,134.2,142.4,133.8,131,133.2,125.9,126.2,122.7,126.6,124.8,128,134.1,138.8,134,124,110.4,116.7,124.7,126,122.8,120.2,121.2,125.4,127.9,122,117.5,117.9,117.9,122.7,125.7,126.1,123.2,120.6,123.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] 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,] 75.6 71.4 111.2 58.5 96.6 118.7 128.0 125.4 NA [2,] 74.0 75.8 116.7 56.4 93.1 124.1 134.1 127.9 NA [3,] 75.3 79.2 125.8 60.5 98.3 134.2 138.8 122.0 NA [4,] 83.1 84.4 131.5 64.6 105.0 142.4 134.0 117.5 NA [5,] 84.9 84.4 146.2 73.2 95.6 133.8 124.0 117.9 NA [6,] 83.5 87.2 155.4 84.6 94.3 131.0 110.4 117.9 NA [7,] 88.2 92.4 157.5 80.4 95.3 133.2 116.7 122.7 NA [8,] 87.4 88.5 137.2 88.4 97.1 125.9 124.7 125.7 NA [9,] 77.8 94.8 121.3 84.6 98.1 126.2 126.0 126.1 NA [10,] 74.5 100.9 89.1 90.8 104.4 122.7 122.8 123.2 NA [11,] 75.3 110.0 69.6 94.9 107.8 126.6 120.2 120.6 NA [12,] 78.7 107.9 56.7 93.1 114.3 124.8 121.2 123.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/14nwo1432677742.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/2hyfz1432677742.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/3s7g81432677742.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/4oqys1432677742.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,] 58.50 56.4 60.50 64.60 73.20 83.50 80.40 87.40 77.80 74.50 69.6 [2,] 73.50 74.9 77.25 83.75 84.65 85.90 90.30 88.45 89.70 89.95 85.1 [3,] 103.90 104.9 110.15 111.25 106.75 102.35 106.00 110.90 109.70 102.65 108.9 [4,] 122.05 126.0 130.00 132.75 128.90 124.45 127.95 125.80 126.05 122.75 120.4 [5,] 128.00 134.1 138.80 142.40 146.20 155.40 157.50 137.20 126.20 123.20 126.6 [,12] [1,] 56.70 [2,] 85.90 [3,] 111.10 [4,] 122.35 [5,] 124.80 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 76.77927 76.35481 80.68309 83.8779 82.03131 80.81542 84.96817 [2,] 131.02073 133.44519 139.61691 138.6221 131.46869 123.88458 127.03183 [,8] [,9] [,10] [,11] [,12] [1,] 90.03575 89.39437 84.32745 89.18091 90.73851 [2,] 131.76425 130.00563 120.97255 128.61909 131.46149 $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(58.5, 73.5, 103.9, 122.05, 128, 56.4, 74.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5pdve1432677742.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,] 74.00 71.40 56.70 56.40 93.10 118.70 110.40 117.50 NA [2,] 75.30 81.80 100.15 62.55 95.45 124.45 120.70 119.25 NA [3,] 78.25 87.85 123.55 82.50 97.60 126.40 124.35 122.95 NA [4,] 84.20 97.85 141.70 89.60 104.70 133.50 131.00 125.55 NA [5,] 88.20 110.00 157.50 94.90 114.30 142.40 138.80 127.90 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 74.19065 80.52949 104.5988 70.16231 93.38101 122.2722 119.6521 120.0765 [2,] 82.30935 95.17051 142.5012 94.83769 101.81899 130.5278 129.0479 125.8235 [,9] [1,] NA [2,] NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(74, 75.3, 78.25, 84.2, 88.2, 71.4, 81.8, 87.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6co6r1432677742.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,] 18.30855 48.4 30.3000 [2,] 21.11240 53.4 33.0625 [3,] 26.07561 70.7 35.9500 [4,] 27.50174 77.4 46.9375 [5,] 29.96483 78.3 49.7000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 23.16140 59.75344 29.62152 [2,] 28.98983 81.64656 42.27848 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(18.3085460138935, 21.1123998993336, 26.0756146623407, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/14nwo1432677742.ps tmp/14nwo1432677742.png",intern=TRUE)) character(0) > try(system("convert tmp/2hyfz1432677742.ps tmp/2hyfz1432677742.png",intern=TRUE)) character(0) > try(system("convert tmp/3s7g81432677742.ps tmp/3s7g81432677742.png",intern=TRUE)) character(0) > try(system("convert tmp/4oqys1432677742.ps tmp/4oqys1432677742.png",intern=TRUE)) character(0) > try(system("convert tmp/5pdve1432677742.ps tmp/5pdve1432677742.png",intern=TRUE)) character(0) > try(system("convert tmp/6co6r1432677742.ps tmp/6co6r1432677742.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.179 0.355 2.561