R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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,7,9,6,9,13,18,8,15,4,8,14,8,3,5,6,12,7,3,11,6,9,6,10,10,6,13,10,9,15,8,12,13,9,6,7,8,7,6,8,3,7,8,8,7,12,7,5,9,9,8,11,9,8,9,11,8,9,9,5) > 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,] 4 8 10 8 9 NA [2,] 7 3 6 7 9 NA [3,] 9 5 13 6 8 NA [4,] 6 6 10 8 11 NA [5,] 9 12 9 3 9 NA [6,] 13 7 15 7 8 NA [7,] 18 3 8 8 9 NA [8,] 8 11 12 8 11 NA [9,] 15 6 13 7 8 NA [10,] 4 9 9 12 9 NA [11,] 8 6 6 7 9 NA [12,] 14 10 7 5 5 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/14g9x1464537236.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/2p9mj1464537236.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/3z8dn1464537236.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/46gcu1464537236.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,] 8 6 5 6 9 7 8 8 6 9 6 5 [2,] 8 6 6 6 9 7 8 8 7 9 6 5 [3,] 8 7 8 8 9 8 8 11 8 9 7 7 [4,] 9 7 9 10 9 13 9 11 13 9 8 10 [5,] 10 7 13 11 9 15 9 12 15 9 9 14 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.293403 6.293403 5.880208 5.17361 9 3.760415 7.293403 8.880208 [2,] 8.706597 7.706597 10.119792 10.82639 9 12.239585 8.706597 13.119792 [,9] [,10] [,11] [,12] [1,] 3.760415 9 5.586805 3.467013 [2,] 12.239585 9 8.413195 10.532987 $out [1] 4 3 9 12 3 18 3 4 12 $group [1] 1 2 2 5 5 7 7 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(8, 8, 8, 9, 10, 6, 6, 7, 7, 7, 5, 6, 8, 9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5pkba1464537236.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,] 4.0 3.0 6.0 5.0 8 NA [2,] 6.5 5.5 7.5 6.5 8 NA [3,] 8.5 6.5 9.5 7.0 9 NA [4,] 13.5 9.5 12.5 8.0 9 NA [5,] 18.0 12.0 15.0 8.0 9 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5.307253 4.675573 7.219466 6.31584 8.543893 NA [2,] 11.692747 8.324427 11.780534 7.68416 9.456107 NA $out [1] 3 12 11 11 5 $group [1] 4 4 5 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(4, 6.5, 8.5, 13.5, 18, 3, 5.5, 6.5, 9.5, 12, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6lwo01464537236.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.303840 3.0 0.0 [2,] 2.235621 5.5 1.0 [3,] 2.997727 8.0 2.5 [4,] 3.787858 9.0 4.5 [5,] 5.449771 9.0 6.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.289741 6.403627 0.9036265 [2,] 3.705713 9.596373 4.0963735 $out [1] 15 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.30384048104053, 2.23562054010947, 2.99772717932854, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/14g9x1464537236.ps tmp/14g9x1464537236.png",intern=TRUE)) character(0) > try(system("convert tmp/2p9mj1464537236.ps tmp/2p9mj1464537236.png",intern=TRUE)) character(0) > try(system("convert tmp/3z8dn1464537236.ps tmp/3z8dn1464537236.png",intern=TRUE)) character(0) > try(system("convert tmp/46gcu1464537236.ps tmp/46gcu1464537236.png",intern=TRUE)) character(0) > try(system("convert tmp/5pkba1464537236.ps tmp/5pkba1464537236.png",intern=TRUE)) character(0) > try(system("convert tmp/6lwo01464537236.ps tmp/6lwo01464537236.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.032 0.328 2.382