R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(16.41,16.38,16.12,16.03,16.02,16.01,16.01,15.94,15.88,15.75,15.8,15.84,15.84,15.79,15.79,15.75,15.63,15.63,15.63,15.62,15.59,15.55,15.61,15.58,15.58,15.64,15.56,15.57,15.46,15.5,15.5,15.58,15.69,15.78,15.8,15.79,15.79,15.79,15.75,15.71,15.76,15.76,15.76,15.76,15.78,15.84,15.82,15.86,15.86,15.87,15.84,15.84,15.89,15.89,15.89,15.91,15.95,16.08,16.08,16.09) > 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,] 16.41 15.84 15.58 15.79 15.86 NA [2,] 16.38 15.79 15.64 15.79 15.87 NA [3,] 16.12 15.79 15.56 15.75 15.84 NA [4,] 16.03 15.75 15.57 15.71 15.84 NA [5,] 16.02 15.63 15.46 15.76 15.89 NA [6,] 16.01 15.63 15.50 15.76 15.89 NA [7,] 16.01 15.63 15.50 15.76 15.89 NA [8,] 15.94 15.62 15.58 15.76 15.91 NA [9,] 15.88 15.59 15.69 15.78 15.95 NA [10,] 15.75 15.55 15.78 15.84 16.08 NA [11,] 15.80 15.61 15.80 15.82 16.08 NA [12,] 15.84 15.58 15.79 15.86 16.09 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/1dpg91335864983.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/26fnw1335864983.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/3ehte1335864983.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/49s0c1335864983.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,] 15.79 15.79 15.75 15.57 15.46 15.50 15.50 15.58 15.59 15.75 15.80 15.79 [2,] 15.79 15.79 15.75 15.71 15.63 15.63 15.63 15.62 15.69 15.75 15.80 15.79 [3,] 15.84 15.79 15.79 15.75 15.76 15.76 15.76 15.76 15.78 15.78 15.80 15.84 [4,] 15.86 15.87 15.84 15.84 15.89 15.89 15.89 15.91 15.88 15.84 15.82 15.86 [5,] 15.86 15.87 15.84 16.03 16.02 16.01 16.01 15.94 15.95 15.84 15.82 15.86 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 15.79054 15.73347 15.72641 15.65814 15.57628 15.57628 15.57628 15.55509 [2,] 15.88946 15.84653 15.85359 15.84186 15.94372 15.94372 15.94372 15.96491 [,9] [,10] [,11] [,12] [1,] 15.64575 15.71641 15.78587 15.79054 [2,] 15.91425 15.84359 15.81413 15.88946 $out [1] 16.41 15.58 16.38 15.64 16.12 15.56 15.55 16.08 15.61 16.08 15.58 16.09 $group [1] 1 1 2 2 3 3 10 10 11 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(15.79, 15.79, 15.84, 15.86, 15.86, 15.79, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5pia41335864983.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,] 15.750 15.55 15.460 15.710 15.840 NA [2,] 15.860 15.60 15.530 15.760 15.865 NA [3,] 16.010 15.63 15.580 15.770 15.890 NA [4,] 16.075 15.77 15.735 15.805 16.015 NA [5,] 16.380 15.84 15.800 15.860 16.090 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 15.91194 15.55246 15.4865 15.74948 15.82158 NA [2,] 16.10806 15.70754 15.6735 15.79052 15.95842 NA $out [1] 16.41 $group [1] 1 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(15.75, 15.86, 16.01, 16.075, 16.38, 15.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jo4f1335864983.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.1441180 0.360 0.020 [2,] 0.1689920 0.465 0.075 [3,] 0.1964100 0.510 0.110 [4,] 0.2104870 0.560 0.260 [5,] 0.2185635 0.560 0.290 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.1774839 0.4666699 0.02562026 [2,] 0.2153362 0.5533301 0.19437974 $out [1] 0.3081071 0.2841303 0.8300000 0.7400000 $group [1] 1 1 2 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.144118007202431, 0.16899202709465, 0.196410029989295, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1dpg91335864983.ps tmp/1dpg91335864983.png",intern=TRUE)) character(0) > try(system("convert tmp/26fnw1335864983.ps tmp/26fnw1335864983.png",intern=TRUE)) character(0) > try(system("convert tmp/3ehte1335864983.ps tmp/3ehte1335864983.png",intern=TRUE)) character(0) > try(system("convert tmp/49s0c1335864983.ps tmp/49s0c1335864983.png",intern=TRUE)) character(0) > try(system("convert tmp/5pia41335864983.ps tmp/5pia41335864983.png",intern=TRUE)) character(0) > try(system("convert tmp/6jo4f1335864983.ps tmp/6jo4f1335864983.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.456 0.466 1.944