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(23.15,23.18,23.32,23.37,23.43,23.65,23.76,23.81,23.85,23.83,23.85,23.71,23.74,23.87,24.13,24.23,24.27,24.41,24.39,24.34,24.31,24.34,24.41,24.39,24.54,24.9,25.63,26.7,27.12,27.68,27.84,27.84,27.77,27.8,27.82,27.72,27.87,27.83,28.07,28.05,28.15,28.3,28.41,28.43,28.43,28.29,28.19,27.53,27.92,27.98,27.92,27.89,27.95,28.02,27.97,27.81,27.78,27.56,27.52,27.18,27.18,27.26,27.38,27.31,27.43,27.4,27.32,27.31,27.34,27.3,27.3,26.94) > 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,] 23.15 23.74 24.54 27.87 27.92 27.18 NA [2,] 23.18 23.87 24.90 27.83 27.98 27.26 NA [3,] 23.32 24.13 25.63 28.07 27.92 27.38 NA [4,] 23.37 24.23 26.70 28.05 27.89 27.31 NA [5,] 23.43 24.27 27.12 28.15 27.95 27.43 NA [6,] 23.65 24.41 27.68 28.30 28.02 27.40 NA [7,] 23.76 24.39 27.84 28.41 27.97 27.32 NA [8,] 23.81 24.34 27.84 28.43 27.81 27.31 NA [9,] 23.85 24.31 27.77 28.43 27.78 27.34 NA [10,] 23.83 24.34 27.80 28.29 27.56 27.30 NA [11,] 23.85 24.41 27.82 28.19 27.52 27.30 NA [12,] 23.71 24.39 27.72 27.53 27.18 26.94 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/13g551353927299.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/2cyva1353927299.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/3ri041353927299.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/47f2b1353927299.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,] 23.15 23.18 23.320 23.370 23.430 23.65 23.76 23.81 23.850 23.83 23.85 [2,] 23.74 23.87 24.130 24.230 24.270 24.41 24.39 24.34 24.310 24.34 24.41 [3,] 25.86 26.08 26.505 27.005 27.275 27.54 27.58 27.56 27.555 27.43 27.41 [4,] 27.87 27.83 27.920 27.890 27.950 28.02 27.97 27.84 27.780 27.80 27.82 [5,] 27.92 27.98 28.070 28.050 28.150 28.30 28.41 28.43 28.430 28.29 28.19 [,12] [1,] 23.71 [2,] 24.39 [3,] 27.06 [4,] 27.53 [5,] 27.72 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 23.19602 23.52567 24.06033 24.64418 24.90128 25.21143 25.27078 25.30239 [2,] 28.52398 28.63433 28.94967 29.36582 29.64872 29.86857 29.88922 29.81761 [,9] [,10] [,11] [,12] [1,] 25.31674 25.19819 25.21044 25.0346 [2,] 29.79326 29.66181 29.60956 29.0854 $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(23.15, 23.74, 25.86, 27.87, 27.92, 23.18, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/55q4z1353927299.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,] 23.150 23.870 24.540 27.530 27.520 27.18 NA [2,] 23.345 24.180 26.165 27.960 27.670 27.28 NA [3,] 23.680 24.325 27.700 28.170 27.905 27.31 NA [4,] 23.820 24.390 27.810 28.355 27.960 27.36 NA [5,] 23.850 24.410 27.840 28.430 28.020 27.43 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 23.46335 24.22922 26.9497 27.98984 27.77273 27.27351 NA [2,] 23.89665 24.42078 28.4503 28.35016 28.03727 27.34649 NA $out [1] 23.74 27.18 26.94 $group [1] 2 5 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(23.15, 23.345, 23.68, 23.82, 23.85, 23.87, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6t5761353927299.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,] 1.879795 4.340 2.41500 [2,] 1.946922 4.520 2.68500 [3,] 1.997551 4.650 2.79625 [4,] 2.026313 4.735 3.08875 [5,] 2.116418 4.800 3.56000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.961340 4.551937 2.612097 [2,] 2.033761 4.748063 2.980403 $out [1] 2.168443 1.735013 4.010000 3.757500 $group [1] 1 1 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.87979520161107, 1.94692174114279, 1.99755072072517, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/13g551353927299.ps tmp/13g551353927299.png",intern=TRUE)) character(0) > try(system("convert tmp/2cyva1353927299.ps tmp/2cyva1353927299.png",intern=TRUE)) character(0) > try(system("convert tmp/3ri041353927299.ps tmp/3ri041353927299.png",intern=TRUE)) character(0) > try(system("convert tmp/47f2b1353927299.ps tmp/47f2b1353927299.png",intern=TRUE)) character(0) > try(system("convert tmp/55q4z1353927299.ps tmp/55q4z1353927299.png",intern=TRUE)) character(0) > try(system("convert tmp/6t5761353927299.ps tmp/6t5761353927299.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.349 1.022 6.708