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(220.05,220.05,220.62,221.53,221.61,221.5,221.5,221.87,222.27,220.86,221.49,221.67,221.67,221.72,221.67,220.29,220.75,219.59,219.59,219.59,219.82,221.59,220.9,221.01,221.01,219.69,221,219.82,218.04,217.97,217.97,217.53,217,217.18,217.68,217.71,217.71,218.5,218.8,218.94,220,219.89,219.89,220.08,220.16,221,222.16,221.5,221.5,221.6,221.85,223.11,222.79,222.45,222.45,222.4,223.15,224.4,224.24,223.92,212.42,212.34,212.95,213.37,214.26,214.1,213.54,213.69,211.82,212.82,212.36,212.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,] 220.05 221.67 221.01 217.71 221.50 212.42 NA [2,] 220.05 221.72 219.69 218.50 221.60 212.34 NA [3,] 220.62 221.67 221.00 218.80 221.85 212.95 NA [4,] 221.53 220.29 219.82 218.94 223.11 213.37 NA [5,] 221.61 220.75 218.04 220.00 222.79 214.26 NA [6,] 221.50 219.59 217.97 219.89 222.45 214.10 NA [7,] 221.50 219.59 217.97 219.89 222.45 213.54 NA [8,] 221.87 219.59 217.53 220.08 222.40 213.69 NA [9,] 222.27 219.82 217.00 220.16 223.15 211.82 NA [10,] 220.86 221.59 217.18 221.00 224.40 212.82 NA [11,] 221.49 220.90 217.68 222.16 224.24 212.36 NA [12,] 221.67 221.01 217.71 221.50 223.92 212.70 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/1ymt31416742335.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/2rdan1416742335.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/3kyx01416742335.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/40ela1416742335.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] [1,] 212.42 218.50 218.80 218.940 214.260 214.10 213.54 213.690 211.82 212.82 [2,] 217.71 218.50 218.80 218.940 218.040 217.97 217.97 217.530 217.00 217.18 [3,] 220.53 219.87 220.81 220.055 220.375 219.74 219.74 219.835 219.99 220.93 [4,] 221.50 221.60 221.67 221.530 221.610 221.50 221.50 221.870 222.27 221.59 [5,] 221.67 221.72 221.85 223.110 222.790 222.45 222.45 222.400 223.15 224.40 [,11] [,12] [1,] 212.360 212.700 [2,] 217.680 217.710 [3,] 221.195 221.255 [4,] 222.160 221.670 [5,] 224.240 223.920 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 218.0853 217.8704 218.9588 218.3844 218.0722 217.463 217.463 217.0356 [2,] 222.9747 221.8696 222.6612 221.7256 222.6778 222.017 222.017 222.6344 [,9] [,10] [,11] [,12] [1,] 216.5907 218.0854 218.3053 218.7007 [2,] 223.3893 223.7746 224.0847 223.8093 $out [1] 212.34 212.95 213.37 $group [1] 2 3 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(212.42, 217.71, 220.53, 221.5, 221.67, 218.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5rgfh1416742335.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,] 220.05 219.590 217.000 217.710 221.500 211.820 NA [2,] 220.74 219.705 217.605 218.870 222.125 212.390 NA [3,] 221.50 220.825 217.970 219.945 222.620 212.885 NA [4,] 221.64 221.630 219.755 220.580 223.535 213.615 NA [5,] 222.27 221.720 221.010 222.160 224.400 214.260 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 221.0895 219.947 216.9894 219.1651 221.9769 212.3263 NA [2,] 221.9105 221.703 218.9506 220.7249 223.2631 213.4437 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(220.05, 220.74, 221.5, 221.64, 222.27, 219.59, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6giee1416742335.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.966095 8.350 2.06000 [2,] 3.185232 8.805 2.56875 [3,] 3.427028 9.315 2.97375 [4,] 4.024173 11.275 3.36000 [5,] 4.223675 11.880 4.03750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.044382 8.188416 2.612856 [2,] 3.809675 10.441584 3.334644 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.96609507602167, 3.18523240250085, 3.42702814740395, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ymt31416742335.ps tmp/1ymt31416742335.png",intern=TRUE)) character(0) > try(system("convert tmp/2rdan1416742335.ps tmp/2rdan1416742335.png",intern=TRUE)) character(0) > try(system("convert tmp/3kyx01416742335.ps tmp/3kyx01416742335.png",intern=TRUE)) character(0) > try(system("convert tmp/40ela1416742335.ps tmp/40ela1416742335.png",intern=TRUE)) character(0) > try(system("convert tmp/5rgfh1416742335.ps tmp/5rgfh1416742335.png",intern=TRUE)) character(0) > try(system("convert tmp/6giee1416742335.ps tmp/6giee1416742335.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.082 0.385 2.494