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(48.74,48.79,48.82,48.82,49.20,49.30,49.30,49.34,49.47,49.65,49.70,49.75,49.75,49.70,50.09,50.19,50.53,50.55,50.55,50.55,50.58,50.61,50.94,51.01,51.01,51.04,51.15,51.31,51.31,51.34,51.34,51.34,51.47,51.95,51.97,51.92,51.92,51.91,51.97,52.14,52.33,52.40,52.40,52.41,52.71,53.17,53.33,53.32,53.32,53.30,53.31,53.72,53.87,53.91,53.91,53.96,54.02,54.33,54.48,54.54,52.40,52.45,52.38,52.45,52.83,52.76,52.86,52.88,53.32,53.20,53.22,53.22) > 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,] 48.74 49.75 51.01 51.92 53.32 52.40 NA [2,] 48.79 49.70 51.04 51.91 53.30 52.45 NA [3,] 48.82 50.09 51.15 51.97 53.31 52.38 NA [4,] 48.82 50.19 51.31 52.14 53.72 52.45 NA [5,] 49.20 50.53 51.31 52.33 53.87 52.83 NA [6,] 49.30 50.55 51.34 52.40 53.91 52.76 NA [7,] 49.30 50.55 51.34 52.40 53.91 52.86 NA [8,] 49.34 50.55 51.34 52.41 53.96 52.88 NA [9,] 49.47 50.58 51.47 52.71 54.02 53.32 NA [10,] 49.65 50.61 51.95 53.17 54.33 53.20 NA [11,] 49.70 50.94 51.97 53.33 54.48 53.22 NA [12,] 49.75 51.01 51.92 53.32 54.54 53.22 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/1qw041416595874.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/2xxdx1416595874.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/3hc3a1416595874.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/47hk61416595874.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,] 48.740 48.790 48.82 48.820 49.20 49.30 49.30 49.340 49.47 49.65 49.700 [2,] 49.750 49.700 50.09 50.190 50.53 50.55 50.55 50.550 50.58 50.61 50.940 [3,] 51.465 51.475 51.56 51.725 51.82 51.87 51.87 51.875 52.09 52.56 52.595 [4,] 52.400 52.450 52.38 52.450 52.83 52.76 52.86 52.880 53.32 53.20 53.330 [5,] 53.320 53.300 53.31 53.720 53.87 53.91 53.91 53.960 54.02 54.33 54.480 [,12] [1,] 49.75 [2,] 51.01 [3,] 52.57 [4,] 53.32 [5,] 54.54 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 49.75566 49.70116 50.08288 50.26723 50.33643 50.44448 50.37998 50.37207 [2,] 53.17434 53.24884 53.03712 53.18277 53.30357 53.29552 53.36002 53.37793 [,9] [,10] [,11] [,12] [1,] 50.32261 50.88937 51.05337 51.07998 [2,] 53.85739 54.23063 54.13663 54.06002 $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(48.74, 49.75, 51.465, 52.4, 53.32, 48.79, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5aitv1416595874.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,] 48.74 49.700 51.010 51.910 53.300 52.380 NA [2,] 48.82 50.140 51.230 52.055 53.520 52.450 NA [3,] 49.30 50.550 51.340 52.400 53.910 52.845 NA [4,] 49.56 50.595 51.695 52.940 54.175 53.210 NA [5,] 49.75 51.010 51.970 53.330 54.540 53.320 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 48.96248 50.34247 51.12791 51.99635 53.61125 52.49836 NA [2,] 49.63752 50.75753 51.55209 52.80365 54.20875 53.19164 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(48.74, 48.82, 49.3, 49.56, 49.75, 49.7, 50.14, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6hgu81416595874.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.630419 4.490 1.90250 [2,] 1.671532 4.565 1.95125 [3,] 1.708878 4.615 2.03625 [4,] 1.742624 4.730 2.23125 [5,] 1.763909 4.900 2.36500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.676452 4.539742 1.90854 [2,] 1.741303 4.690258 2.16396 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.63041916900737, 1.67153228252091, 1.70887757332413, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qw041416595874.ps tmp/1qw041416595874.png",intern=TRUE)) character(0) > try(system("convert tmp/2xxdx1416595874.ps tmp/2xxdx1416595874.png",intern=TRUE)) character(0) > try(system("convert tmp/3hc3a1416595874.ps tmp/3hc3a1416595874.png",intern=TRUE)) character(0) > try(system("convert tmp/47hk61416595874.ps tmp/47hk61416595874.png",intern=TRUE)) character(0) > try(system("convert tmp/5aitv1416595874.ps tmp/5aitv1416595874.png",intern=TRUE)) character(0) > try(system("convert tmp/6hgu81416595874.ps tmp/6hgu81416595874.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.132 0.322 2.489