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(22943,21413,20631,19775,17506,20688,32631,34062,29159,25871,23719,25638,27596,28006,27662,26655,25213,28434,40388,42758,37956,33490,31578,34766,32324,32046,29565,28284,26366,27530,39728,41528,36458,32301,28985,29118,29249,28036,26326,24942,23280,23969,35948,37639,34327,30133,27549,27990,30437,30464,28471,26882,25806,26465,36416,42870,40489,36645,33841,33496,34504,34699,33322,32160,30173,30782,43062,46223,45191,40671,37251,36870) > 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,] 22943 27596 32324 29249 30437 34504 NA [2,] 21413 28006 32046 28036 30464 34699 NA [3,] 20631 27662 29565 26326 28471 33322 NA [4,] 19775 26655 28284 24942 26882 32160 NA [5,] 17506 25213 26366 23280 25806 30173 NA [6,] 20688 28434 27530 23969 26465 30782 NA [7,] 32631 40388 39728 35948 36416 43062 NA [8,] 34062 42758 41528 37639 42870 46223 NA [9,] 29159 37956 36458 34327 40489 45191 NA [10,] 25871 33490 32301 30133 36645 40671 NA [11,] 23719 31578 28985 27549 33841 37251 NA [12,] 25638 34766 29118 27990 33496 36870 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/1zc631416497872.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/2d4bl1416497872.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/3npd61416497872.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/45w9v1416497872.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] [1,] 22943 28006 26326.0 24942.0 23280.0 20688.0 32631 34062 29159 25871.0 [2,] 27596 28006 26326.0 24942.0 23280.0 23969.0 35948 37639 34327 30133.0 [3,] 29843 29250 28066.5 26768.5 25509.5 26997.5 38072 42143 37207 32895.5 [4,] 32324 32046 29565.0 28284.0 26366.0 28434.0 40388 42870 40489 36645.0 [5,] 34504 34699 33322.0 32160.0 30173.0 30782.0 43062 46223 45191 40671.0 [,11] [,12] [1,] 23719.0 25638 [2,] 27549.0 27990 [3,] 30281.5 31307 [4,] 33841.0 34766 [5,] 37251.0 36870 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 26793.29 26644.07 25977.24 24612.8 23518.93 24117.43 35208.06 38768.84 [2,] 32892.71 31855.93 30155.76 28924.2 27500.07 29877.57 40935.94 45517.16 [,9] [,10] [,11] [,12] [1,] 33232.31 28695.05 26222.96 26936.26 [2,] 41181.69 37095.95 34340.04 35677.74 $out [1] 21413 20631 19775 17506 $group [1] 2 3 4 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(22943, 27596, 29843, 32324, 34504, 28006, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5vswy1416497872.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,] 17506.0 25213 26366.0 23280 25806.0 30173.0 NA [2,] 20659.5 27629 28634.5 25634 27676.5 32741.0 NA [3,] 23331.0 30006 30805.5 28013 31980.0 35784.5 NA [4,] 27515.0 36361 34391.0 32230 36530.5 41866.5 NA [5,] 34062.0 42758 41528.0 37639 42870.0 46223.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 20204.16 26023.28 28179.92 25004.52 27941.63 31622.3 NA [2,] 26457.84 33988.72 33431.08 31021.48 36018.37 39946.7 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(17506, 20659.5, 23331, 27515, 34062, 25213, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/66sqt1416497872.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,] 3552.738 10094.0 2462.750 [2,] 4044.648 11396.5 3123.250 [3,] 4258.854 12526.0 4000.500 [4,] 4669.451 13409.0 5088.625 [5,] 5453.136 16032.0 6176.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3973.877 11608.09 3104.079 [2,] 4543.830 13443.91 4896.921 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3552.73808022301, 4044.64796283578, 4258.85352094604, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zc631416497872.ps tmp/1zc631416497872.png",intern=TRUE)) character(0) > try(system("convert tmp/2d4bl1416497872.ps tmp/2d4bl1416497872.png",intern=TRUE)) character(0) > try(system("convert tmp/3npd61416497872.ps tmp/3npd61416497872.png",intern=TRUE)) character(0) > try(system("convert tmp/45w9v1416497872.ps tmp/45w9v1416497872.png",intern=TRUE)) character(0) > try(system("convert tmp/5vswy1416497872.ps tmp/5vswy1416497872.png",intern=TRUE)) character(0) > try(system("convert tmp/66sqt1416497872.ps tmp/66sqt1416497872.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.105 0.469 2.596