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(103.1,113.5,115.7,113.1,112.7,121.9,120.3,108.7,102.8,83.4,79.4,77.8,85.7,83.2,82,86.9,95.7,97.9,89.3,91.5,86.8,91,93.8,96.8,95.7,91.4,88.7,88.2,87.7,89.5,95.6,100.5,106.3,112,117.7,125,132.4,138.1,134.7,136.7,134.3,131.6,129.8,131.9,129.8,119.4,116.7,112.8,116,117.5,118.8,118.7,116.3,115.2,131.7,133.7,132.5,126.9,122.2,120.2,117.9,117.2,116.4,112.3,113.6,114.2,108,102.8,102.8,101.6,100.3,101.7) > 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,] 103.1 85.7 95.7 132.4 116.0 117.9 NA [2,] 113.5 83.2 91.4 138.1 117.5 117.2 NA [3,] 115.7 82.0 88.7 134.7 118.8 116.4 NA [4,] 113.1 86.9 88.2 136.7 118.7 112.3 NA [5,] 112.7 95.7 87.7 134.3 116.3 113.6 NA [6,] 121.9 97.9 89.5 131.6 115.2 114.2 NA [7,] 120.3 89.3 95.6 129.8 131.7 108.0 NA [8,] 108.7 91.5 100.5 131.9 133.7 102.8 NA [9,] 102.8 86.8 106.3 129.8 132.5 102.8 NA [10,] 83.4 91.0 112.0 119.4 126.9 101.6 NA [11,] 79.4 93.8 117.7 116.7 122.2 100.3 NA [12,] 77.8 96.8 125.0 112.8 120.2 101.7 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/1r9gc1417007690.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/2pdd21417007690.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/38u081417007690.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/4em6w1417007690.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,] 85.70 83.20 82.00 86.9 87.70 89.5 89.30 91.50 86.80 83.4 79.4 [2,] 95.70 91.40 88.70 88.2 95.70 97.9 95.60 100.50 102.80 91.0 93.8 [3,] 109.55 115.35 116.05 112.7 113.15 114.7 114.15 105.75 104.55 106.8 108.5 [4,] 117.90 117.50 118.80 118.7 116.30 121.9 129.80 131.90 129.80 119.4 117.7 [5,] 132.40 138.10 134.70 136.7 134.30 131.6 131.70 133.70 132.50 126.9 122.2 [,12] [1,] 77.80 [2,] 96.80 [3,] 107.25 [4,] 120.20 [5,] 125.00 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 95.23028 98.51466 96.63453 93.02651 99.86233 99.21922 92.0899 [2,] 123.86972 132.18534 135.46547 132.37349 126.43767 130.18078 136.2101 [,8] [,9] [,10] [,11] [,12] [1,] 85.49599 87.13413 88.48108 93.08373 92.15624 [2,] 126.00401 121.96587 125.11892 123.91627 122.34376 $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(85.7, 95.7, 109.55, 117.9, 132.4, 83.2, 91.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5vxhd1417007690.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,] 77.8 82.00 87.70 112.80 115.2 100.30 NA [2,] 93.1 86.25 89.10 124.60 116.9 102.25 NA [3,] 110.7 90.15 95.65 131.75 119.5 110.15 NA [4,] 114.6 94.75 109.15 134.50 129.3 115.30 NA [5,] 121.9 97.90 125.00 138.10 133.7 117.90 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 100.8937 86.27309 86.50506 127.2345 113.8443 104.1978 NA [2,] 120.5063 94.02691 104.79494 136.2655 125.1557 116.1022 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(77.8, 93.1, 110.7, 114.6, 121.9, 82, 86.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6vbpu1417007690.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,] 15.50373 42.10 15.6750 [2,] 16.74487 42.60 20.1000 [3,] 17.37899 46.15 21.5750 [4,] 18.37998 48.50 23.4875 [5,] 19.98193 54.90 25.0250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 16.63320 43.45897 20.02994 [2,] 18.12478 48.84103 23.12006 $out [1] 28.725 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(15.5037307338159, 16.7448725624415, 17.3789898559139, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1r9gc1417007690.ps tmp/1r9gc1417007690.png",intern=TRUE)) character(0) > try(system("convert tmp/2pdd21417007690.ps tmp/2pdd21417007690.png",intern=TRUE)) character(0) > try(system("convert tmp/38u081417007690.ps tmp/38u081417007690.png",intern=TRUE)) character(0) > try(system("convert tmp/4em6w1417007690.ps tmp/4em6w1417007690.png",intern=TRUE)) character(0) > try(system("convert tmp/5vxhd1417007690.ps tmp/5vxhd1417007690.png",intern=TRUE)) character(0) > try(system("convert tmp/6vbpu1417007690.ps tmp/6vbpu1417007690.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.176 0.442 2.642