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(43200,41600,44000,35200,45600,44800,48000,49600,55200,48000,45600,56800,48000,36000,42400,32000,44800,36800,48800,44000,46400,52000,51200,60800,44000,36800,40800,29600,42400,32800,46400,44000,39200,56000,50400,57600,43200,40000,36000,29600,39200,35200,48000,46400,40000,53600,49600,64000,51200,31200,31200,31200,36800,36800,49600,45600,40800,51200,47200,68000,53600,31200,32800,27200,37600,43200,54400,53600,43200,50400,44800,64000,48800,39200,35200,26400,39200,47200,55200,52000,38400,55200,43200,66400,55200,40000,36800,24800,39200,37600,56800,56800,43200,56000,41600,64800,55200,40800,31200,21600,42400,40800,53600,61600,45600,51200,38400,66400) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 43200 48000 44000 43200 51200 53600 48800 55200 55200 NA [2,] 41600 36000 36800 40000 31200 31200 39200 40000 40800 NA [3,] 44000 42400 40800 36000 31200 32800 35200 36800 31200 NA [4,] 35200 32000 29600 29600 31200 27200 26400 24800 21600 NA [5,] 45600 44800 42400 39200 36800 37600 39200 39200 42400 NA [6,] 44800 36800 32800 35200 36800 43200 47200 37600 40800 NA [7,] 48000 48800 46400 48000 49600 54400 55200 56800 53600 NA [8,] 49600 44000 44000 46400 45600 53600 52000 56800 61600 NA [9,] 55200 46400 39200 40000 40800 43200 38400 43200 45600 NA [10,] 48000 52000 56000 53600 51200 50400 55200 56000 51200 NA [11,] 45600 51200 50400 49600 47200 44800 43200 41600 38400 NA [12,] 56800 60800 57600 64000 68000 64000 66400 64800 66400 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/1rjft1438354990.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/2iwkc1438354990.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/341y61438354990.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/4ikze1438354990.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,] 43200 31200 31200 21600 36800 32800 46400 44000 38400 48000 38400 56800 [2,] 44000 36000 32800 26400 39200 36800 48000 45600 40000 51200 43200 60800 [3,] 48800 39200 36000 29600 39200 37600 49600 49600 43200 52000 45600 64000 [4,] 53600 40000 40800 31200 42400 43200 54400 53600 45600 55200 49600 66400 [5,] 55200 41600 44000 35200 45600 47200 56800 61600 46400 56000 51200 68000 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 43744 37093.33 31786.67 27072 37514.67 34229.33 46229.33 45386.67 40250.67 [2,] 53856 41306.67 40213.33 32128 40885.33 40970.67 52970.67 53813.33 46149.33 [,10] [,11] [,12] [1,] 49893.33 42229.33 61050.67 [2,] 54106.67 48970.67 66949.33 $out [1] 55200 $group [1] 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(43200, 44000, 48800, 53600, 55200, 31200, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5s45f1438354990.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] [,9] [,10] [1,] 41600 32000 29600 29600 31200 27200 26400 24800 21600 NA [2,] 43600 39600 38000 37600 34000 35200 38800 38400 39600 NA [3,] 45600 45600 43200 41600 43200 44000 45200 42400 44000 NA [4,] 48800 50000 48400 48800 50400 53600 53600 56400 54400 NA [5,] 55200 60800 57600 64000 68000 64000 66400 64800 66400 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 43228.25 40856.49 38456.49 36491.6 35719.85 35607.64 38449.62 34190.08 [2,] 47971.75 50343.51 47943.51 46708.4 50680.15 52392.36 51950.38 50609.92 [,9] [,10] [1,] 37249.62 NA [2,] 50750.38 NA $out [1] 35200 56800 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(41600, 43600, 45600, 48800, 55200, 32000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6r44d1438354990.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,] 2764.859 8000 3200 [2,] 3875.020 10400 4400 [3,] 4189.908 12400 6000 [4,] 4874.761 14000 7200 [5,] 6131.884 17600 9600 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3733.919 10758.02 4722.901 [2,] 4645.897 14041.98 7277.099 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2764.85884711036, 3875.0195259932, 4189.90816170297, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1rjft1438354990.ps tmp/1rjft1438354990.png",intern=TRUE)) character(0) > try(system("convert tmp/2iwkc1438354990.ps tmp/2iwkc1438354990.png",intern=TRUE)) character(0) > try(system("convert tmp/341y61438354990.ps tmp/341y61438354990.png",intern=TRUE)) character(0) > try(system("convert tmp/4ikze1438354990.ps tmp/4ikze1438354990.png",intern=TRUE)) character(0) > try(system("convert tmp/5s45f1438354990.ps tmp/5s45f1438354990.png",intern=TRUE)) character(0) > try(system("convert tmp/6r44d1438354990.ps tmp/6r44d1438354990.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.175 0.385 2.581