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(2.08,2.09,2.36,2.99,2.75,1.58,1.69,1.3,1.97,1.84,1.96,1.86,2.75,2.62,2.41,3.61,2.03,1.45,1.4,1.3,1.58,2.1,2.27,2.54,2.55,2.05,2.32,2.6,2.1,1.61,1.55,1.12,1.39,2.18,1.94,2.27,2.41,2.2,2.58,2.9,2.12,1.34,1.07,0.86,1,1.54,1.29,1.44,2.6,2.77,3.31,3.2,2.07,1.42,1.43,1.28,1.59,1.68,2.01,2.52,2.74,3.06,2.69,2.32,1.67,1.04,0.98,0.86,0.97,1.3,1.82,1.99,2.7,2.86,2.91,2.56,2.05,1.62,1.26,1.44,1.27,1.64,1.84,2.1,2.79,2.84,2.76,2.67,2.1,1.55,1.42,1.12,1.12,1.41,1.56,1.8) > 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,] 2.08 2.75 2.55 2.41 2.60 2.74 2.70 2.79 NA [2,] 2.09 2.62 2.05 2.20 2.77 3.06 2.86 2.84 NA [3,] 2.36 2.41 2.32 2.58 3.31 2.69 2.91 2.76 NA [4,] 2.99 3.61 2.60 2.90 3.20 2.32 2.56 2.67 NA [5,] 2.75 2.03 2.10 2.12 2.07 1.67 2.05 2.10 NA [6,] 1.58 1.45 1.61 1.34 1.42 1.04 1.62 1.55 NA [7,] 1.69 1.40 1.55 1.07 1.43 0.98 1.26 1.42 NA [8,] 1.30 1.30 1.12 0.86 1.28 0.86 1.44 1.12 NA [9,] 1.97 1.58 1.39 1.00 1.59 0.97 1.27 1.12 NA [10,] 1.84 2.10 2.18 1.54 1.68 1.30 1.64 1.41 NA [11,] 1.96 2.27 1.94 1.29 2.01 1.82 1.84 1.56 NA [12,] 1.86 2.54 2.27 1.44 2.52 1.99 2.10 1.80 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/1ylgq1426097618.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/2qije1426097618.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/3tzra1426097618.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/4erkd1426097618.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] [,12] [1,] 2.410 2.050 2.320 2.320 2.030 1.340 0.980 0.86 0.970 1.300 1.290 1.440 [2,] 2.480 2.145 2.385 2.580 2.040 1.380 1.165 0.99 1.060 1.475 1.690 1.830 [3,] 2.650 2.695 2.635 2.785 2.085 1.500 1.410 1.20 1.330 1.660 1.890 2.045 [4,] 2.745 2.850 2.835 3.095 2.110 1.595 1.490 1.30 1.585 1.970 1.985 2.395 [5,] 2.790 3.060 3.310 3.610 2.120 1.620 1.690 1.44 1.970 2.180 2.270 2.540 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2.501967 2.301177 2.383624 2.497314 2.045897 1.379898 1.22845 1.02683 [2,] 2.798033 3.088823 2.886376 3.072686 2.124103 1.620102 1.59155 1.37317 [,9] [,10] [,11] [,12] [1,] 1.036727 1.383486 1.725209 1.729383 [2,] 1.623273 1.936514 2.054791 2.360617 $out [1] 2.08 2.75 1.67 1.04 $group [1] 1 5 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(2.41, 2.48, 2.65, 2.745, 2.79, 2.05, 2.145, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5vl2l1426097618.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,] 1.300 1.300 1.120 0.860 1.280 0.860 1.260 1.120 NA [2,] 1.765 1.515 1.580 1.180 1.510 1.010 1.530 1.415 NA [3,] 1.965 2.185 2.075 1.490 2.040 1.745 1.945 1.680 NA [4,] 2.225 2.580 2.295 2.305 2.685 2.505 2.630 2.715 NA [5,] 2.750 3.610 2.600 2.900 3.310 3.060 2.910 2.840 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.755191 1.699246 1.748884 0.9768799 1.504075 1.06312 1.443283 1.087061 [2,] 2.174809 2.670754 2.401116 2.0031201 2.575925 2.42688 2.446717 2.272939 [,9] [1,] NA [2,] NA $out [1] 2.99 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(1.3, 1.765, 1.965, 2.225, 2.75, 1.3, 1.515, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6yig11426097618.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,] 0.1936446 0.580 0.0600 [2,] 0.2369373 0.710 0.2225 [3,] 0.3048776 0.985 0.3225 [4,] 0.3588091 1.045 0.4700 [5,] 0.4108854 1.290 0.6725 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2492911 0.8322043 0.2096136 [2,] 0.3604642 1.1377957 0.4353864 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.193644556561021, 0.236937297467135, 0.304877635536307, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ylgq1426097618.ps tmp/1ylgq1426097618.png",intern=TRUE)) character(0) > try(system("convert tmp/2qije1426097618.ps tmp/2qije1426097618.png",intern=TRUE)) character(0) > try(system("convert tmp/3tzra1426097618.ps tmp/3tzra1426097618.png",intern=TRUE)) character(0) > try(system("convert tmp/4erkd1426097618.ps tmp/4erkd1426097618.png",intern=TRUE)) character(0) > try(system("convert tmp/5vl2l1426097618.ps tmp/5vl2l1426097618.png",intern=TRUE)) character(0) > try(system("convert tmp/6yig11426097618.ps tmp/6yig11426097618.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.152 0.325 2.500