R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(164.88,164.88,164.57,164.53,165.03,165.92,165.92,165.92,165.92,166.12,166.34,165.48,165.61,165.61,165.94,165.88,166.23,166.32,166.43,166.43,166.2,166.21,168.02,168.68,168.65,168.65,168.75,168.8,168.58,168.98,169,169,168.94,169.96,171.59,172.41,172.65,172.65,172.65,172.38,171.95,171.95,171.87,171.87,171.91,171.99,172.15,172.73,173.2,164.97,164.97,164.43,163.16,162.98,161.69,162.19,162,162.22,164.08,164.58,164.68) > 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] 61 > (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] 6 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 164.88 165.61 168.65 172.65 173.20 164.68 [2,] 164.88 165.61 168.65 172.65 164.97 NA [3,] 164.57 165.94 168.75 172.65 164.97 NA [4,] 164.53 165.88 168.80 172.38 164.43 NA [5,] 165.03 166.23 168.58 171.95 163.16 NA [6,] 165.92 166.32 168.98 171.95 162.98 NA [7,] 165.92 166.43 169.00 171.87 161.69 NA [8,] 165.92 166.43 169.00 171.87 162.19 NA [9,] 165.92 166.20 168.94 171.91 162.00 NA [10,] 166.12 166.21 169.96 171.99 162.22 NA [11,] 166.34 168.02 171.59 172.15 164.08 NA [12,] 165.48 168.68 172.41 172.73 164.58 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/1cxge1416671506.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/2bjwn1416671506.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/3htnk1416671506.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/48qcx1416671506.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,] 164.68 164.88 164.57 164.43 163.16 162.98 161.69 162.19 162.00 162.22 [2,] 164.88 164.97 164.97 164.53 165.03 165.92 165.92 165.92 165.92 166.12 [3,] 167.13 165.61 165.94 165.88 166.23 166.32 166.43 166.43 166.20 166.21 [4,] 172.65 168.65 168.75 168.80 168.58 168.98 169.00 169.00 168.94 169.96 [5,] 173.20 172.65 172.65 172.38 171.95 171.95 171.87 171.87 171.91 171.99 [,11] [,12] [1,] 164.08 164.58 [2,] 166.34 165.48 [3,] 168.02 168.68 [4,] 171.59 172.41 [5,] 172.15 172.73 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 162.1181 163.0097 163.2691 162.8628 163.7216 164.1578 164.2537 164.2537 [2,] 172.1419 168.2103 168.6109 168.8972 168.7384 168.4822 168.6063 168.6063 [,9] [,10] [,11] [,12] [1,] 164.0661 163.4967 164.3104 163.7833 [2,] 168.3339 168.9233 171.7296 173.5767 $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(164.68, 164.88, 167.13, 172.65, 173.2, 164.88, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5j7oa1416671506.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,] 164.53 165.61 168.58 171.87 161.690 164.68 [2,] 164.88 165.91 168.70 171.93 162.205 164.68 [3,] 165.70 166.22 168.96 172.07 163.620 164.68 [4,] 165.92 166.43 169.48 172.65 164.775 164.68 [5,] 166.34 166.43 169.96 172.73 164.970 164.68 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 165.2256 165.9828 168.6042 171.7416 162.4478 164.68 [2,] 166.1744 166.4572 169.3158 172.3984 164.7922 164.68 $out [1] 168.02 168.68 171.59 172.41 173.20 $group [1] 2 2 3 3 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(164.53, 164.88, 165.7, 165.92, 166.34, 165.61, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6oai81416671506.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.338146 7.770 3.02 [2,] 3.389029 8.075 3.08 [3,] 3.527210 8.655 3.73 [4,] 3.786852 9.725 4.76 [5,] 3.875283 10.180 6.93 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.34576 7.902424 2.963741 [2,] 3.70866 9.407576 4.496259 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.33814619212521, 3.38902861573148, 3.5272102175839, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1cxge1416671506.ps tmp/1cxge1416671506.png",intern=TRUE)) character(0) > try(system("convert tmp/2bjwn1416671506.ps tmp/2bjwn1416671506.png",intern=TRUE)) character(0) > try(system("convert tmp/3htnk1416671506.ps tmp/3htnk1416671506.png",intern=TRUE)) character(0) > try(system("convert tmp/48qcx1416671506.ps tmp/48qcx1416671506.png",intern=TRUE)) character(0) > try(system("convert tmp/5j7oa1416671506.ps tmp/5j7oa1416671506.png",intern=TRUE)) character(0) > try(system("convert tmp/6oai81416671506.ps tmp/6oai81416671506.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.079 0.396 2.500