R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(-12,-12,-8,-6,-2,4,3,5,8,5,3,6,15,12,11,12,14,18,15,16,-1,-5,-6,-5,-2,-9,-9,-12,-16,-19,-30,-26,-22,-31,-33,-31,-27,-29,-33,-27,-22,-23,-23,-15,-15,-24,-18,-14,-7,-12,-12,-15,-16,-17,-13,-8,-13,-13,-11,-16,-34,-35,-38,-32,-37,-39,-31,-30,-29,-36,-41,-42,-33,-43,-41,-34,-32,-36,-37,-30,-32,-30,-21,-19,-6,-11,-11) > 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] 87 > (np <- floor(n / par1)) [1] 7 > 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] 8 8 8 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -12 15 -2 -27 -7 -34 -33 -6 [2,] -12 12 -9 -29 -12 -35 -43 -11 [3,] -8 11 -9 -33 -12 -38 -41 -11 [4,] -6 12 -12 -27 -15 -32 -34 NA [5,] -2 14 -16 -22 -16 -37 -32 NA [6,] 4 18 -19 -23 -17 -39 -36 NA [7,] 3 15 -30 -23 -13 -31 -37 NA [8,] 5 16 -26 -15 -8 -30 -30 NA [9,] 8 -1 -22 -15 -13 -29 -32 NA [10,] 5 -5 -31 -24 -13 -36 -30 NA [11,] 3 -6 -33 -18 -11 -41 -21 NA [12,] 6 -5 -31 -14 -16 -42 -19 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/1ibst1448228589.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/29odk1448228589.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/3ja6p1448228589.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/4gqng1448228589.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,] -34.0 -43 -41.0 -34.0 -37 -39.0 -37.0 -30.0 -32.0 -36.0 -41.0 -42.0 [2,] -30.0 -32 -35.5 -29.5 -27 -29.5 -30.5 -28.0 -25.5 -30.5 -27.0 -25.0 [3,] -9.5 -12 -11.5 -15.0 -16 -19.0 -23.0 -15.0 -15.0 -24.0 -18.0 -16.0 [4,] -4.0 -10 -8.5 -9.0 -9 -6.5 -5.0 -1.5 -7.0 -9.0 -8.5 -9.5 [5,] 15.0 12 11.0 12.0 14 18.0 15.0 16.0 8.0 5.0 3.0 6.0 $n [1] 8 8 8 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -24.023973 -24.2895159 -26.582588 -27.242269 -26.74931 -32.735229 [2,] 5.023973 0.2895159 3.582588 -2.757731 -5.25069 -5.264771 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -38.228189 -30.8253725 -26.047902 -36.83945 -29.047902 -25.25635 [2,] -7.771811 0.8253725 -3.952098 -11.16055 -6.952098 -6.74365 $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(-34, -30, -9.5, -4, 15, -43, -32, -12, -10, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5cipo1448228589.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] [,8] [1,] -12 -6 -33.0 -33.0 -17.0 -42.0 -43.0 -11.0 [2,] -7 -3 -30.5 -27.0 -15.5 -38.5 -36.5 -11.0 [3,] 3 12 -20.5 -23.0 -13.0 -35.5 -32.5 -11.0 [4,] 5 15 -10.5 -16.5 -11.5 -31.5 -30.0 -8.5 [5,] 8 18 -2.0 -14.0 -7.0 -29.0 -21.0 -6.0 $n [1] 12 12 12 12 12 12 12 3 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.473281 3.790079 -29.62213 -27.78912 -14.82443 -38.69275 -35.46469 [2,] 8.473281 20.209921 -11.37787 -18.21088 -11.17557 -32.30725 -29.53531 [,8] [1,] -13.280534 [2,] -8.719466 $out [1] -19 $group [1] 7 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(-12, -7, 3, 5, 8, -6, -3, 12, 15, 18, -33, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6g4d21448228589.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,] 14.50780 40.0 15.5 [2,] 15.55429 45.0 18.5 [3,] 17.23885 48.5 21.0 [4,] 17.97394 52.0 24.5 [5,] 20.59126 57.0 26.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 16.13523 45.30725 18.26336 [2,] 18.34246 51.69275 23.73664 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(14.507797574966, 15.554294473729, 17.2388460437693, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ibst1448228589.ps tmp/1ibst1448228589.png",intern=TRUE)) character(0) > try(system("convert tmp/29odk1448228589.ps tmp/29odk1448228589.png",intern=TRUE)) character(0) > try(system("convert tmp/3ja6p1448228589.ps tmp/3ja6p1448228589.png",intern=TRUE)) character(0) > try(system("convert tmp/4gqng1448228589.ps tmp/4gqng1448228589.png",intern=TRUE)) character(0) > try(system("convert tmp/5cipo1448228589.ps tmp/5cipo1448228589.png",intern=TRUE)) character(0) > try(system("convert tmp/6g4d21448228589.ps tmp/6g4d21448228589.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.092 0.405 2.516