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(369.82,373.1,374.55,375.01,374.81,375.31,375.31,375.39,375.59,376.26,377.18,377.26,377.26,381.87,387.09,387.14,388.78,389.16,389.16,389.42,389.49,388.97,388.97,389.09,389.09,391.76,390.96,391.76,392.8,393.06,393.06,393.26,393.87,394.47,394.57,394.57,394.57,399.57,406.13,407.03,409.46,409.9,409.9,410.14,410.54,410.69,410.79,410.97,410.97,413.8,423.31,423.85,426.6,426.26,426.26,426.32,427.14,427.55,428.29,428.8) > 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,] 369.82 377.26 389.09 394.57 410.97 NA [2,] 373.10 381.87 391.76 399.57 413.80 NA [3,] 374.55 387.09 390.96 406.13 423.31 NA [4,] 375.01 387.14 391.76 407.03 423.85 NA [5,] 374.81 388.78 392.80 409.46 426.60 NA [6,] 375.31 389.16 393.06 409.90 426.26 NA [7,] 375.31 389.16 393.06 409.90 426.26 NA [8,] 375.39 389.42 393.26 410.14 426.32 NA [9,] 375.59 389.49 393.87 410.54 427.14 NA [10,] 376.26 388.97 394.47 410.69 427.55 NA [11,] 377.18 388.97 394.57 410.79 428.29 NA [12,] 377.26 389.09 394.57 410.97 428.80 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/15r411335529037.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/2pcyz1335529037.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/3h8kp1335529037.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/425411335529037.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,] 369.82 373.10 374.55 375.01 374.81 375.31 375.31 375.39 375.59 376.26 [2,] 377.26 381.87 387.09 387.14 388.78 389.16 389.16 389.42 389.49 388.97 [3,] 389.09 391.76 390.96 391.76 392.80 393.06 393.06 393.26 393.87 394.47 [4,] 394.57 399.57 406.13 407.03 409.46 409.90 409.90 410.14 410.54 410.69 [5,] 410.97 413.80 423.31 423.85 426.60 426.26 426.26 426.32 427.14 427.55 [,11] [,12] [1,] 377.18 377.26 [2,] 388.97 389.09 [3,] 394.57 394.57 [4,] 410.79 410.97 [5,] 428.29 428.80 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 376.8588 379.2532 377.5064 377.7058 378.1876 378.4052 378.4052 378.6193 [2,] 401.3212 404.2668 404.4136 405.8142 407.4124 407.7148 407.7148 407.9007 [,9] [,10] [,11] [,12] [1,] 378.9961 379.1227 379.152 379.1096 [2,] 408.7439 409.8173 409.988 410.0304 $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(369.82, 377.26, 389.09, 394.57, 410.97, 373.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5kgc01335529037.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,] 373.100 387.090 389.09 406.130 423.310 NA [2,] 374.680 387.115 391.76 406.580 423.580 NA [3,] 375.310 388.970 393.06 409.900 426.290 NA [4,] 375.925 389.160 394.17 410.615 427.345 NA [5,] 377.260 389.490 394.57 410.970 428.800 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 374.7421 388.0373 391.9608 408.0596 424.5728 NA [2,] 375.8779 389.9027 394.1592 411.7404 428.0072 NA $out [1] 369.82 377.26 381.87 394.57 399.57 410.97 413.80 $group [1] 1 2 2 4 4 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(373.1, 374.68, 375.31, 375.925, 377.26, 387.09, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6k0w91335529037.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,] 18.79171 48.760 17.310 [2,] 18.84887 48.800 19.465 [3,] 19.71611 50.950 20.730 [4,] 19.93089 51.415 21.385 [5,] 20.09544 51.790 21.880 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 19.22259 49.75728 19.85428 [2,] 20.20963 52.14272 21.60572 $out [1] 15.94717 15.75141 41.15000 40.70000 $group [1] 1 1 2 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(18.7917061492564, 18.8488680698559, 19.7161081352279, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15r411335529037.ps tmp/15r411335529037.png",intern=TRUE)) character(0) > try(system("convert tmp/2pcyz1335529037.ps tmp/2pcyz1335529037.png",intern=TRUE)) character(0) > try(system("convert tmp/3h8kp1335529037.ps tmp/3h8kp1335529037.png",intern=TRUE)) character(0) > try(system("convert tmp/425411335529037.ps tmp/425411335529037.png",intern=TRUE)) character(0) > try(system("convert tmp/5kgc01335529037.ps tmp/5kgc01335529037.png",intern=TRUE)) character(0) > try(system("convert tmp/6k0w91335529037.ps tmp/6k0w91335529037.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.430 0.331 1.762