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(44.91,44.86,44.76,44.89,44.89,45,45.01,45.11,45.05,44.67,44.48,44.48,44.48,44.58,44.79,44.79,44.41,44.41,44.44,44.43,44.36,44.39,44.39,44.41,44.32,44.43,44.82,44.97,44.91,44.79,44.76,44.8,44.65,44.49,44.56,44.4,44.45,44.46,44.39,44.5,44.44,44.41,44.4,44.42,44.49,44.46,44.49,44.5,44.5,44.5,44.55,44.53,44.49,44.49,44.62,44.59,44.56,44.57,44.04,44.06,44.07,44.1,44.21,44.48,44.51,44.24,44.25,44.27,44.45,44.39,44.23,44.23) > 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,] 44.91 44.48 44.32 44.45 44.50 44.07 NA [2,] 44.86 44.58 44.43 44.46 44.50 44.10 NA [3,] 44.76 44.79 44.82 44.39 44.55 44.21 NA [4,] 44.89 44.79 44.97 44.50 44.53 44.48 NA [5,] 44.89 44.41 44.91 44.44 44.49 44.51 NA [6,] 45.00 44.41 44.79 44.41 44.49 44.24 NA [7,] 45.01 44.44 44.76 44.40 44.62 44.25 NA [8,] 45.11 44.43 44.80 44.42 44.59 44.27 NA [9,] 45.05 44.36 44.65 44.49 44.56 44.45 NA [10,] 44.67 44.39 44.49 44.46 44.57 44.39 NA [11,] 44.48 44.39 44.56 44.49 44.04 44.23 NA [12,] 44.48 44.41 44.40 44.50 44.06 44.23 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/1zfum1416566537.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/21yy91416566537.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/35g9d1416566537.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/4xv1i1416566537.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,] 44.070 44.43 44.210 44.48 44.41 44.24 44.25 44.27 44.360 44.390 44.040 [2,] 44.320 44.43 44.390 44.50 44.44 44.41 44.40 44.42 44.450 44.390 44.230 [3,] 44.465 44.48 44.655 44.66 44.50 44.45 44.53 44.51 44.525 44.475 44.435 [4,] 44.500 44.58 44.790 44.89 44.89 44.79 44.76 44.80 44.650 44.570 44.490 [5,] 44.500 44.58 44.820 44.97 44.91 45.00 45.01 45.11 44.650 44.670 44.560 [,12] [1,] 44.060 [2,] 44.230 [3,] 44.405 [4,] 44.480 [5,] 44.500 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 44.34889 44.38325 44.39699 44.40844 44.20974 44.20489 44.29779 44.26489 [2,] 44.58111 44.57675 44.91301 44.91156 44.79026 44.69511 44.76221 44.75511 [,9] [,10] [,11] [,12] [1,] 44.39599 44.35889 44.26729 44.24374 [2,] 44.65401 44.59111 44.60271 44.56626 $out [1] 44.91 44.86 44.10 45.05 $group [1] 1 2 2 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(44.07, 44.32, 44.465, 44.5, 44.5, 44.43, 44.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/596z11416566537.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,] 44.480 44.36 44.320 44.390 44.490 44.070 NA [2,] 44.715 44.40 44.460 44.415 44.490 44.220 NA [3,] 44.890 44.42 44.705 44.455 44.515 44.245 NA [4,] 45.005 44.53 44.810 44.490 44.565 44.420 NA [5,] 45.110 44.58 44.970 44.500 44.620 44.510 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 44.75773 44.36071 44.54536 44.42079 44.48079 44.15378 NA [2,] 45.02227 44.47929 44.86464 44.48921 44.54921 44.33622 NA $out [1] 44.79 44.79 44.04 44.06 $group [1] 2 2 5 5 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(44.48, 44.715, 44.89, 45.005, 45.11, 44.36, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6pcwv1416566537.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.1091329 0.280 0.12250 [2,] 0.2060109 0.495 0.15500 [3,] 0.2449924 0.650 0.26125 [4,] 0.2749446 0.760 0.33375 [5,] 0.3067029 0.840 0.35750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2135512 0.5291317 0.1797209 [2,] 0.2764335 0.7708683 0.3427791 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.109132946446067, 0.206010948789545, 0.244992353708362, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zfum1416566537.ps tmp/1zfum1416566537.png",intern=TRUE)) character(0) > try(system("convert tmp/21yy91416566537.ps tmp/21yy91416566537.png",intern=TRUE)) character(0) > try(system("convert tmp/35g9d1416566537.ps tmp/35g9d1416566537.png",intern=TRUE)) character(0) > try(system("convert tmp/4xv1i1416566537.ps tmp/4xv1i1416566537.png",intern=TRUE)) character(0) > try(system("convert tmp/596z11416566537.ps tmp/596z11416566537.png",intern=TRUE)) character(0) > try(system("convert tmp/6pcwv1416566537.ps tmp/6pcwv1416566537.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.139 0.382 2.542