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(51.02,51.06,50.9,51.23,51.29,51.3,51.3,51.3,51.46,51.47,51.77,51.82,51.82,51.84,51.9,51.94,52.22,52.27,52.27,52.28,52.53,52.73,52.72,52.67,52.67,52.65,52.69,52.73,52.84,52.83,52.83,52.84,52.82,53.09,53.4,53.43,53.43,53.42,53.6,53.69,54.05,54.04,54.04,54.08,54.05,54.39,54.38,54.46,54.46,54.69,54.91,55.52,56.01,56.07,56.07,56.09,56.29,56.45,56.87,56.87,56.87,56.87,56.8,56.89,57.01,57.03,57.03,57.03,57.06,57.25,57.24,57.31) > 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] 72 > (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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 51.02 51.82 52.67 53.43 54.46 56.87 NA [2,] 51.06 51.84 52.65 53.42 54.69 56.87 NA [3,] 50.90 51.90 52.69 53.60 54.91 56.80 NA [4,] 51.23 51.94 52.73 53.69 55.52 56.89 NA [5,] 51.29 52.22 52.84 54.05 56.01 57.01 NA [6,] 51.30 52.27 52.83 54.04 56.07 57.03 NA [7,] 51.30 52.27 52.83 54.04 56.07 57.03 NA [8,] 51.30 52.28 52.84 54.08 56.09 57.03 NA [9,] 51.46 52.53 52.82 54.05 56.29 57.06 NA [10,] 51.47 52.73 53.09 54.39 56.45 57.25 NA [11,] 51.77 52.72 53.40 54.38 56.87 57.24 NA [12,] 51.82 52.67 53.43 54.46 56.87 57.31 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/1w5nq1386256251.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/2w54f1386256251.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/3fsnu1386256251.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/4tn171386256251.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,] 51.02 51.060 50.900 51.23 51.290 51.300 51.300 51.30 51.460 51.47 51.77 [2,] 51.82 51.840 51.900 51.94 52.220 52.270 52.270 52.28 52.530 52.73 52.72 [3,] 53.05 53.035 53.145 53.21 53.445 53.435 53.435 53.46 53.435 53.74 53.89 [4,] 54.46 54.690 54.910 55.52 56.010 56.070 56.070 56.09 56.290 56.45 56.87 [5,] 56.87 56.870 56.800 56.89 57.010 57.030 57.030 57.03 57.060 57.25 57.24 [,12] [1,] 51.820 [2,] 52.670 [3,] 53.945 [4,] 56.870 [5,] 57.310 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 51.34711 51.19666 51.20345 50.90078 51.00033 50.98388 50.98388 51.00243 [2,] 54.75289 54.87334 55.08655 55.51922 55.88967 55.88612 55.88612 55.91757 [,9] [,10] [,11] [,12] [1,] 51.00968 51.34048 51.21312 51.23586 [2,] 55.86032 56.13952 56.56688 56.65414 $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(51.02, 51.82, 53.05, 54.46, 56.87, 51.06, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5hinc1386256251.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,] 50.900 51.82 52.650 53.420 54.460 56.80 NA [2,] 51.145 51.92 52.710 53.645 55.215 56.88 NA [3,] 51.300 52.27 52.830 54.045 56.070 57.03 NA [4,] 51.465 52.60 52.965 54.230 56.370 57.15 NA [5,] 51.820 52.73 53.090 54.460 56.870 57.31 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 51.15405 51.95985 52.71369 53.77818 55.5432 56.90685 NA [2,] 51.44595 52.58015 52.94631 54.31182 56.5968 57.15315 NA $out [1] 53.40 53.43 $group [1] 3 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(50.9, 51.145, 51.3, 51.465, 51.82, 51.82, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6pu241386256251.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,] 2.090755 5.470 2.17000 [2,] 2.155823 5.630 2.70500 [3,] 2.231835 5.730 3.13625 [4,] 2.240742 5.795 3.16000 [5,] 2.246847 5.900 3.40750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.193103 5.654742 2.928721 [2,] 2.270567 5.805258 3.343779 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.09075504702647, 2.15582301038177, 2.23183482042981, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1w5nq1386256251.ps tmp/1w5nq1386256251.png",intern=TRUE)) character(0) > try(system("convert tmp/2w54f1386256251.ps tmp/2w54f1386256251.png",intern=TRUE)) character(0) > try(system("convert tmp/3fsnu1386256251.ps tmp/3fsnu1386256251.png",intern=TRUE)) character(0) > try(system("convert tmp/4tn171386256251.ps tmp/4tn171386256251.png",intern=TRUE)) character(0) > try(system("convert tmp/5hinc1386256251.ps tmp/5hinc1386256251.png",intern=TRUE)) character(0) > try(system("convert tmp/6pu241386256251.ps tmp/6pu241386256251.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.352 1.172 6.555