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(39.66,40.05,39.99,40.06,40.08,40.1,40.1,40.12,40.07,40.24,40.58,40.72,40.72,40.89,40.9,41.04,41.27,41.29,41.29,41.33,41.34,41.37,41.33,41.37,41.37,41.42,41.61,41.58,41.75,41.75,41.75,41.85,41.84,41.97,42.01,42.04,42.04,42.06,41.93,41.93,41.99,42.03,42.03,42.12,42.22,42.21,42.23,42.22,42.22,42.25,42.27,42.16,42.24,42.26,42.26,42.26,42.36,42.33,42.23,42.23,40.9,40.9,40.87,40.69,40.92,41.05,41.36,41.79,41.82,41.8,41.87,41.87) > 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,] 39.66 40.72 41.37 42.04 42.22 40.90 NA [2,] 40.05 40.89 41.42 42.06 42.25 40.90 NA [3,] 39.99 40.90 41.61 41.93 42.27 40.87 NA [4,] 40.06 41.04 41.58 41.93 42.16 40.69 NA [5,] 40.08 41.27 41.75 41.99 42.24 40.92 NA [6,] 40.10 41.29 41.75 42.03 42.26 41.05 NA [7,] 40.10 41.29 41.75 42.03 42.26 41.36 NA [8,] 40.12 41.33 41.85 42.12 42.26 41.79 NA [9,] 40.07 41.34 41.84 42.22 42.36 41.82 NA [10,] 40.24 41.37 41.97 42.21 42.33 41.80 NA [11,] 40.58 41.33 42.01 42.23 42.23 41.87 NA [12,] 40.72 41.37 42.04 42.22 42.23 41.87 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/146cb1416498093.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/2oodo1416498093.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/3b0sj1416498093.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/4av7u1416498093.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,] 39.660 40.05 39.990 40.06 40.08 40.10 41.290 41.33 40.07 40.240 40.58 [2,] 40.720 40.89 40.870 40.69 40.92 41.05 41.290 41.33 41.34 41.370 41.33 [3,] 41.135 41.16 41.255 41.31 41.51 41.52 41.555 41.82 41.83 41.885 41.94 [4,] 42.040 42.06 41.930 41.93 41.99 42.03 42.030 42.12 42.22 42.210 42.23 [5,] 42.220 42.25 42.270 42.16 42.24 42.26 42.260 42.26 42.36 42.330 42.23 [,12] [1,] 40.720 [2,] 41.370 [3,] 41.955 [4,] 42.220 [5,] 42.230 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 40.28356 40.40531 40.57127 40.51016 40.81982 40.88787 41.07768 41.31042 [2,] 41.98644 41.91469 41.93873 42.10984 42.20018 42.15213 42.03232 42.32958 [,9] [,10] [,11] [,12] [1,] 41.26237 41.34317 41.35947 41.40672 [2,] 42.39763 42.42683 42.52053 42.50328 $out [1] 40.10 40.12 $group [1] 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(39.66, 40.72, 41.135, 42.04, 42.22, 40.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5a08v1416498093.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,] 39.990 40.720 41.370 41.930 42.220 40.690 NA [2,] 40.055 40.970 41.595 42.010 42.230 40.900 NA [3,] 40.090 41.290 41.750 42.050 42.255 41.205 NA [4,] 40.180 41.335 41.910 42.215 42.265 41.810 NA [5,] 40.240 41.370 42.040 42.230 42.270 41.870 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 40.03299 41.12352 41.60633 41.9565 42.23904 40.78994 NA [2,] 40.14701 41.45648 41.89367 42.1435 42.27096 41.62006 NA $out [1] 39.66 40.58 40.72 42.16 42.36 42.33 $group [1] 1 1 1 5 5 5 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(39.99, 40.055, 40.09, 40.18, 40.24, 40.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6t2wd1416498093.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,] 0.7664659 2.090 0.60750 [2,] 0.7684169 2.095 0.66875 [3,] 0.7902170 2.160 0.78000 [4,] 0.8277683 2.240 0.99000 [5,] 0.8349950 2.290 1.10750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.7631465 2.093865 0.6334757 [2,] 0.8172876 2.226135 0.9265243 $out [1] 0.9437037 0.6446213 0.5923991 2.5600000 1.6500000 1.5100000 $group [1] 1 1 1 2 2 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.766465915745768, 0.768416896617306, 0.790217030606352, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/146cb1416498093.ps tmp/146cb1416498093.png",intern=TRUE)) character(0) > try(system("convert tmp/2oodo1416498093.ps tmp/2oodo1416498093.png",intern=TRUE)) character(0) > try(system("convert tmp/3b0sj1416498093.ps tmp/3b0sj1416498093.png",intern=TRUE)) character(0) > try(system("convert tmp/4av7u1416498093.ps tmp/4av7u1416498093.png",intern=TRUE)) character(0) > try(system("convert tmp/5a08v1416498093.ps tmp/5a08v1416498093.png",intern=TRUE)) character(0) > try(system("convert tmp/6t2wd1416498093.ps tmp/6t2wd1416498093.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.062 0.379 2.479