R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C) 2015 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(99.1,98.9,98.8,98.8,99.2,99.6,100.5,100.6,100.7,101,101.3,101.5,102.3,103,102.9,103.5,103.8,103.6,103.4,103.4,103.3,103.2,103.2,103.5,104.5,105.7,106.5,107,106.7,107.1,106.1,106.2,106.5,106.8,107,107.2,107.8,107.9,107.9,108.2,108.9,109.1,109.3,109.8,109.8,109.9,109.9,109.9,108.8,108.5,108.8,108.8,108.8,108.9,108.8,108.4,107.7,107.3,107,107.7) > 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,] 99.1 102.3 104.5 107.8 108.8 NA [2,] 98.9 103.0 105.7 107.9 108.5 NA [3,] 98.8 102.9 106.5 107.9 108.8 NA [4,] 98.8 103.5 107.0 108.2 108.8 NA [5,] 99.2 103.8 106.7 108.9 108.8 NA [6,] 99.6 103.6 107.1 109.1 108.9 NA [7,] 100.5 103.4 106.1 109.3 108.8 NA [8,] 100.6 103.4 106.2 109.8 108.4 NA [9,] 100.7 103.3 106.5 109.8 107.7 NA [10,] 101.0 103.2 106.8 109.9 107.3 NA [11,] 101.3 103.2 107.0 109.9 107.0 NA [12,] 101.5 103.5 107.2 109.9 107.7 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/1c1f31451472029.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/2b6h01451472029.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/39rmk1451472029.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/4qzfi1451472029.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,] 99.1 98.9 98.8 98.8 99.2 99.6 100.5 100.6 100.7 101.0 101.3 101.5 [2,] 102.3 103.0 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 103.5 [3,] 104.5 105.7 106.5 107.0 106.7 107.1 106.1 106.2 106.5 106.8 107.0 107.2 [4,] 107.8 107.9 107.9 108.2 108.8 108.9 108.8 108.4 107.7 107.3 107.0 107.7 [5,] 108.8 108.5 108.8 108.8 108.9 109.1 109.3 109.8 109.8 109.9 109.9 109.9 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 100.6137 102.2377 102.967 103.679 103.167 103.355 102.2844 102.667 103.391 [2,] 108.3863 109.1623 110.033 110.321 110.233 110.845 109.9156 109.733 109.609 [,10] [,11] [,12] [1,] 103.903 104.3149 104.2323 [2,] 109.697 109.6851 110.1677 $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(99.1, 102.3, 104.5, 107.8, 108.8, 98.9, 103, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5t6wd1451472029.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,] 98.80 102.90 105.70 107.80 107.00 NA [2,] 99.00 103.10 106.15 108.05 107.70 NA [3,] 100.05 103.35 106.60 109.20 108.65 NA [4,] 100.85 103.50 107.00 109.85 108.80 NA [5,] 101.50 103.80 107.20 109.90 108.90 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.2062 103.1676 106.2123 108.379 108.1483 NA [2,] 100.8938 103.5324 106.9877 110.021 109.1517 NA $out [1] 102.3 104.5 $group [1] 2 3 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(98.8, 99, 100.05, 100.85, 101.5, 102.9, 103.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6cjns1451472029.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.392344 8.40 3.80 [2,] 3.568570 8.85 4.30 [3,] 3.835980 9.35 4.95 [4,] 4.059522 9.70 5.15 [5,] 4.154275 10.00 5.50 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.612054 8.962309 4.562309 [2,] 4.059906 9.737691 5.337691 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.39234432214656, 3.56856998058358, 3.83598001175133, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1c1f31451472029.ps tmp/1c1f31451472029.png",intern=TRUE)) character(0) > try(system("convert tmp/2b6h01451472029.ps tmp/2b6h01451472029.png",intern=TRUE)) character(0) > try(system("convert tmp/39rmk1451472029.ps tmp/39rmk1451472029.png",intern=TRUE)) character(0) > try(system("convert tmp/4qzfi1451472029.ps tmp/4qzfi1451472029.png",intern=TRUE)) character(0) > try(system("convert tmp/5t6wd1451472029.ps tmp/5t6wd1451472029.png",intern=TRUE)) character(0) > try(system("convert tmp/6cjns1451472029.ps tmp/6cjns1451472029.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.216 0.426 2.665