R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(65,96,66,55,36,63,49,59,89,33,65,62,63,69,84,46,54,83,34,87,55,47,77,38,73,64,75,81,133,107,43,50,27,34,52,29,48,37,64,48,38,39,52,66,67,58,40,31,101,82,72,46,45,62,64,29,57,71,46,71,56,75,78,76,53,43,52,93,52,67,58,52) > 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,] 65 63 73 48 101 56 NA [2,] 96 69 64 37 82 75 NA [3,] 66 84 75 64 72 78 NA [4,] 55 46 81 48 46 76 NA [5,] 36 54 133 38 45 53 NA [6,] 63 83 107 39 62 43 NA [7,] 49 34 43 52 64 52 NA [8,] 59 87 50 66 29 93 NA [9,] 89 55 27 67 57 52 NA [10,] 33 47 34 58 71 67 NA [11,] 65 77 52 40 46 58 NA [12,] 62 38 29 31 71 52 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/1ur7t1426084796.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/2f9941426084796.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/337bo1426084796.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/4z7nf1426084796.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] [,12] [1,] 48 37 64.0 46.0 36 39.0 34.0 29.0 52 33.0 40 29 [2,] 56 64 66.0 46.0 38 43.0 43.0 50.0 52 34.0 46 31 [3,] 64 72 73.5 51.5 49 62.5 50.5 62.5 56 52.5 55 45 [4,] 73 82 78.0 76.0 54 83.0 52.0 87.0 67 67.0 65 62 [5,] 73 96 84.0 81.0 54 107.0 64.0 93.0 89 71.0 77 71 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 53.03445 60.38942 65.75961 32.14903 38.67948 36.69871 44.69471 38.6338 [2,] 74.96555 83.61058 81.24039 70.85097 59.32052 88.30129 56.30529 86.3662 [,9] [,10] [,11] [,12] [1,] 46.32452 31.21393 42.74439 25.004 [2,] 65.67548 73.78607 67.25561 64.996 $out [1] 101 133 27 $group [1] 1 5 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(48, 56, 64, 73, 73, 37, 64, 72, 82, 96, 64, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5wyad1426084796.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,] 33.0 34.0 27.0 31.0 29.0 43.0 NA [2,] 52.0 46.5 38.5 38.5 46.0 52.0 NA [3,] 62.5 59.0 58.0 48.0 63.0 57.0 NA [4,] 65.5 80.0 78.0 61.0 71.5 75.5 NA [5,] 66.0 87.0 133.0 67.0 101.0 93.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 56.34256 43.72043 39.98378 37.7376 51.36928 46.28149 NA [2,] 68.65744 74.27957 76.01622 58.2624 74.63072 67.71851 NA $out [1] 96 89 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(33, 52, 62.5, 65.5, 66, 34, 46.5, 59, 80, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6kqyj1426084796.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,] 7.494442 20.0 7.500 [2,] 14.595515 36.0 12.500 [3,] 17.818175 47.5 15.375 [4,] 21.995689 63.0 27.125 [5,] 25.506208 97.0 30.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 14.44291 35.18512 8.704439 [2,] 21.19344 59.81488 22.045561 $out [1] 36.60282 $group [1] 1 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(7.4944423853057, 14.5955153878611, 17.8181749977323, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ur7t1426084796.ps tmp/1ur7t1426084796.png",intern=TRUE)) character(0) > try(system("convert tmp/2f9941426084796.ps tmp/2f9941426084796.png",intern=TRUE)) character(0) > try(system("convert tmp/337bo1426084796.ps tmp/337bo1426084796.png",intern=TRUE)) character(0) > try(system("convert tmp/4z7nf1426084796.ps tmp/4z7nf1426084796.png",intern=TRUE)) character(0) > try(system("convert tmp/5wyad1426084796.ps tmp/5wyad1426084796.png",intern=TRUE)) character(0) > try(system("convert tmp/6kqyj1426084796.ps tmp/6kqyj1426084796.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.102 0.352 2.482