R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(1.45,1.45,1.45,1.44,1.44,1.44,1.44,1.45,1.44,1.45,1.46,1.46,1.47,1.46,1.46,1.45,1.45,1.45,1.44,1.45,1.44,1.45,1.47,1.48,1.5,1.5,1.52,1.54,1.55,1.54,1.55,1.54,1.57,1.61,1.62,1.64,1.63,1.63,1.67,1.7,1.69,1.68,1.67,1.68,1.66,1.65,1.65,1.66,1.67,1.67,1.65,1.65,1.65,1.65,1.66,1.66,1.67,1.67,1.67,1.66) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1.45 1.47 1.50 1.63 1.67 NA [2,] 1.45 1.46 1.50 1.63 1.67 NA [3,] 1.45 1.46 1.52 1.67 1.65 NA [4,] 1.44 1.45 1.54 1.70 1.65 NA [5,] 1.44 1.45 1.55 1.69 1.65 NA [6,] 1.44 1.45 1.54 1.68 1.65 NA [7,] 1.44 1.44 1.55 1.67 1.66 NA [8,] 1.45 1.45 1.54 1.68 1.66 NA [9,] 1.44 1.44 1.57 1.66 1.67 NA [10,] 1.45 1.45 1.61 1.65 1.67 NA [11,] 1.46 1.47 1.62 1.65 1.67 NA [12,] 1.46 1.48 1.64 1.66 1.66 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/1tcaf1335198582.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/2ygk41335198582.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/3uid21335198582.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/4w1x31335198582.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,] 1.45 1.45 1.45 1.44 1.44 1.44 1.44 1.45 1.44 1.45 1.46 1.46 [2,] 1.47 1.46 1.46 1.45 1.45 1.45 1.44 1.45 1.44 1.45 1.47 1.48 [3,] 1.50 1.50 1.52 1.54 1.55 1.54 1.55 1.54 1.57 1.61 1.62 1.64 [4,] 1.63 1.63 1.65 1.65 1.65 1.65 1.66 1.66 1.66 1.65 1.65 1.66 [5,] 1.67 1.67 1.67 1.70 1.69 1.68 1.67 1.68 1.67 1.67 1.67 1.66 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.386944 1.379878 1.385746 1.398681 1.408681 1.398681 1.394549 1.391615 [2,] 1.613056 1.620122 1.654254 1.681319 1.691319 1.681319 1.705451 1.688385 [,9] [,10] [,11] [,12] [1,] 1.414549 1.468681 1.492812 1.512812 [2,] 1.725451 1.751319 1.747188 1.767188 $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(1.45, 1.47, 1.5, 1.63, 1.67, 1.45, 1.46, 1.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/51cil1335198582.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] [1,] 1.44 1.440 1.500 1.630 1.65 NA [2,] 1.44 1.450 1.530 1.650 1.65 NA [3,] 1.45 1.450 1.545 1.665 1.66 NA [4,] 1.45 1.465 1.590 1.680 1.67 NA [5,] 1.46 1.480 1.640 1.700 1.67 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1.445439 1.443158 1.517634 1.651317 1.650878 NA [2,] 1.454561 1.456842 1.572366 1.678683 1.669122 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(1.44, 1.44, 1.45, 1.45, 1.46, 1.44, 1.45, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ry9u1335198582.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.09939819 0.200 0.160 [2,] 0.10124224 0.220 0.180 [3,] 0.10933169 0.225 0.200 [4,] 0.11269420 0.235 0.205 [5,] 0.11674759 0.250 0.220 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.1041084 0.2181584 0.1885973 [2,] 0.1145550 0.2318416 0.2114027 $out [1] 0.26 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.0993981891183134, 0.101242235474594, 0.109331689548222, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1tcaf1335198582.ps tmp/1tcaf1335198582.png",intern=TRUE)) character(0) > try(system("convert tmp/2ygk41335198582.ps tmp/2ygk41335198582.png",intern=TRUE)) character(0) > try(system("convert tmp/3uid21335198582.ps tmp/3uid21335198582.png",intern=TRUE)) character(0) > try(system("convert tmp/4w1x31335198582.ps tmp/4w1x31335198582.png",intern=TRUE)) character(0) > try(system("convert tmp/51cil1335198582.ps tmp/51cil1335198582.png",intern=TRUE)) character(0) > try(system("convert tmp/6ry9u1335198582.ps tmp/6ry9u1335198582.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.402 0.425 1.833