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(70.38,70.38,70.29,70.42,70.29,70.59,70.64,70.64,70.68,70.78,70.9,71.04,71.15,71.15,71.15,71.07,71.17,71.24,71.23,71.23,71.23,71.24,71.28,71.52,71.52,71.52,71.6,71.61,71.78,71.66,71.86,71.86,71.82,71.8,72.22,72.51,72.56,72.56,72.78,72.88,73.05,73.02,73.08,73.08,73.24,73.82,74,74.37,74.38,74.38,74.36,74.42,74.59,75.07,75.19,75.19,75.21,75.18,75.86,75.93,76.01,73.23,73.23,73.2,73.24,73.36,73.4,73.49,73.49,73.57,73.82,74.08,74.08) > 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] 73 > (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] 7 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 70.38 71.15 71.52 72.56 74.38 76.01 74.08 [2,] 70.38 71.15 71.52 72.56 74.38 73.23 NA [3,] 70.29 71.15 71.60 72.78 74.36 73.23 NA [4,] 70.42 71.07 71.61 72.88 74.42 73.20 NA [5,] 70.29 71.17 71.78 73.05 74.59 73.24 NA [6,] 70.59 71.24 71.66 73.02 75.07 73.36 NA [7,] 70.64 71.23 71.86 73.08 75.19 73.40 NA [8,] 70.64 71.23 71.86 73.08 75.19 73.49 NA [9,] 70.68 71.23 71.82 73.24 75.21 73.49 NA [10,] 70.78 71.24 71.80 73.82 75.18 73.57 NA [11,] 70.90 71.28 72.22 74.00 75.86 73.82 NA [12,] 71.04 71.52 72.51 74.37 75.93 74.08 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/1am4y1416659912.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/2g1sw1416659912.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/3gpjh1416659912.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/4tio21416659912.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,] 70.380 70.38 70.29 70.420 70.290 70.59 70.64 70.64 70.68 70.780 70.90 [2,] 71.335 71.15 71.15 71.070 71.170 71.24 71.23 71.23 71.23 71.240 71.28 [3,] 72.560 72.04 72.19 72.245 72.415 72.34 72.47 72.47 72.53 72.685 73.02 [4,] 74.230 73.23 73.23 73.200 73.240 73.36 73.40 73.49 73.49 73.820 74.00 [5,] 76.010 74.38 74.36 74.420 74.590 75.07 75.19 75.19 75.21 75.180 75.86 [,12] [1,] 71.040 [2,] 71.520 [3,] 73.295 [4,] 74.370 [5,] 75.930 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 70.83115 70.69833 70.84833 70.87108 71.07978 70.97253 71.07028 71.01223 [2,] 74.28885 73.38167 73.53167 73.61892 73.75022 73.70747 73.86972 73.92777 [,9] [,10] [,11] [,12] [1,] 71.07223 71.02082 71.26551 71.45666 [2,] 73.98777 74.34918 74.77449 75.13334 $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(70.38, 71.335, 72.56, 74.23, 76.01, 70.38, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5xvxa1416659912.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,] 70.290 71.07 71.520 72.560 74.360 73.200 74.08 [2,] 70.380 71.15 71.605 72.830 74.400 73.235 74.08 [3,] 70.615 71.23 71.790 73.065 75.125 73.445 74.08 [4,] 70.730 71.24 71.860 73.530 75.200 73.695 74.08 [5,] 71.040 71.28 72.220 74.370 75.930 74.080 74.08 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 70.45536 71.18895 71.67369 72.74573 74.76011 73.23519 74.08 [2,] 70.77464 71.27105 71.90631 73.38427 75.48989 73.65481 74.08 $out [1] 71.52 72.51 76.01 $group [1] 2 3 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(70.29, 70.38, 70.615, 70.73, 71.04, 71.07, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6p8kb1416659912.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.471063 4.000 1.82000 [2,] 1.530160 4.185 1.89250 [3,] 1.668304 4.505 1.96625 [4,] 1.796505 4.720 2.40875 [5,] 2.028172 4.960 2.89500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.546823 4.260983 1.730785 [2,] 1.789786 4.749017 2.201715 $out [1] 5.63 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.47106310764245, 1.53015996730013, 1.66830440764144, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1am4y1416659912.ps tmp/1am4y1416659912.png",intern=TRUE)) character(0) > try(system("convert tmp/2g1sw1416659912.ps tmp/2g1sw1416659912.png",intern=TRUE)) character(0) > try(system("convert tmp/3gpjh1416659912.ps tmp/3gpjh1416659912.png",intern=TRUE)) character(0) > try(system("convert tmp/4tio21416659912.ps tmp/4tio21416659912.png",intern=TRUE)) character(0) > try(system("convert tmp/5xvxa1416659912.ps tmp/5xvxa1416659912.png",intern=TRUE)) character(0) > try(system("convert tmp/6p8kb1416659912.ps tmp/6p8kb1416659912.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.059 0.379 2.459