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(31.5,31.29,31.3,31.06,31.09,31.11,31.13,31.1,31.03,30.74,30.83,30.82,30.8,30.74,30.71,30.58,30.71,30.7,30.7,30.72,30.68,30.78,30.84,30.8,30.8,30.88,30.87,30.92,30.82,30.75,30.75,30.75,30.63,30.52,30.58,30.6,30.6,30.63,30.56,30.61,30.53,30.6,30.6,30.63,30.66,30.34,30.32,30.3,30.3,30.08,29.96,29.91,29.83,29.89,29.85,30.06,29.83,29.95,30.02,30.03,30.03,29.96,29.85,30.12,29.91,29.9,29.92,29.89,29.96,29.72,29.6,29.54) > 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,] 31.50 30.80 30.80 30.60 30.30 30.03 NA [2,] 31.29 30.74 30.88 30.63 30.08 29.96 NA [3,] 31.30 30.71 30.87 30.56 29.96 29.85 NA [4,] 31.06 30.58 30.92 30.61 29.91 30.12 NA [5,] 31.09 30.71 30.82 30.53 29.83 29.91 NA [6,] 31.11 30.70 30.75 30.60 29.89 29.90 NA [7,] 31.13 30.70 30.75 30.60 29.85 29.92 NA [8,] 31.10 30.72 30.75 30.63 30.06 29.89 NA [9,] 31.03 30.68 30.63 30.66 29.83 29.96 NA [10,] 30.74 30.78 30.52 30.34 29.95 29.72 NA [11,] 30.83 30.84 30.58 30.32 30.02 29.60 NA [12,] 30.82 30.80 30.60 30.30 30.03 29.54 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/fisher/rcomp/tmp/18bwp1354880422.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/fisher/rcomp/tmp/29r7s1354880422.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/fisher/rcomp/tmp/36nvp1354880422.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/fisher/rcomp/tmp/4ho551354880422.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,] 30.03 29.960 29.850 29.910 29.83 29.89 29.85 29.890 29.830 29.72 29.60 [2,] 30.30 30.080 29.960 30.120 29.91 29.90 29.92 30.060 29.960 29.95 30.02 [3,] 30.70 30.685 30.635 30.595 30.62 30.65 30.65 30.675 30.645 30.43 30.45 [4,] 30.80 30.880 30.870 30.920 30.82 30.75 30.75 30.750 30.680 30.74 30.83 [5,] 31.50 31.290 31.300 31.060 31.09 31.11 31.13 31.100 31.030 30.78 30.84 [,12] [1,] 29.54 [2,] 30.03 [3,] 30.45 [4,] 30.80 [5,] 30.82 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 30.37748 30.16897 30.04802 30.07897 30.03302 30.10172 30.11462 30.22993 [2,] 31.02252 31.20103 31.22198 31.11103 31.20698 31.19828 31.18538 31.12007 [,9] [,10] [,11] [,12] [1,] 30.18058 29.92042 29.92752 29.95333 [2,] 31.10942 30.93958 30.97248 30.94667 $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(30.03, 30.3, 30.7, 30.8, 31.5, 29.96, 30.08, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/55ren1354880422.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,] 30.740 30.580 30.520 30.300 29.830 29.540 NA [2,] 30.930 30.700 30.615 30.435 29.870 29.785 NA [3,] 31.095 30.715 30.750 30.600 29.955 29.905 NA [4,] 31.210 30.790 30.845 30.620 30.045 29.960 NA [5,] 31.500 30.840 30.920 30.660 30.300 30.120 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 30.96729 30.67395 30.6451 30.51562 29.87518 29.82518 NA [2,] 31.22271 30.75605 30.8549 30.68438 30.03482 29.98482 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(30.74, 30.93, 31.095, 31.21, 31.5, 30.58, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6r5jy1354880422.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,] 0.4295308 1.060 0.5400 [2,] 0.4624414 1.205 0.5775 [3,] 0.4962934 1.250 0.6425 [4,] 0.5041788 1.305 0.6675 [5,] 0.5528622 1.450 0.7275 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.4772567 1.204389 0.6014504 [2,] 0.5153302 1.295611 0.6835496 $out [1] 1.470 0.425 $group [1] 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.429530751712455, 0.462441386748191, 0.496293423974124, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/18bwp1354880422.ps tmp/18bwp1354880422.png",intern=TRUE)) character(0) > try(system("convert tmp/29r7s1354880422.ps tmp/29r7s1354880422.png",intern=TRUE)) character(0) > try(system("convert tmp/36nvp1354880422.ps tmp/36nvp1354880422.png",intern=TRUE)) character(0) > try(system("convert tmp/4ho551354880422.ps tmp/4ho551354880422.png",intern=TRUE)) character(0) > try(system("convert tmp/55ren1354880422.ps tmp/55ren1354880422.png",intern=TRUE)) character(0) > try(system("convert tmp/6r5jy1354880422.ps tmp/6r5jy1354880422.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.145 0.800 3.932