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(106.68,109.73,108.06,111.33,105.66,103.65,100.34,100.56,102.67,101.5,102.35,104.98,106.31,103.73,106.62,108.54,105.12,105.29,104.62,104.34,108.23,107.6,106.87,107.96,108.34,109.04,106.95,105.59,108.08,108.48,106.84,105.6,106.9,106.84,106.81,106.98,107.53,107.37,106.98,108.94,106.38,109.02,106.53,105.02,109.7,108.39,110.18,109.54,109.1,110.85,112.23,110.58,110.77,108.08,108.05,108.87,109.61,111.27,107.61,110.98,106.63,106.83,108.77,106.12,106.8,106.34,105.16,107.97,106.76,108.78,105.58,109.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,] 106.68 106.31 108.34 107.53 109.10 106.63 NA [2,] 109.73 103.73 109.04 107.37 110.85 106.83 NA [3,] 108.06 106.62 106.95 106.98 112.23 108.77 NA [4,] 111.33 108.54 105.59 108.94 110.58 106.12 NA [5,] 105.66 105.12 108.08 106.38 110.77 106.80 NA [6,] 103.65 105.29 108.48 109.02 108.08 106.34 NA [7,] 100.34 104.62 106.84 106.53 108.05 105.16 NA [8,] 100.56 104.34 105.60 105.02 108.87 107.97 NA [9,] 102.67 108.23 106.90 109.70 109.61 106.76 NA [10,] 101.50 107.60 106.84 108.39 111.27 108.78 NA [11,] 102.35 106.87 106.81 110.18 107.61 105.58 NA [12,] 104.98 107.96 106.98 109.54 110.98 109.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/1r2n51354455530.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/2q0p81354455530.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/3b0a41354455530.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/49fau1354455530.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,] 106.310 103.730 106.62 105.59 105.12 103.65 104.620 100.56 102.670 106.840 [2,] 106.630 106.830 106.95 106.12 105.66 105.29 104.620 104.34 106.760 106.840 [3,] 107.105 108.205 107.52 108.74 106.59 107.21 105.845 105.31 107.565 107.995 [4,] 108.340 109.730 108.77 110.58 108.08 108.48 106.840 107.97 109.610 108.780 [5,] 109.100 110.850 108.77 111.33 110.77 109.02 108.050 108.87 109.700 111.270 [,11] [,12] [1,] 105.58 104.98 [2,] 105.58 106.98 [3,] 106.84 108.59 [4,] 107.61 109.54 [5,] 110.18 110.98 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 106.002 106.3344 106.346 105.8632 105.029 105.1523 104.413 102.9685 [2,] 108.208 110.0756 108.694 111.6168 108.151 109.2677 107.277 107.6515 [,9] [,10] [,11] [,12] [1,] 105.7267 106.7436 105.5306 106.9387 [2,] 109.4033 109.2464 108.1494 110.2413 $out [1] 112.23 100.34 101.50 102.35 $group [1] 3 7 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(106.31, 106.63, 107.105, 108.34, 109.1, 103.73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5g2zj1354455530.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,] 100.340 103.730 105.590 105.020 107.610 105.16 NA [2,] 101.925 104.870 106.825 106.755 108.475 106.23 NA [3,] 104.315 106.465 106.925 107.960 110.095 106.78 NA [4,] 107.370 107.780 108.210 109.280 110.915 108.37 NA [5,] 111.330 108.540 109.040 110.180 112.230 109.22 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 101.8315 105.1377 106.2933 106.8083 108.9821 105.8039 NA [2,] 106.7985 107.7923 107.5567 109.1117 111.2079 107.7561 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(100.34, 101.925, 104.315, 107.37, 111.33, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/64i6l1354455530.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,] 2.050578 2.790 1.49500 [2,] 2.095399 5.630 1.64375 [3,] 2.422693 6.515 2.12125 [4,] 2.652219 7.770 2.71000 [5,] 3.256530 9.770 3.44500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.168723 5.538932 1.634926 [2,] 2.676662 7.491068 2.607574 $out [1] 1.103076 $group [1] 1 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.0505779673058, 2.0953988744843, 2.42269290496853, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1r2n51354455530.ps tmp/1r2n51354455530.png",intern=TRUE)) character(0) > try(system("convert tmp/2q0p81354455530.ps tmp/2q0p81354455530.png",intern=TRUE)) character(0) > try(system("convert tmp/3b0a41354455530.ps tmp/3b0a41354455530.png",intern=TRUE)) character(0) > try(system("convert tmp/49fau1354455530.ps tmp/49fau1354455530.png",intern=TRUE)) character(0) > try(system("convert tmp/5g2zj1354455530.ps tmp/5g2zj1354455530.png",intern=TRUE)) character(0) > try(system("convert tmp/64i6l1354455530.ps tmp/64i6l1354455530.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.100 0.681 3.801