R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(6.94,6.98,7.05,7.07,7.08,7.10,7.12,7.13,7.18,7.20,7.21,7.22,7.26,7.29,7.32,7.36,7.41,7.48,7.48,7.51,7.51,7.51,7.51,7.54,7.58,7.64,7.63,7.71,7.77,7.85,7.88,7.89,7.94,8.02,8.08,8.15,8.17,8.17,8.25,8.33,8.41,8.43,8.48,8.52,8.56,8.63,8.70,8.72,8.73,8.82,8.83,8.81,8.82,8.83,8.84,8.83,8.82,8.87,8.87,8.87,8.86,8.95,8.94,8.96,8.96,9.01,9.01,8.96,8.96,8.94,8.93,8.89) > 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,] 6.94 7.26 7.58 8.17 8.73 8.86 NA [2,] 6.98 7.29 7.64 8.17 8.82 8.95 NA [3,] 7.05 7.32 7.63 8.25 8.83 8.94 NA [4,] 7.07 7.36 7.71 8.33 8.81 8.96 NA [5,] 7.08 7.41 7.77 8.41 8.82 8.96 NA [6,] 7.10 7.48 7.85 8.43 8.83 9.01 NA [7,] 7.12 7.48 7.88 8.48 8.84 9.01 NA [8,] 7.13 7.51 7.89 8.52 8.83 8.96 NA [9,] 7.18 7.51 7.94 8.56 8.82 8.96 NA [10,] 7.20 7.51 8.02 8.63 8.87 8.94 NA [11,] 7.21 7.51 8.08 8.70 8.87 8.93 NA [12,] 7.22 7.54 8.15 8.72 8.87 8.89 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/fisher/rcomp/tmp/1067h1367007414.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/fisher/rcomp/tmp/213cp1367007414.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/fisher/rcomp/tmp/35u2j1367007414.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/fisher/rcomp/tmp/4xe4k1367007414.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,] 6.940 6.980 7.05 7.07 7.08 7.10 7.12 7.130 7.18 7.200 7.21 7.220 [2,] 7.260 7.290 7.32 7.36 7.41 7.48 7.48 7.510 7.51 7.510 7.51 7.540 [3,] 7.875 7.905 7.94 8.02 8.09 8.14 8.18 8.205 8.25 8.325 8.39 8.435 [4,] 8.730 8.820 8.83 8.81 8.82 8.83 8.84 8.830 8.82 8.870 8.87 8.870 [5,] 8.860 8.950 8.94 8.96 8.96 9.01 9.01 8.960 8.96 8.940 8.93 8.890 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.926803 6.918101 6.966001 7.084703 7.180504 7.269206 7.302756 7.353557 [2,] 8.823197 8.891899 8.913999 8.955297 8.999496 9.010794 9.057244 9.056443 [,9] [,10] [,11] [,12] [1,] 7.405008 7.447756 7.512756 7.577107 [2,] 9.094992 9.202244 9.267244 9.292893 $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(6.94, 7.26, 7.875, 8.73, 8.86, 6.98, 7.29, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/588fy1367007414.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,] 6.94 7.26 7.580 8.170 8.810 8.930 NA [2,] 7.06 7.34 7.675 8.290 8.820 8.935 NA [3,] 7.11 7.48 7.865 8.455 8.830 8.955 NA [4,] 7.19 7.51 7.980 8.595 8.855 8.960 NA [5,] 7.22 7.54 8.150 8.720 8.870 8.960 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 7.050706 7.402462 7.725887 8.315887 8.814036 8.943597 NA [2,] 7.169294 7.557538 8.004113 8.594113 8.845964 8.966403 NA $out [1] 8.73 8.86 9.01 9.01 8.89 $group [1] 5 6 6 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(6.94, 7.06, 7.11, 7.19, 7.22, 7.26, 7.34, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6k6gh1367007414.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.7194280 1.670 1.13750 [2,] 0.7341987 1.760 1.15250 [3,] 0.7629600 1.885 1.17375 [4,] 0.7841610 1.900 1.24625 [5,] 0.8092157 1.970 1.28750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.7401719 1.821145 1.13099 [2,] 0.7857481 1.948855 1.21651 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.719428013540387, 0.734198729131169, 0.762960006253766, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1067h1367007414.ps tmp/1067h1367007414.png",intern=TRUE)) character(0) > try(system("convert tmp/213cp1367007414.ps tmp/213cp1367007414.png",intern=TRUE)) character(0) > try(system("convert tmp/35u2j1367007414.ps tmp/35u2j1367007414.png",intern=TRUE)) character(0) > try(system("convert tmp/4xe4k1367007414.ps tmp/4xe4k1367007414.png",intern=TRUE)) character(0) > try(system("convert tmp/588fy1367007414.ps tmp/588fy1367007414.png",intern=TRUE)) character(0) > try(system("convert tmp/6k6gh1367007414.ps tmp/6k6gh1367007414.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.828 0.503 3.318