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(126.81,125.8,123.07,119.52,118.03,117.27,117.27,116.69,115.38,114.31,113.33,111.79,111.79,110.92,109.37,107.04,104.72,104.14,104.14,102.95,102.13,101.01,100.07,99.4,99.4,99.34,97.72,96.26,95.77,95.04,95.04,94.55,94,93.14,91.21,90.3,90.3,89.74,89.07,89.06,88.97,88.78,88.78,88.23,87.91,87.79,87.89,88,88,87.08,85.75,84.29,84.39,83.72,83.72,81.76,81.53,80.55,79.83,78.98,78.98,78.27,77.41,76.75,76.38,74.96,74.96,74.46,74.04,73.22,72.97,72.91) > 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,] 126.81 111.79 99.40 90.30 88.00 78.98 NA [2,] 125.80 110.92 99.34 89.74 87.08 78.27 NA [3,] 123.07 109.37 97.72 89.07 85.75 77.41 NA [4,] 119.52 107.04 96.26 89.06 84.29 76.75 NA [5,] 118.03 104.72 95.77 88.97 84.39 76.38 NA [6,] 117.27 104.14 95.04 88.78 83.72 74.96 NA [7,] 117.27 104.14 95.04 88.78 83.72 74.96 NA [8,] 116.69 102.95 94.55 88.23 81.76 74.46 NA [9,] 115.38 102.13 94.00 87.91 81.53 74.04 NA [10,] 114.31 101.01 93.14 87.79 80.55 73.22 NA [11,] 113.33 100.07 91.21 87.89 79.83 72.97 NA [12,] 111.79 99.40 90.30 88.00 78.98 72.91 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/1fhtr1353936255.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/2gazj1353936255.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/3xh1c1353936255.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/433ar1353936255.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] [1,] 78.98 78.27 77.410 76.75 76.38 74.96 74.96 74.46 74.040 73.220 [2,] 88.00 87.08 85.750 84.29 84.39 83.72 83.72 81.76 81.530 80.550 [3,] 94.85 94.54 93.395 92.66 92.37 91.91 91.91 91.39 90.955 90.465 [4,] 111.79 110.92 109.370 107.04 104.72 104.14 104.14 102.95 102.130 101.010 [5,] 126.81 125.80 123.070 119.52 118.03 117.27 117.27 116.69 115.380 114.310 [,11] [,12] [1,] 72.97 72.91 [2,] 79.83 78.98 [3,] 89.55 89.15 [4,] 100.07 99.40 [5,] 113.33 111.79 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 79.50468 79.16243 78.15934 77.98552 79.25649 78.73844 78.73844 [2,] 110.19532 109.91757 108.63066 107.33448 105.48351 105.08156 105.08156 [,8] [,9] [,10] [,11] [,12] [1,] 77.72177 77.66733 77.26764 76.49455 75.97844 [2,] 105.05823 104.24267 103.66236 102.60545 102.32156 $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(78.98, 88, 94.85, 111.79, 126.81, 78.27, 87.08, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5lajd1353936255.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,] 111.790 99.400 90.30 87.790 78.98 72.91 NA [2,] 114.845 101.570 93.57 87.955 81.04 73.63 NA [3,] 117.270 104.140 95.04 88.780 83.72 74.96 NA [4,] 121.295 108.205 96.99 89.065 85.07 77.08 NA [5,] 126.810 111.790 99.40 90.300 88.00 78.98 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 114.3281 101.1137 93.48012 88.27372 81.88189 73.38643 NA [2,] 120.2119 107.1663 96.59988 89.28628 85.55811 76.53357 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(111.79, 114.845, 117.27, 121.295, 126.81, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ox3m1353936255.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.00318 38.880 15.89000 [2,] 14.77056 41.215 16.78125 [3,] 15.10524 42.270 16.96000 [4,] 16.22592 44.215 19.37000 [5,] 17.51775 47.830 20.28000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 14.44144 40.90168 15.77925 [2,] 15.76904 43.63832 18.14075 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(14.0031796389249, 14.7705630637203, 15.1052384953035, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1fhtr1353936255.ps tmp/1fhtr1353936255.png",intern=TRUE)) character(0) > try(system("convert tmp/2gazj1353936255.ps tmp/2gazj1353936255.png",intern=TRUE)) character(0) > try(system("convert tmp/3xh1c1353936255.ps tmp/3xh1c1353936255.png",intern=TRUE)) character(0) > try(system("convert tmp/433ar1353936255.ps tmp/433ar1353936255.png",intern=TRUE)) character(0) > try(system("convert tmp/5lajd1353936255.ps tmp/5lajd1353936255.png",intern=TRUE)) character(0) > try(system("convert tmp/6ox3m1353936255.ps tmp/6ox3m1353936255.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.171 0.531 3.691