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(4.53,4.53,4.53,4.61,4.63,4.63,4.63,4.63,4.63,4.63,4.63,4.63,4.63,4.63,4.66,4.7,4.72,4.73,4.73,4.74,4.74,4.74,4.76,4.88,4.88,4.88,4.88,4.89,4.97,4.97,4.97,4.97,4.97,4.97,4.97,4.97,4.97,4.97,4.97,4.98,5,5.03,5.04,5.04,5.05,5.05,5.05,5.06,5.06,5.06,5.07,5.09,5.18,5.23,5.25,5.26,5.28,5.29,5.29,5.29,5.29,5.3,5.3,5.3,5.32,5.33,5.33,5.37,5.45,5.47,5.5,5.51) > 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,] 4.53 4.63 4.88 4.97 5.06 5.29 NA [2,] 4.53 4.63 4.88 4.97 5.06 5.30 NA [3,] 4.53 4.66 4.88 4.97 5.07 5.30 NA [4,] 4.61 4.70 4.89 4.98 5.09 5.30 NA [5,] 4.63 4.72 4.97 5.00 5.18 5.32 NA [6,] 4.63 4.73 4.97 5.03 5.23 5.33 NA [7,] 4.63 4.73 4.97 5.04 5.25 5.33 NA [8,] 4.63 4.74 4.97 5.04 5.26 5.37 NA [9,] 4.63 4.74 4.97 5.05 5.28 5.45 NA [10,] 4.63 4.74 4.97 5.05 5.29 5.47 NA [11,] 4.63 4.76 4.97 5.05 5.29 5.50 NA [12,] 4.63 4.88 4.97 5.06 5.29 5.51 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/1do7r1416609160.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/2le1v1416609160.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/3vof91416609160.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/4krx61416609160.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,] 4.530 4.530 4.530 4.610 4.630 4.63 4.630 4.630 4.63 4.63 4.63 4.630 [2,] 4.630 4.630 4.660 4.700 4.720 4.73 4.730 4.740 4.74 4.74 4.76 4.880 [3,] 4.925 4.925 4.925 4.935 4.985 5.00 5.005 5.005 5.01 5.01 5.01 5.015 [4,] 5.060 5.060 5.070 5.090 5.180 5.23 5.250 5.260 5.28 5.29 5.29 5.290 [5,] 5.290 5.300 5.300 5.300 5.320 5.33 5.330 5.370 5.45 5.47 5.50 5.510 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 4.647636 4.647636 4.660537 4.683437 4.688285 4.677484 4.669583 4.669583 [2,] 5.202364 5.202364 5.189463 5.186563 5.281715 5.322516 5.340417 5.340417 [,9] [,10] [,11] [,12] [1,] 4.661683 4.655232 4.668133 4.750537 [2,] 5.358317 5.364768 5.351867 5.279463 $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(4.53, 4.63, 4.925, 5.06, 5.29, 4.53, 4.63, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/58bua1416609160.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,] 4.53 4.63 4.880 4.970 5.060 5.29 NA [2,] 4.57 4.68 4.885 4.975 5.080 5.30 NA [3,] 4.63 4.73 4.970 5.035 5.240 5.33 NA [4,] 4.63 4.74 4.970 5.050 5.285 5.46 NA [5,] 4.63 4.76 4.970 5.060 5.290 5.51 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 4.602634 4.702634 4.931231 5.000792 5.146498 5.257023 NA [2,] 4.657366 4.757366 5.008769 5.069208 5.333502 5.402977 NA $out [1] 4.88 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(4.53, 4.57, 4.63, 4.63, 4.63, 4.63, 4.68, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6whm71416609160.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.2537256 0.690 0.31500 [2,] 0.2748776 0.700 0.33750 [3,] 0.2816138 0.765 0.37125 [4,] 0.3109863 0.830 0.41250 [5,] 0.3241399 0.880 0.43250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2651443 0.7057061 0.337042 [2,] 0.2980832 0.8242939 0.405458 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.253725573536974, 0.274877608067852, 0.281613755744182, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1do7r1416609160.ps tmp/1do7r1416609160.png",intern=TRUE)) character(0) > try(system("convert tmp/2le1v1416609160.ps tmp/2le1v1416609160.png",intern=TRUE)) character(0) > try(system("convert tmp/3vof91416609160.ps tmp/3vof91416609160.png",intern=TRUE)) character(0) > try(system("convert tmp/4krx61416609160.ps tmp/4krx61416609160.png",intern=TRUE)) character(0) > try(system("convert tmp/58bua1416609160.ps tmp/58bua1416609160.png",intern=TRUE)) character(0) > try(system("convert tmp/6whm71416609160.ps tmp/6whm71416609160.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.105 0.376 2.505