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(4.143,4.429,5.219,4.929,5.761,5.592,4.163,4.962,5.208,4.755,4.491,5.732,5.731,5.040,6.102,4.904,5.369,5.578,4.619,4.731,5.011,5.227,4.146,4.625,4.736,4.219,5.116,4.205,4.121,5.103,4.300,4.578,3.809,5.657,4.249,3.830,4.736,4.840,4.412,4.570,4.105,4.801,3.953,3.828,4.444,4.027,4.118,4.791,3.232,3.554,3.950,3.948,3.683,4.311,3.865,4.140,4.095,3.814,3.377,3.443,3.494,4.015,5.401,5.122,5.507,6.425,4.948,2.977,2.937,2.972,2.732,3.172,3.102,3.360,3.705,3.171,3.980,3.342,2.766,4.022,4.459) > 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] 81 > (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] 7 7 7 7 7 7 7 7 7 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 4.143 5.731 4.736 4.736 3.232 3.494 3.102 [2,] 4.429 5.040 4.219 4.840 3.554 4.015 3.360 [3,] 5.219 6.102 5.116 4.412 3.950 5.401 3.705 [4,] 4.929 4.904 4.205 4.570 3.948 5.122 3.171 [5,] 5.761 5.369 4.121 4.105 3.683 5.507 3.980 [6,] 5.592 5.578 5.103 4.801 4.311 6.425 3.342 [7,] 4.163 4.619 4.300 3.953 3.865 4.948 2.766 [8,] 4.962 4.731 4.578 3.828 4.140 2.977 4.022 [9,] 5.208 5.011 3.809 4.444 4.095 2.937 4.459 [10,] 4.755 5.227 5.657 4.027 3.814 2.972 NA [11,] 4.491 4.146 4.249 4.118 3.377 2.732 NA [12,] 5.732 4.625 3.830 4.791 3.443 3.172 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/1s4fq1335995972.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/2ktwc1335995972.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/3ltal1335995972.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/4o95x1335995972.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,] 3.102 3.3600 3.705 3.1710 3.6830 3.342 3.8650 2.9770 2.937 2.972 2.732 [2,] 3.363 3.7845 4.181 4.0765 4.0425 4.556 3.9090 3.9250 3.952 3.814 3.377 [3,] 4.143 4.2190 5.116 4.5700 4.1210 5.103 4.1630 4.1400 4.444 4.391 4.132 [4,] 4.736 4.6345 5.310 4.9165 5.4380 5.585 4.4595 4.6545 4.735 5.227 4.249 [5,] 5.731 5.0400 6.102 5.1220 5.7610 6.425 4.9480 4.9620 5.208 5.657 4.491 [,12] [1,] 3.1720 [2,] 3.4430 [3,] 4.2275 [4,] 4.7910 [5,] 5.7320 $n [1] 7 7 7 7 7 7 7 7 7 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.323067 3.711394 4.441779 4.068366 3.28763 4.488498 3.83425 3.704354 [2,] 4.962933 4.726606 5.790221 5.071634 4.95437 5.717502 4.49175 4.575646 [,9] [,10] [,11] [,12] [1,] 3.976405 3.479569 3.569532 3.357996 [2,] 4.911595 5.302431 4.694468 5.097004 $out [1] 2.766 $group [1] 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3.102, 3.363, 4.143, 4.736, 5.731, 3.36, 3.7845, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5207d1335995972.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,] 4.1430 4.1460 3.8090 3.8280 3.2320 2.7320 2.766 [2,] 4.4600 4.6780 4.1630 4.0660 3.4985 2.9745 3.171 [3,] 4.9455 5.0255 4.2745 4.4280 3.8395 3.7545 3.360 [4,] 5.4055 5.4735 4.9195 4.7635 4.0225 5.2615 3.980 [5,] 5.7610 6.1020 5.6570 4.8400 4.3110 6.4250 4.459 $n [1] 12 12 12 12 12 12 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 4.514251 4.662667 3.929455 4.109866 3.6005 2.711384 2.933927 [2,] 5.376749 5.388333 4.619545 4.746134 4.0785 4.797616 3.786073 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(4.143, 4.46, 4.9455, 5.4055, 5.761, 4.146, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6wfnp1335995972.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.6224520 1.6800 0.55050 [2,] 0.6773948 1.9680 0.75625 [3,] 0.8103719 2.2265 0.93950 [4,] 0.9616423 2.5945 1.22575 [5,] 0.9988132 3.0830 1.39550 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.6807246 1.940749 0.7253579 [2,] 0.9400191 2.512251 1.1536421 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.622451987056412, 0.677394753262265, 0.810371854062384, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1s4fq1335995972.ps tmp/1s4fq1335995972.png",intern=TRUE)) character(0) > try(system("convert tmp/2ktwc1335995972.ps tmp/2ktwc1335995972.png",intern=TRUE)) character(0) > try(system("convert tmp/3ltal1335995972.ps tmp/3ltal1335995972.png",intern=TRUE)) character(0) > try(system("convert tmp/4o95x1335995972.ps tmp/4o95x1335995972.png",intern=TRUE)) character(0) > try(system("convert tmp/5207d1335995972.ps tmp/5207d1335995972.png",intern=TRUE)) character(0) > try(system("convert tmp/6wfnp1335995972.ps tmp/6wfnp1335995972.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.479 0.419 2.017