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(46.56,46.72,47.01,47.26,47.49,47.51,47.52,47.66,47.71,47.87,48,48,48.05,48.25,48.72,48.94,49.16,49.18,49.25,49.34,49.49,49.57,49.63,49.67,49.7,49.8,50.09,50.49,50.73,51.12,51.15,51.41,51.61,52.06,52.17,52.18,52.19,52.74,53.05,53.38,53.78,53.82,53.88,53.96,54.14,54.2,54.35,54.36,54.39,54.77,54.91,55.06,55.38,55.41,55.47,55.58,55.67,55.97,56.03,56.06,56.08,56.43,56.65,56.96,57.37,57.51,57.61,57.7,57.91,58.12,58.18,58.16) > 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,] 46.56 48.05 49.70 52.19 54.39 56.08 NA [2,] 46.72 48.25 49.80 52.74 54.77 56.43 NA [3,] 47.01 48.72 50.09 53.05 54.91 56.65 NA [4,] 47.26 48.94 50.49 53.38 55.06 56.96 NA [5,] 47.49 49.16 50.73 53.78 55.38 57.37 NA [6,] 47.51 49.18 51.12 53.82 55.41 57.51 NA [7,] 47.52 49.25 51.15 53.88 55.47 57.61 NA [8,] 47.66 49.34 51.41 53.96 55.58 57.70 NA [9,] 47.71 49.49 51.61 54.14 55.67 57.91 NA [10,] 47.87 49.57 52.06 54.20 55.97 58.12 NA [11,] 48.00 49.63 52.17 54.35 56.03 58.18 NA [12,] 48.00 49.67 52.18 54.36 56.06 58.16 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/1yzq51358001398.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/23bgd1358001398.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/3w9as1358001398.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/4l64k1358001398.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,] 46.560 46.72 47.01 47.260 47.490 47.51 47.520 47.660 47.710 47.87 48.00 [2,] 48.050 48.25 48.72 48.940 49.160 49.18 49.250 49.340 49.490 49.57 49.63 [3,] 50.945 51.27 51.57 51.935 52.255 52.47 52.515 52.685 52.875 53.13 53.26 [4,] 54.390 54.77 54.91 55.060 55.380 55.41 55.470 55.580 55.670 55.97 56.03 [5,] 56.080 56.43 56.65 56.960 57.370 57.51 57.610 57.700 57.910 58.12 58.18 [,12] [1,] 48.00 [2,] 49.67 [3,] 53.27 [4,] 56.06 [5,] 58.16 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 46.8555 47.06439 47.57725 47.9874 48.2429 48.45145 48.5029 48.66 48.8887 [2,] 55.0345 55.47561 55.56275 55.8826 56.2671 56.48855 56.5271 56.71 56.8613 [,10] [,11] [,12] [1,] 49.00179 49.13179 49.14824 [2,] 57.25821 57.38821 57.39176 $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(46.56, 48.05, 50.945, 54.39, 56.08, 46.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5to4l1358001398.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,] 46.560 48.050 49.700 52.190 54.390 56.080 NA [2,] 47.135 48.830 50.290 53.215 54.985 56.805 NA [3,] 47.515 49.215 51.135 53.850 55.440 57.560 NA [4,] 47.790 49.530 51.835 54.170 55.820 58.015 NA [5,] 48.000 49.670 52.180 54.360 56.060 58.180 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 47.21625 48.89573 50.43032 53.41442 55.05915 57.00811 NA [2,] 47.81375 49.53427 51.83968 54.28558 55.82085 58.11189 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(46.56, 47.135, 47.515, 47.79, 48, 48.05, 48.83, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6qe4b1358001398.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,] 3.705776 9.520 5.26750 [2,] 3.780186 9.705 5.32625 [3,] 3.824796 10.020 5.34625 [4,] 3.859819 10.170 5.38000 [5,] 3.884156 10.250 5.42750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.788475 9.80791 5.321734 [2,] 3.861116 10.23209 5.370766 $out [1] 5.625 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.70577612203795, 3.78018644158673, 3.82479570072285, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1yzq51358001398.ps tmp/1yzq51358001398.png",intern=TRUE)) character(0) > try(system("convert tmp/23bgd1358001398.ps tmp/23bgd1358001398.png",intern=TRUE)) character(0) > try(system("convert tmp/3w9as1358001398.ps tmp/3w9as1358001398.png",intern=TRUE)) character(0) > try(system("convert tmp/4l64k1358001398.ps tmp/4l64k1358001398.png",intern=TRUE)) character(0) > try(system("convert tmp/5to4l1358001398.ps tmp/5to4l1358001398.png",intern=TRUE)) character(0) > try(system("convert tmp/6qe4b1358001398.ps tmp/6qe4b1358001398.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.005 0.501 3.558