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(15.13,15.25,15.33,15.36,15.4,15.4,15.41,15.47,15.54,15.55,15.59,15.65,15.75,15.86,15.89,15.94,15.93,15.95,15.99,15.99,16.06,16.08,16.07,16.11,16.15,16.18,16.3,16.42,16.49,16.5,16.58,16.64,16.66,16.81,16.91,16.92,16.95,17.11,17.16,17.16,17.27,17.34,17.39,17.43,17.45,17.5,17.56,17.65,17.62,17.7,17.72,17.71,17.74,17.75,17.78,17.8,17.86,17.88,17.89,17.94,17.98,18.1,18.14,18.19,18.23,18.24,18.27,18.3,18.34,18.36,18.36,18.4) > 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,] 15.13 15.75 16.15 16.95 17.62 17.98 NA [2,] 15.25 15.86 16.18 17.11 17.70 18.10 NA [3,] 15.33 15.89 16.30 17.16 17.72 18.14 NA [4,] 15.36 15.94 16.42 17.16 17.71 18.19 NA [5,] 15.40 15.93 16.49 17.27 17.74 18.23 NA [6,] 15.40 15.95 16.50 17.34 17.75 18.24 NA [7,] 15.41 15.99 16.58 17.39 17.78 18.27 NA [8,] 15.47 15.99 16.64 17.43 17.80 18.30 NA [9,] 15.54 16.06 16.66 17.45 17.86 18.34 NA [10,] 15.55 16.08 16.81 17.50 17.88 18.36 NA [11,] 15.59 16.07 16.91 17.56 17.89 18.36 NA [12,] 15.65 16.11 16.92 17.65 17.94 18.40 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/1xx311355430401.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/2scqa1355430401.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/3hyyv1355430401.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/4ja5f1355430401.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,] 15.13 15.250 15.33 15.36 15.40 15.40 15.410 15.470 15.540 15.550 15.590 [2,] 15.75 15.860 15.89 15.94 15.93 15.95 15.990 15.990 16.060 16.080 16.070 [3,] 16.55 16.645 16.73 16.79 16.88 16.92 16.985 17.035 17.055 17.155 17.235 [4,] 17.62 17.700 17.72 17.71 17.74 17.75 17.780 17.800 17.860 17.880 17.890 [5,] 17.98 18.100 18.14 18.19 18.23 18.24 18.270 18.300 18.340 18.360 18.360 [,12] [1,] 15.650 [2,] 16.110 [3,] 17.285 [4,] 17.940 [5,] 18.400 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 15.34379 15.45814 15.54959 15.64829 15.71249 15.75894 15.83039 15.86749 [2,] 17.75621 17.83186 17.91041 17.93171 18.04751 18.08106 18.13961 18.20251 [,9] [,10] [,11] [,12] [1,] 15.89394 15.99394 16.06104 16.10459 [2,] 18.21606 18.31606 18.40896 18.46541 $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(15.13, 15.75, 16.55, 17.62, 17.98, 15.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5jg7i1355430401.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,] 15.130 15.750 16.150 16.950 17.620 17.980 NA [2,] 15.345 15.910 16.360 17.160 17.715 18.165 NA [3,] 15.405 15.970 16.540 17.365 17.765 18.255 NA [4,] 15.545 16.065 16.735 17.475 17.870 18.350 NA [5,] 15.650 16.110 16.920 17.650 17.940 18.400 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 15.31378 15.8993 16.36896 17.22133 17.6943 18.17062 NA [2,] 15.49622 16.0407 16.71104 17.50867 17.8357 18.33938 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(15.13, 15.345, 15.405, 15.545, 15.65, 15.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6287c1355430401.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.076321 2.750 1.51250 [2,] 1.081708 2.805 1.53625 [3,] 1.092419 2.830 1.55375 [4,] 1.098092 2.845 1.57375 [5,] 1.114145 2.860 1.61250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.084947 2.811756 1.536646 [2,] 1.099892 2.848244 1.570854 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.07632089390974, 1.08170848634343, 1.09241914181648, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xx311355430401.ps tmp/1xx311355430401.png",intern=TRUE)) character(0) > try(system("convert tmp/2scqa1355430401.ps tmp/2scqa1355430401.png",intern=TRUE)) character(0) > try(system("convert tmp/3hyyv1355430401.ps tmp/3hyyv1355430401.png",intern=TRUE)) character(0) > try(system("convert tmp/4ja5f1355430401.ps tmp/4ja5f1355430401.png",intern=TRUE)) character(0) > try(system("convert tmp/5jg7i1355430401.ps tmp/5jg7i1355430401.png",intern=TRUE)) character(0) > try(system("convert tmp/6287c1355430401.ps tmp/6287c1355430401.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.005 0.657 3.649