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(1.5,1.439,1.49,1.502,1.531,1.611,1.644,1.559,1.553,1.494,1.298,1.215,1.179,1.267,1.282,1.304,1.32,1.413,1.38,1.426,1.394,1.354,1.415,1.406,1.44,1.449,1.489,1.53,1.548,1.518,1.507,1.499,1.487,1.487,1.491,1.56,1.587,1.584,1.647,1.666,1.699,1.671,1.622,1.669,1.663,1.624,1.621,1.607,1.671,1.699,1.751,1.821,1.77,1.734,1.703,1.752,1.823,1.827,1.773,1.75,1.733,1.765,1.791,1.773,1.712,1.735,1.729,1.769,1.776,1.709,1.678,1.691) > 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,] 1.500 1.179 1.440 1.587 1.671 1.733 NA [2,] 1.439 1.267 1.449 1.584 1.699 1.765 NA [3,] 1.490 1.282 1.489 1.647 1.751 1.791 NA [4,] 1.502 1.304 1.530 1.666 1.821 1.773 NA [5,] 1.531 1.320 1.548 1.699 1.770 1.712 NA [6,] 1.611 1.413 1.518 1.671 1.734 1.735 NA [7,] 1.644 1.380 1.507 1.622 1.703 1.729 NA [8,] 1.559 1.426 1.499 1.669 1.752 1.769 NA [9,] 1.553 1.394 1.487 1.663 1.823 1.776 NA [10,] 1.494 1.354 1.487 1.624 1.827 1.709 NA [11,] 1.298 1.415 1.491 1.621 1.773 1.678 NA [12,] 1.215 1.406 1.560 1.607 1.750 1.691 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/1hctz1416605541.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/2h2wh1416605541.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/3hwuq1416605541.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/4l2rr1416605541.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,] 1.1790 1.2670 1.2820 1.304 1.3200 1.413 1.380 1.426 1.394 1.354 1.298 [2,] 1.4400 1.4390 1.4890 1.502 1.5310 1.518 1.507 1.499 1.487 1.487 1.415 [3,] 1.5435 1.5165 1.5685 1.598 1.6235 1.641 1.633 1.614 1.608 1.559 1.556 [4,] 1.6710 1.6990 1.7510 1.773 1.7120 1.734 1.703 1.752 1.776 1.709 1.678 [5,] 1.7330 1.7650 1.7910 1.821 1.7700 1.735 1.729 1.769 1.823 1.827 1.773 [,12] [1,] 1.2150 [2,] 1.4060 [3,] 1.5835 [4,] 1.6910 [5,] 1.7500 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.394498 1.348792 1.399502 1.423196 1.506749 1.501673 1.506574 1.450807 [2,] 1.692502 1.684208 1.737498 1.772804 1.740251 1.780327 1.759426 1.777193 [,9] [,10] [,11] [,12] [1,] 1.421586 1.415803 1.386357 1.399666 [2,] 1.794414 1.702197 1.725643 1.767334 $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(1.179, 1.44, 1.5435, 1.671, 1.733, 1.267, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5aq8d1416605541.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,] 1.4390 1.1790 1.440 1.5840 1.6710 1.6780 NA [2,] 1.4645 1.2930 1.487 1.6140 1.7185 1.7105 NA [3,] 1.5010 1.3670 1.495 1.6355 1.7515 1.7340 NA [4,] 1.5560 1.4095 1.524 1.6675 1.7970 1.7710 NA [5,] 1.6440 1.4260 1.560 1.6990 1.8270 1.7910 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.459266 1.313864 1.478124 1.611098 1.715696 1.706406 NA [2,] 1.542734 1.420136 1.511876 1.659902 1.787304 1.761594 NA $out [1] 1.298 1.215 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1.439, 1.4645, 1.501, 1.556, 1.644, 1.179, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/60z9a1416605541.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.1279964 0.322 0.152500 [2,] 0.1526603 0.389 0.186000 [3,] 0.1740291 0.474 0.221375 [4,] 0.1919705 0.513 0.232750 [5,] 0.1978501 0.554 0.244250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.1560995 0.4174428 0.200052 [2,] 0.1919588 0.5305572 0.242698 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.127996354114743, 0.152660335529275, 0.174029149679427, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1hctz1416605541.ps tmp/1hctz1416605541.png",intern=TRUE)) character(0) > try(system("convert tmp/2h2wh1416605541.ps tmp/2h2wh1416605541.png",intern=TRUE)) character(0) > try(system("convert tmp/3hwuq1416605541.ps tmp/3hwuq1416605541.png",intern=TRUE)) character(0) > try(system("convert tmp/4l2rr1416605541.ps tmp/4l2rr1416605541.png",intern=TRUE)) character(0) > try(system("convert tmp/5aq8d1416605541.ps tmp/5aq8d1416605541.png",intern=TRUE)) character(0) > try(system("convert tmp/60z9a1416605541.ps tmp/60z9a1416605541.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.282 0.388 2.690