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(102.89,102.64,103.33,103.56,103.6,104.24,105.31,105.4,105.89,105.89,105.54,106.15,106.14,105.85,106.27,106.51,106.82,106.53,107.14,107.39,107.33,107.53,107.42,108.25,108.26,108.93,109.43,109.61,109.74,110.12,110.16,110.44,111.23,112.86,112.77,113.04,112.79,113.87,114.28,115.51,116.76,116.91,116.47,116.94,117.24,116.82,117.48,117.11,117.31,117.77,118.37,117.91,118.12,118.02,117.77,117.85,118.68,118.9,118.6,118.21,118.37,117.43,117.5,116.71,116.98,117.74,117.44,117.85,118.54,118.73,118.68,118.19) > 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,] 102.89 106.14 108.26 112.79 117.31 118.37 NA [2,] 102.64 105.85 108.93 113.87 117.77 117.43 NA [3,] 103.33 106.27 109.43 114.28 118.37 117.50 NA [4,] 103.56 106.51 109.61 115.51 117.91 116.71 NA [5,] 103.60 106.82 109.74 116.76 118.12 116.98 NA [6,] 104.24 106.53 110.12 116.91 118.02 117.74 NA [7,] 105.31 107.14 110.16 116.47 117.77 117.44 NA [8,] 105.40 107.39 110.44 116.94 117.85 117.85 NA [9,] 105.89 107.33 111.23 117.24 118.68 118.54 NA [10,] 105.89 107.53 112.86 116.82 118.90 118.73 NA [11,] 105.54 107.42 112.77 117.48 118.60 118.68 NA [12,] 106.15 108.25 113.04 117.11 118.21 118.19 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/1aiqd1358252946.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/2q53z1358252946.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/3oqd81358252946.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/41sks1358252946.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,] 102.890 102.64 103.330 103.56 103.60 104.240 105.310 105.40 105.890 105.89 [2,] 106.140 105.85 106.270 106.51 106.82 106.530 107.140 107.39 107.330 107.53 [3,] 110.525 111.40 111.855 112.56 113.25 113.515 113.315 113.69 114.235 114.84 [4,] 117.310 117.43 117.500 116.71 116.98 117.740 117.440 117.85 118.540 118.73 [5,] 118.370 117.77 118.370 117.91 118.12 118.020 117.770 117.85 118.680 118.90 [,11] [,12] [1,] 105.540 106.150 [2,] 107.420 108.250 [3,] 115.125 115.075 [4,] 118.600 118.190 [5,] 118.680 118.210 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 103.32 103.9305 104.6113 105.9807 106.6965 106.2842 106.6712 106.943 [2,] 117.73 118.8695 119.0987 119.1393 119.8035 120.7458 119.9588 120.437 [,9] [,10] [,11] [,12] [1,] 107.0042 107.6156 107.9135 108.6634 [2,] 121.4658 122.0644 122.3365 121.4866 $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(102.89, 106.14, 110.525, 117.31, 118.37, 102.64, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5j90h1358252946.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,] 102.640 105.850 108.26 112.790 117.310 116.710 NA [2,] 103.445 106.390 109.52 114.895 117.810 117.435 NA [3,] 104.775 106.980 110.14 116.790 118.070 117.795 NA [4,] 105.715 107.405 112.00 117.025 118.485 118.455 NA [5,] 106.150 108.250 113.04 117.480 118.900 118.730 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 103.7396 106.5171 109.0089 115.8185 117.7621 117.3298 NA [2,] 105.8104 107.4429 111.2711 117.7615 118.3779 118.2602 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(102.64, 103.445, 104.775, 105.715, 106.15, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/62ztk1358252946.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,] 5.272731 12.060 9.12500 [2,] 5.648646 12.625 9.33875 [3,] 5.875297 13.460 9.49000 [4,] 6.137724 14.780 9.77250 [5,] 6.262135 15.480 10.10500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 5.652225 12.47709 9.292164 [2,] 6.098368 14.44291 9.687836 $out [1] 8.4725 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(5.27273142371832, 5.64864637139798, 5.87529654452321, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1aiqd1358252946.ps tmp/1aiqd1358252946.png",intern=TRUE)) character(0) > try(system("convert tmp/2q53z1358252946.ps tmp/2q53z1358252946.png",intern=TRUE)) character(0) > try(system("convert tmp/3oqd81358252946.ps tmp/3oqd81358252946.png",intern=TRUE)) character(0) > try(system("convert tmp/41sks1358252946.ps tmp/41sks1358252946.png",intern=TRUE)) character(0) > try(system("convert tmp/5j90h1358252946.ps tmp/5j90h1358252946.png",intern=TRUE)) character(0) > try(system("convert tmp/62ztk1358252946.ps tmp/62ztk1358252946.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.300 0.644 3.965