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(101.81,101.72,101.78,102.04,102.36,102.56,102.69,102.77,102.85,102.9,102.72,102.79,102.9,102.91,103.29,103.35,102.97,103.05,103.18,103.21,103.32,103.31,103.6,103.68,103.77,103.82,103.86,103.9,103.63,103.65,103.7,103.77,103.94,104.03,104.03,104.29,104.35,104.67,104.73,104.86,104.05,104.15,104.27,104.33,104.41,104.4,104.41,104.6,104.61,104.65,104.55,104.51,104.74,104.89,104.91,104.93,104.95,104.97,105.16,105.29,105.35,105.36,105.45,105.3,105.73,105.86,105.85,105.95,105.97,106.15,105.37,105.39) > 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,] 101.81 102.90 103.77 104.35 104.61 105.35 NA [2,] 101.72 102.91 103.82 104.67 104.65 105.36 NA [3,] 101.78 103.29 103.86 104.73 104.55 105.45 NA [4,] 102.04 103.35 103.90 104.86 104.51 105.30 NA [5,] 102.36 102.97 103.63 104.05 104.74 105.73 NA [6,] 102.56 103.05 103.65 104.15 104.89 105.86 NA [7,] 102.69 103.18 103.70 104.27 104.91 105.85 NA [8,] 102.77 103.21 103.77 104.33 104.93 105.95 NA [9,] 102.85 103.32 103.94 104.41 104.95 105.97 NA [10,] 102.90 103.31 104.03 104.40 104.97 106.15 NA [11,] 102.72 103.60 104.03 104.41 105.16 105.37 NA [12,] 102.79 103.68 104.29 104.60 105.29 105.39 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/1tw0r1357781681.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/2watg1357781681.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/3we511357781681.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/4i8i21357781681.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] [1,] 101.81 101.720 101.780 102.040 102.36 102.56 102.690 102.77 102.850 [2,] 102.90 102.910 103.290 103.350 102.97 103.05 103.180 103.21 103.320 [3,] 104.06 104.235 104.205 104.205 103.84 103.90 103.985 104.05 104.175 [4,] 104.61 104.670 104.730 104.860 104.74 104.89 104.910 104.93 104.950 [5,] 105.35 105.360 105.450 105.300 105.73 105.86 105.850 105.95 105.970 [,10] [,11] [,12] [1,] 102.900 102.72 102.790 [2,] 103.310 103.60 103.680 [3,] 104.215 104.22 104.445 [4,] 104.970 105.16 105.290 [5,] 106.150 105.37 105.390 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 102.957 103.0997 103.2762 103.231 102.6983 102.7131 102.8691 102.9405 [2,] 105.163 105.3703 105.1338 105.179 104.9817 105.0869 105.1009 105.1595 [,9] [,10] [,11] [,12] [1,] 103.1236 103.1442 103.2137 103.4065 [2,] 105.2264 105.2858 105.2263 105.4835 $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(101.81, 102.9, 104.06, 104.61, 105.35, 101.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5r0j81357781681.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,] 101.720 102.900 103.630 104.050 104.51 105.300 NA [2,] 101.925 103.010 103.735 104.300 104.63 105.365 NA [3,] 102.625 103.250 103.840 104.405 104.90 105.590 NA [4,] 102.780 103.335 103.985 104.635 104.96 105.905 NA [5,] 102.900 103.680 104.290 104.860 105.29 106.150 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 102.235 103.1018 103.726 104.2522 104.7495 105.3437 NA [2,] 103.015 103.3982 103.954 104.5578 105.0505 105.8363 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(101.72, 101.925, 102.625, 102.78, 102.9, 102.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/64fi11357781681.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.130876 3.120 1.25250 [2,] 1.146041 3.140 1.28500 [3,] 1.177182 3.255 1.38375 [4,] 1.245328 3.455 1.43625 [5,] 1.342665 3.670 1.52750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.131897 3.111326 1.314764 [2,] 1.222468 3.398674 1.452736 $out [1] 0.9912164 0.9912820 2.6500000 2.6000000 $group [1] 1 1 2 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.13087576682853, 1.14604101809405, 1.17718221938294, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1tw0r1357781681.ps tmp/1tw0r1357781681.png",intern=TRUE)) character(0) > try(system("convert tmp/2watg1357781681.ps tmp/2watg1357781681.png",intern=TRUE)) character(0) > try(system("convert tmp/3we511357781681.ps tmp/3we511357781681.png",intern=TRUE)) character(0) > try(system("convert tmp/4i8i21357781681.ps tmp/4i8i21357781681.png",intern=TRUE)) character(0) > try(system("convert tmp/5r0j81357781681.ps tmp/5r0j81357781681.png",intern=TRUE)) character(0) > try(system("convert tmp/64fi11357781681.ps tmp/64fi11357781681.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.450 0.574 4.181