R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(101.16,101.16,101.16,101.16,101.16,101.16,101.16,101.16,101.16,101.21,101.21,101.21,103.16,103.16,103.16,103.16,101.13,101.13,100.53,100.53,100.53,100.53,100.53,100.53,100.53,100.53,100.53,99.42,99.42,99.42,99.42,100.31,100.31,102.25,102.25,102.25,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.81,101.94,101.94,101.94,101.94,101.94,102,102,102,102,102,102,102,102,102,102,102,102,109.67,109.67,109.67,109.67,109.67,109.67,109.67,109.67,109.67,109.67,109.67,109.67) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 101.16 103.16 100.53 101.81 101.81 102 109.67 NA [2,] 101.16 103.16 100.53 101.81 101.81 102 109.67 NA [3,] 101.16 103.16 100.53 101.81 101.81 102 109.67 NA [4,] 101.16 103.16 99.42 101.81 101.81 102 109.67 NA [5,] 101.16 101.13 99.42 101.81 101.81 102 109.67 NA [6,] 101.16 101.13 99.42 101.81 101.81 102 109.67 NA [7,] 101.16 100.53 99.42 101.81 101.81 102 109.67 NA [8,] 101.16 100.53 100.31 101.81 101.94 102 109.67 NA [9,] 101.16 100.53 100.31 101.81 101.94 102 109.67 NA [10,] 101.21 100.53 102.25 101.81 101.94 102 109.67 NA [11,] 101.21 100.53 102.25 101.81 101.94 102 109.67 NA [12,] 101.21 100.53 102.25 101.81 101.94 102 109.67 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/1l77l1386254159.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/2ncz61386254159.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/3ikpw1386254159.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/4aho31386254159.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] [1,] 100.530 100.530 100.530 101.160 101.130 101.130 99.420 100.310 100.310 [2,] 101.485 101.485 101.485 101.485 101.145 101.145 100.845 100.845 100.845 [3,] 101.810 101.810 101.810 101.810 101.810 101.810 101.810 101.810 101.810 [4,] 102.580 102.580 102.580 102.580 101.905 101.905 101.905 101.970 101.970 [5,] 103.160 103.160 103.160 103.160 102.000 102.000 102.000 102.000 102.000 [,10] [,11] [,12] [1,] 101.210 101.210 101.210 [2,] 101.510 101.510 101.510 [3,] 101.940 101.940 101.940 [4,] 102.125 102.125 102.125 [5,] 102.250 102.250 102.250 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 101.1561 101.1561 101.1561 101.1561 101.3561 101.3561 101.177 101.1382 [2,] 102.4639 102.4639 102.4639 102.4639 102.2639 102.2639 102.443 102.4818 [,9] [,10] [,11] [,12] [1,] 101.1382 101.5727 101.5727 101.5727 [2,] 102.4818 102.3073 102.3073 102.3073 $out [1] 109.67 109.67 109.67 99.42 109.67 99.42 109.67 99.42 109.67 109.67 [11] 109.67 109.67 100.53 109.67 100.53 109.67 100.53 109.67 $group [1] 1 2 3 4 4 5 5 6 6 7 8 9 10 10 11 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(100.53, 101.485, 101.81, 102.58, 103.16, 100.53, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/54dmn1386254159.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] [,8] [1,] 101.160 100.53 99.42 101.81 101.81 102 109.67 NA [2,] 101.160 100.53 99.42 101.81 101.81 102 109.67 NA [3,] 101.160 100.83 100.42 101.81 101.81 102 109.67 NA [4,] 101.185 103.16 101.39 101.81 101.94 102 109.67 NA [5,] 101.210 103.16 102.25 101.81 101.94 102 109.67 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 101.1486 99.63044 99.52147 101.81 101.7507 102 109.67 NA [2,] 101.1714 102.02956 101.31853 101.81 101.8693 102 109.67 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(101.16, 101.16, 101.16, 101.185, 101.21, 100.53, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6izzn1386254159.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,] 3.096636 9.14 0.6150 [2,] 3.099226 9.14 0.6875 [3,] 3.170067 9.25 1.0775 [4,] 3.287891 10.25 1.0950 [5,] 3.356614 10.25 1.1250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.084016 8.743722 0.8916365 [2,] 3.256119 9.756278 1.2633635 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.09663642406679, 3.09922578043142, 3.17006740344476, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1l77l1386254159.ps tmp/1l77l1386254159.png",intern=TRUE)) character(0) > try(system("convert tmp/2ncz61386254159.ps tmp/2ncz61386254159.png",intern=TRUE)) character(0) > try(system("convert tmp/3ikpw1386254159.ps tmp/3ikpw1386254159.png",intern=TRUE)) character(0) > try(system("convert tmp/4aho31386254159.ps tmp/4aho31386254159.png",intern=TRUE)) character(0) > try(system("convert tmp/54dmn1386254159.ps tmp/54dmn1386254159.png",intern=TRUE)) character(0) > try(system("convert tmp/6izzn1386254159.ps tmp/6izzn1386254159.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.832 1.104 5.894