R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(8.41,8.39,8.43,8.44,8.49,8.47,8.53,8.52,8.51,8.53,8.54,8.53,8.47,8.63,8.67,8.73,8.57,8.55,8.63,8.65,8.44,8.62,8.37,8.59,8.84,8.72,8.8,8.69,8.68,8.57,8.85,8.85,8.85,8.93,8.75,8.78,8.77,9.03,9.01,9.07,8.99,9.02,8.99,8.98,8.94,8.94,8.75,8.86,8.87,8.84,8.84,9.91,10.18,10.34,10.36,10.26,10.16,10.31,10.46,10.54,10.47,10.48,10.46,11.3,11.58,11.69,11.63,11.51,11.37,11.42,11.7,11.75) > 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,] 8.41 8.47 8.84 8.77 8.87 10.47 NA [2,] 8.39 8.63 8.72 9.03 8.84 10.48 NA [3,] 8.43 8.67 8.80 9.01 8.84 10.46 NA [4,] 8.44 8.73 8.69 9.07 9.91 11.30 NA [5,] 8.49 8.57 8.68 8.99 10.18 11.58 NA [6,] 8.47 8.55 8.57 9.02 10.34 11.69 NA [7,] 8.53 8.63 8.85 8.99 10.36 11.63 NA [8,] 8.52 8.65 8.85 8.98 10.26 11.51 NA [9,] 8.51 8.44 8.85 8.94 10.16 11.37 NA [10,] 8.53 8.62 8.93 8.94 10.31 11.42 NA [11,] 8.54 8.37 8.75 8.75 10.46 11.70 NA [12,] 8.53 8.59 8.78 8.86 10.54 11.75 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/1fdvo1355135107.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/2k4ca1355135107.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/3z14w1355135107.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/4c32y1355135107.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,] 8.410 8.39 8.43 8.44 8.490 8.470 8.53 8.520 8.440 8.530 8.37 8.53 [2,] 8.470 8.63 8.67 8.69 8.570 8.550 8.63 8.650 8.510 8.620 8.54 8.59 [3,] 8.805 8.78 8.82 8.90 8.835 8.795 8.92 8.915 8.895 8.935 8.75 8.82 [4,] 8.870 9.03 9.01 9.91 10.180 10.340 10.36 10.260 10.160 10.310 10.46 10.54 [5,] 8.870 9.03 9.01 11.30 11.580 11.690 11.63 11.510 11.370 11.420 11.70 11.75 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 8.546987 8.521987 8.600689 8.113061 7.796498 7.640392 7.804094 7.876498 [2,] 9.063013 9.038013 9.039311 9.686939 9.873502 9.949608 10.035906 9.953502 [,9] [,10] [,11] [,12] [1,] 7.830697 7.844895 7.511538 7.562187 [2,] 9.959303 10.025105 9.988462 10.077813 $out [1] 10.47 10.48 10.46 $group [1] 1 2 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(8.41, 8.47, 8.805, 8.87, 8.87, 8.39, 8.63, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5c7ct1355135107.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,] 8.390 8.370 8.570 8.750 8.84 10.460 NA [2,] 8.435 8.510 8.705 8.900 9.39 10.890 NA [3,] 8.500 8.605 8.790 8.985 10.22 11.465 NA [4,] 8.530 8.640 8.850 9.015 10.35 11.660 NA [5,] 8.540 8.730 8.930 9.070 10.54 11.750 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 8.45667 8.545706 8.723865 8.932548 9.782138 11.1138 NA [2,] 8.54333 8.664294 8.856135 9.037452 10.657862 11.8162 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(8.39, 8.435, 8.5, 8.53, 8.54, 8.37, 8.51, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6pv6d1355135107.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.7243963 2.030 0.26500 [2,] 0.9199833 2.475 0.66500 [3,] 1.1691422 2.960 1.26500 [4,] 1.2721505 3.160 1.38625 [5,] 1.3456807 3.330 1.48250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.008516 2.647567 0.936033 [2,] 1.329768 3.272433 1.593967 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.72439630037708, 0.919983343603703, 1.16914215305364, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1fdvo1355135107.ps tmp/1fdvo1355135107.png",intern=TRUE)) character(0) > try(system("convert tmp/2k4ca1355135107.ps tmp/2k4ca1355135107.png",intern=TRUE)) character(0) > try(system("convert tmp/3z14w1355135107.ps tmp/3z14w1355135107.png",intern=TRUE)) character(0) > try(system("convert tmp/4c32y1355135107.ps tmp/4c32y1355135107.png",intern=TRUE)) character(0) > try(system("convert tmp/5c7ct1355135107.ps tmp/5c7ct1355135107.png",intern=TRUE)) character(0) > try(system("convert tmp/6pv6d1355135107.ps tmp/6pv6d1355135107.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.769 0.629 4.384