R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-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(46.83,45.93,45.93,45.93,45.9,45.91,45.85,45.58,45.56,45.5,45.5,45.5,45.51,45.49,45.4,45.38,45.38,45.38,45.49,45.41,44.99,44.98,44.93,44.93,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) > 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,] 46.83 45.51 44.91 44.48 44.32 44.45 NA [2,] 45.93 45.49 44.86 44.58 44.43 44.46 NA [3,] 45.93 45.40 44.76 44.79 44.82 44.39 NA [4,] 45.93 45.38 44.89 44.79 44.97 44.50 NA [5,] 45.90 45.38 44.89 44.41 44.91 44.44 NA [6,] 45.91 45.38 45.00 44.41 44.79 44.41 NA [7,] 45.85 45.49 45.01 44.44 44.76 44.40 NA [8,] 45.58 45.41 45.11 44.43 44.80 44.42 NA [9,] 45.56 44.99 45.05 44.36 44.65 44.49 NA [10,] 45.50 44.98 44.67 44.39 44.49 44.46 NA [11,] 45.50 44.93 44.48 44.39 44.56 44.49 NA [12,] 45.50 44.93 44.48 44.41 44.40 44.50 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/1ichr1353923944.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/20qkz1353923944.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/385gg1353923944.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/4e3zf1353923944.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.320 44.43 44.390 44.50 44.41 44.410 44.400 44.420 44.36 44.39 44.390 [2,] 44.450 44.46 44.760 44.79 44.44 44.410 44.440 44.430 44.49 44.46 44.480 [3,] 44.695 44.72 44.805 44.93 44.90 44.895 44.885 44.955 44.82 44.58 44.525 [4,] 45.510 45.49 45.400 45.38 45.38 45.380 45.490 45.410 45.05 44.98 44.930 [5,] 46.830 45.93 45.930 45.93 45.90 45.910 45.850 45.580 45.56 45.50 45.500 [,12] [1,] 44.40 [2,] 44.41 [3,] 44.49 [4,] 44.93 [5,] 45.50 $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.01127 44.05562 44.39218 44.54943 44.29367 44.26932 44.20772 44.32287 [2,] 45.37873 45.38438 45.21782 45.31057 45.50633 45.52068 45.56228 45.58713 [,9] [,10] [,11] [,12] [1,] 44.45878 44.24458 44.23474 44.15458 [2,] 45.18122 44.91542 44.81526 44.82542 $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(44.32, 44.45, 44.695, 45.51, 46.83, 44.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5mp8w1353923944.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,] 45.500 44.930 44.480 44.36 44.320 44.390 NA [2,] 45.530 44.985 44.715 44.40 44.460 44.415 NA [3,] 45.875 45.380 44.890 44.42 44.705 44.455 NA [4,] 45.930 45.450 45.005 44.53 44.810 44.490 NA [5,] 45.930 45.510 45.110 44.58 44.970 44.500 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 45.69256 45.16791 44.75773 44.36071 44.54536 44.42079 NA [2,] 46.05744 45.59209 45.02227 44.47929 44.86464 44.48921 NA $out [1] 46.83 44.79 44.79 $group [1] 1 4 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(45.5, 45.53, 45.875, 45.93, 45.93, 44.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/61ukk1353923944.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.4236390 1.100 0.35500 [2,] 0.4391686 1.135 0.44875 [3,] 0.5296579 1.440 0.60750 [4,] 0.5834890 1.500 0.82750 [5,] 0.6175894 1.540 0.90250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.4638325 1.273521 0.4347496 [2,] 0.5954834 1.606479 0.7802504 $out [1] 0.9602847 2.5100000 $group [1] 1 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.423638997260639, 0.439168649185002, 0.529657921240106, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ichr1353923944.ps tmp/1ichr1353923944.png",intern=TRUE)) character(0) > try(system("convert tmp/20qkz1353923944.ps tmp/20qkz1353923944.png",intern=TRUE)) character(0) > try(system("convert tmp/385gg1353923944.ps tmp/385gg1353923944.png",intern=TRUE)) character(0) > try(system("convert tmp/4e3zf1353923944.ps tmp/4e3zf1353923944.png",intern=TRUE)) character(0) > try(system("convert tmp/5mp8w1353923944.ps tmp/5mp8w1353923944.png",intern=TRUE)) character(0) > try(system("convert tmp/61ukk1353923944.ps tmp/61ukk1353923944.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.214 0.691 3.924