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(37.3,39.5,40.6,41.4,41.3,43.5,44,44.9,46.4,47.4,48.7,49.7,51.1,53.2,56.2,58.1,60.6,64.1,67.4,68,70.9,72.8,74.9,76.1,77,78.1,80,79.7,82.7,84.3,83.5,85.9,87,88.6,90.6,91.3,91.6,93.2,95,95.2,97.4,98.6,99.6,100.6,101.3,102.8,103.2,103,105.4,104.7,105.2,105.2,102.8,100.3,99.8,99.4,100.6,100.2,100.4,98.8,96.9,96.3,96.1,93.5,92.1,91.7,87.9,86.4,84.9,81.7,82.6,83.1) > par1 = '4' > par1 <- '4' > #'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] 18 > 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] 18 18 18 18 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 37.3 41.3 46.4 51.1 60.6 70.9 77.0 82.7 87.0 91.6 97.4 101.3 105.4 102.8 [2,] 39.5 43.5 47.4 53.2 64.1 72.8 78.1 84.3 88.6 93.2 98.6 102.8 104.7 100.3 [3,] 40.6 44.0 48.7 56.2 67.4 74.9 80.0 83.5 90.6 95.0 99.6 103.2 105.2 99.8 [4,] 41.4 44.9 49.7 58.1 68.0 76.1 79.7 85.9 91.3 95.2 100.6 103.0 105.2 99.4 [,15] [,16] [,17] [,18] [,19] [1,] 100.6 96.9 92.1 84.9 NA [2,] 100.2 96.3 91.7 81.7 NA [3,] 100.4 96.1 87.9 82.6 NA [4,] 98.8 93.5 86.4 83.1 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/1i0e31416422852.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/2e0pu1416422852.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/30s8y1416422852.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/4nuw91416422852.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] [1,] 37.30 39.50 40.6 41.40 [2,] 60.60 64.10 67.4 68.00 [3,] 85.95 86.45 85.7 86.15 [4,] 97.40 98.60 99.6 98.80 [5,] 105.40 104.70 105.2 105.20 $n [1] 18 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] 72.24533 73.60187 73.70841 74.67979 [2,] 99.65467 99.29813 97.69159 97.62021 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(37.3, 60.6, 85.95, 97.4, 105.4, 39.5, 64.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5slaq1416422852.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] [,10] [,11] [,12] [1,] 37.30 41.30 46.40 51.10 60.60 70.90 77.00 82.7 87.00 91.6 97.4 101.30 [2,] 38.40 42.40 46.90 52.15 62.35 71.85 77.55 83.1 87.80 92.4 98.0 102.05 [3,] 40.05 43.75 48.05 54.70 65.75 73.85 78.90 83.9 89.60 94.1 99.1 102.90 [4,] 41.00 44.45 49.20 57.15 67.70 75.50 79.85 85.1 90.95 95.1 100.1 103.10 [5,] 41.40 44.90 49.70 58.10 68.00 76.10 80.00 85.9 91.30 95.2 100.6 103.20 [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 104.70 99.40 98.8 93.5 86.40 81.70 NA [2,] 104.95 99.60 99.5 94.8 87.15 82.15 NA [3,] 105.20 100.05 100.3 96.2 89.80 82.85 NA [4,] 105.30 101.55 100.5 96.6 91.90 84.00 NA [5,] 105.40 102.80 100.6 96.9 92.10 84.90 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 37.996 42.1305 46.233 50.75 61.5235 70.9665 77.083 82.32 87.1115 91.967 [2,] 42.104 45.3695 49.867 58.65 69.9765 76.7335 80.717 85.48 92.0885 96.233 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 97.441 102.0705 104.9235 98.5095 99.51 94.778 86.0475 81.3885 NA [2,] 100.759 103.7295 105.4765 101.5905 101.09 97.622 93.5525 84.3115 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" NA Warning message: In bxp(list(stats = c(37.3, 38.4, 40.05, 41, 41.4, 41.3, 42.4, 43.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6588c1416422852.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,] 20.58074 63.80 27.8750 [2,] 20.86865 64.20 28.6625 [3,] 21.44504 64.90 30.6000 [4,] 22.20193 66.65 32.9250 [5,] 22.67033 68.10 34.1000 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 20.39175 62.9645 27.23262 [2,] 22.49833 66.8355 33.96738 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(20.5807392983187, 20.8686465792864, 21.4450398311805, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1i0e31416422852.ps tmp/1i0e31416422852.png",intern=TRUE)) character(0) > try(system("convert tmp/2e0pu1416422852.ps tmp/2e0pu1416422852.png",intern=TRUE)) character(0) > try(system("convert tmp/30s8y1416422852.ps tmp/30s8y1416422852.png",intern=TRUE)) character(0) > try(system("convert tmp/4nuw91416422852.ps tmp/4nuw91416422852.png",intern=TRUE)) character(0) > try(system("convert tmp/5slaq1416422852.ps tmp/5slaq1416422852.png",intern=TRUE)) character(0) > try(system("convert tmp/6588c1416422852.ps tmp/6588c1416422852.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.239 0.355 2.616