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(33.7,34.59,35.1,35.87,37.15,37.61,37.97,38.94,39.18,39.49,39.86,40.02,40.2,40.85,41.45,41.7,41.92,41.97,42.31,42.61,42.82,43.07,43.51,43.57,43.86,44.49,45.99,48.22,49.46,50.39,50.4,50.59,51.32,51.86,52.47,52.73,52.73,53.59,54.11,54.8,55.72,56.06,56.66,57.05,57.31,57.89,58.32,58.72,59.02,59.54,61.49,62.26,63.49,64.36,65.93,66.82,68.85,71.27,72.27,73.4,73.58,74.84,75.74,77.81,78.74,79.06,79.48,81.19,85.11,86.64,88.48,89.2) > 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,] 33.70 40.20 43.86 52.73 59.02 73.58 NA [2,] 34.59 40.85 44.49 53.59 59.54 74.84 NA [3,] 35.10 41.45 45.99 54.11 61.49 75.74 NA [4,] 35.87 41.70 48.22 54.80 62.26 77.81 NA [5,] 37.15 41.92 49.46 55.72 63.49 78.74 NA [6,] 37.61 41.97 50.39 56.06 64.36 79.06 NA [7,] 37.97 42.31 50.40 56.66 65.93 79.48 NA [8,] 38.94 42.61 50.59 57.05 66.82 81.19 NA [9,] 39.18 42.82 51.32 57.31 68.85 85.11 NA [10,] 39.49 43.07 51.86 57.89 71.27 86.64 NA [11,] 39.86 43.51 52.47 58.32 72.27 88.48 NA [12,] 40.02 43.57 52.73 58.72 73.40 89.20 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/17o1y1356563194.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/2e4bj1356563194.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/3t8331356563194.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/4bobx1356563194.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,] 33.700 34.59 35.10 35.87 37.15 37.610 37.97 38.94 39.180 39.490 39.860 [2,] 40.200 40.85 41.45 41.70 41.92 41.970 42.31 42.61 42.820 43.070 43.510 [3,] 48.295 49.04 50.05 51.51 52.59 53.225 53.53 53.82 54.315 54.875 55.395 [4,] 59.020 59.54 61.49 62.26 63.49 64.360 65.93 66.82 68.850 71.270 72.270 [5,] 73.580 74.84 75.74 77.81 78.74 79.060 79.48 81.19 85.110 86.640 88.480 [,12] [1,] 40.020 [2,] 43.570 [3,] 55.725 [4,] 73.400 [5,] 89.200 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 36.15549 36.98435 37.12355 38.24814 38.67665 38.78273 38.29434 38.20377 [2,] 60.43451 61.09565 62.97645 64.77186 66.50335 67.66727 68.76566 69.43623 [,9] [,10] [,11] [,12] [1,] 37.52481 36.68509 36.84387 36.48369 [2,] 71.10519 73.06491 73.94613 74.96631 $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(33.7, 40.2, 48.295, 59.02, 73.58, 34.59, 40.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ej9y1356563194.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,] 33.700 40.200 43.860 52.730 59.020 73.580 NA [2,] 35.485 41.575 47.105 54.455 61.875 76.775 NA [3,] 37.790 42.140 50.395 56.360 65.145 79.270 NA [4,] 39.335 42.945 51.590 57.600 70.060 85.875 NA [5,] 40.020 43.570 52.730 58.720 73.400 89.200 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 36.03399 41.51513 48.34936 54.92554 61.41177 75.11943 NA [2,] 39.54601 42.76487 52.44064 57.79446 68.87823 83.42057 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(33.7, 35.485, 37.79, 39.335, 40.02, 40.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6qz051356563194.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,] 14.44069 39.880 16.29250 [2,] 14.95828 41.045 17.06250 [3,] 15.34065 41.765 18.74500 [4,] 17.54446 46.540 21.83875 [5,] 18.73450 49.180 23.87000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 14.16107 39.25869 16.56652 [2,] 16.52022 44.27131 20.92348 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(14.4406921579265, 14.9582849714655, 15.3406453139597, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17o1y1356563194.ps tmp/17o1y1356563194.png",intern=TRUE)) character(0) > try(system("convert tmp/2e4bj1356563194.ps tmp/2e4bj1356563194.png",intern=TRUE)) character(0) > try(system("convert tmp/3t8331356563194.ps tmp/3t8331356563194.png",intern=TRUE)) character(0) > try(system("convert tmp/4bobx1356563194.ps tmp/4bobx1356563194.png",intern=TRUE)) character(0) > try(system("convert tmp/5ej9y1356563194.ps tmp/5ej9y1356563194.png",intern=TRUE)) character(0) > try(system("convert tmp/6qz051356563194.ps tmp/6qz051356563194.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.924 0.423 3.411