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(27.88,28.06,28.08,28.12,28.11,28.18,28.2,28.37,28.64,28.75,28.97,29.08,29.16,29.24,29.36,29.35,29.43,29.49,29.61,29.66,29.75,29.74,29.97,30.02,30.09,30.16,30.33,30.41,30.44,30.45,30.46,30.51,30.54,30.82,30.88,30.89,31.13,31.41,31.47,31.56,31.62,31.65,31.79,31.98,32.14,32.32,32.5,32.55,32.66,32.68,32.72,32.8,32.93,32.96,32.98,33.09,33.46,33.65,33.82,33.83,33.92,33.87,34.03,34.11,34.29,34.44,34.64,34.77,35.01,35.19,35.32,35.35) > 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,] 27.88 29.16 30.09 31.13 32.66 33.92 NA [2,] 28.06 29.24 30.16 31.41 32.68 33.87 NA [3,] 28.08 29.36 30.33 31.47 32.72 34.03 NA [4,] 28.12 29.35 30.41 31.56 32.80 34.11 NA [5,] 28.11 29.43 30.44 31.62 32.93 34.29 NA [6,] 28.18 29.49 30.45 31.65 32.96 34.44 NA [7,] 28.20 29.61 30.46 31.79 32.98 34.64 NA [8,] 28.37 29.66 30.51 31.98 33.09 34.77 NA [9,] 28.64 29.75 30.54 32.14 33.46 35.01 NA [10,] 28.75 29.74 30.82 32.32 33.65 35.19 NA [11,] 28.97 29.97 30.88 32.50 33.82 35.32 NA [12,] 29.08 30.02 30.89 32.55 33.83 35.35 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/18ejb1416762441.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/2ilaz1416762441.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/319se1416762441.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/4pjds1416762441.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,] 27.88 28.060 28.08 28.120 28.11 28.18 28.200 28.370 28.64 28.75 28.97 [2,] 29.16 29.240 29.36 29.350 29.43 29.49 29.610 29.660 29.75 29.74 29.97 [3,] 30.61 30.785 30.90 30.985 31.03 31.05 31.125 31.245 31.34 31.57 31.69 [4,] 32.66 32.680 32.72 32.800 32.93 32.96 32.980 33.090 33.46 33.65 33.82 [5,] 33.92 33.870 34.03 34.110 34.29 34.44 34.640 34.770 35.01 35.19 35.32 [,12] [1,] 29.08 [2,] 30.02 [3,] 31.72 [4,] 33.83 [5,] 35.35 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 28.35239 28.56609 28.73269 28.75964 28.77239 28.81174 28.95124 29.03254 [2,] 32.86761 33.00391 33.06731 33.21036 33.28761 33.28826 33.29876 33.45746 [,9] [,10] [,11] [,12] [1,] 28.94693 29.04792 29.20663 29.26243 [2,] 33.73307 34.09208 34.17337 34.17757 $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(27.88, 29.16, 30.61, 32.66, 33.92, 28.06, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5acto1416762441.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,] 27.880 29.160 30.090 31.130 32.660 33.87 NA [2,] 28.095 29.355 30.370 31.515 32.760 34.07 NA [3,] 28.190 29.550 30.455 31.720 32.970 34.54 NA [4,] 28.695 29.745 30.680 32.230 33.555 35.10 NA [5,] 29.080 30.020 30.890 32.550 33.830 35.35 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 27.91634 29.37212 30.31361 31.39388 32.6074 34.07021 NA [2,] 28.46366 29.72788 30.59639 32.04612 33.3326 35.00979 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(27.88, 28.095, 28.19, 28.695, 29.08, 29.16, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/61fsz1416762441.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,] 2.173391 5.810 2.80500 [2,] 2.226926 6.015 2.88000 [3,] 2.319212 6.265 2.91125 [4,] 2.392196 6.385 3.22750 [5,] 2.436118 6.440 3.30750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.243831 6.096241 2.752753 [2,] 2.394593 6.433759 3.069747 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.17339059229276, 2.2269257888491, 2.31921236917227, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/18ejb1416762441.ps tmp/18ejb1416762441.png",intern=TRUE)) character(0) > try(system("convert tmp/2ilaz1416762441.ps tmp/2ilaz1416762441.png",intern=TRUE)) character(0) > try(system("convert tmp/319se1416762441.ps tmp/319se1416762441.png",intern=TRUE)) character(0) > try(system("convert tmp/4pjds1416762441.ps tmp/4pjds1416762441.png",intern=TRUE)) character(0) > try(system("convert tmp/5acto1416762441.ps tmp/5acto1416762441.png",intern=TRUE)) character(0) > try(system("convert tmp/61fsz1416762441.ps tmp/61fsz1416762441.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.208 0.416 2.651