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.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] 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,] 111.2 58.5 96.6 118.7 128.0 125.4 NA [2,] 116.7 56.4 93.1 124.1 134.1 127.9 NA [3,] 125.8 60.5 98.3 134.2 138.8 122.0 NA [4,] 131.5 64.6 105.0 142.4 134.0 117.5 NA [5,] 146.2 73.2 95.6 133.8 124.0 117.9 NA [6,] 155.4 84.6 94.3 131.0 110.4 117.9 NA [7,] 157.5 80.4 95.3 133.2 116.7 122.7 NA [8,] 137.2 88.4 97.1 125.9 124.7 125.7 NA [9,] 121.3 84.6 98.1 126.2 126.0 126.1 NA [10,] 89.1 90.8 104.4 122.7 122.8 123.2 NA [11,] 69.6 94.9 107.8 126.6 120.2 120.6 NA [12,] 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/1pnoq1416664350.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/2psxa1416664350.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/3reg41416664350.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/4h3kv1416664350.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.5 64.6 73.20 84.60 80.4 88.4 84.60 89.10 69.6 [2,] 96.60 93.1 98.3 105.0 95.60 94.30 95.3 97.1 98.10 90.80 94.9 [3,] 114.95 120.4 123.9 124.5 120.95 114.15 119.7 125.2 123.65 113.55 114.0 [4,] 125.40 127.9 134.2 134.0 133.80 131.00 133.2 125.9 126.10 122.80 120.6 [5,] 128.00 134.1 138.8 142.4 146.20 155.40 157.5 137.2 126.20 123.20 126.6 [,12] [1,] 56.70 [2,] 93.10 [3,] 117.75 [4,] 123.50 [5,] 124.80 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.37307 97.95288 100.7433 105.7941 96.30977 90.47731 95.25328 [2,] 133.52693 142.84712 147.0567 143.2059 145.59023 137.82269 144.14672 [,8] [,9] [,10] [,11] [,12] [1,] 106.6231 105.5891 92.90897 97.42267 98.14102 [2,] 143.7769 141.7109 134.19103 130.57733 137.35898 $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, 96.6, 114.95, 125.4, 128, 56.4, 93.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5jp0x1416664350.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,] 56.70 56.40 93.10 118.70 110.40 117.50 NA [2,] 100.15 62.55 95.45 124.45 120.70 119.25 NA [3,] 123.55 82.50 97.60 126.40 124.35 122.95 NA [4,] 141.70 89.60 104.70 133.50 131.00 125.55 NA [5,] 157.50 94.90 114.30 142.40 138.80 127.90 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 104.5988 70.16231 93.38101 122.2722 119.6521 120.0765 NA [2,] 142.5012 94.83769 101.81899 130.5278 129.0479 125.8235 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(56.7, 100.15, 123.55, 141.7, 157.5, 56.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/661ep1416664350.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,] 16.29732 34.10 21.8500 [2,] 20.27431 52.90 22.9250 [3,] 26.32748 70.15 26.5625 [4,] 27.86932 77.40 28.9875 [5,] 29.43411 78.30 30.1750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 22.86335 58.97539 23.79735 [2,] 29.79162 81.32461 29.32765 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(16.2973208432143, 20.2743064901234, 26.3274836761396, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1pnoq1416664350.ps tmp/1pnoq1416664350.png",intern=TRUE)) character(0) > try(system("convert tmp/2psxa1416664350.ps tmp/2psxa1416664350.png",intern=TRUE)) character(0) > try(system("convert tmp/3reg41416664350.ps tmp/3reg41416664350.png",intern=TRUE)) character(0) > try(system("convert tmp/4h3kv1416664350.ps tmp/4h3kv1416664350.png",intern=TRUE)) character(0) > try(system("convert tmp/5jp0x1416664350.ps tmp/5jp0x1416664350.png",intern=TRUE)) character(0) > try(system("convert tmp/661ep1416664350.ps tmp/661ep1416664350.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.145 0.412 2.577