R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 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(11000,13000,15000,29000,31000,22000,36000,39000,30000,20000,18000,13000,11000,16000,20000,29000,31000,24000,40000,41000,25000,19000,19000,18000,10000,17000,25000,30000,32000,24000,38000,36000,26000,25000,26000,16000,12000,15000,21000,33000,32000,24000,41000,38000,28000,24000,30000,18000) > 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] 48 > (np <- floor(n / par1)) [1] 4 > 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] 4 4 4 4 4 4 4 4 4 4 4 4 > arr [,1] [,2] [,3] [,4] [,5] [1,] 11000 11000 10000 12000 NA [2,] 13000 16000 17000 15000 NA [3,] 15000 20000 25000 21000 NA [4,] 29000 29000 30000 33000 NA [5,] 31000 31000 32000 32000 NA [6,] 22000 24000 24000 24000 NA [7,] 36000 40000 38000 41000 NA [8,] 39000 41000 36000 38000 NA [9,] 30000 25000 26000 28000 NA [10,] 20000 19000 25000 24000 NA [11,] 18000 19000 26000 30000 NA [12,] 13000 18000 16000 18000 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/1os3f1479637959.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/29fcc1479637959.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/36jcg1479637959.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/40bn91479637959.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,] 10000 13000 15000 29000 31000 22000 36000 36000 25000 19000 18000 13000 [2,] 10500 14000 17500 29000 31000 23000 37000 37000 25500 19500 18500 14500 [3,] 11000 15500 20500 29500 31500 24000 39000 38500 27000 22000 22500 17000 [4,] 11500 16500 23000 31500 32000 24000 40500 40000 29000 24500 28000 18000 [5,] 12000 17000 25000 33000 32000 24000 41000 41000 30000 25000 30000 18000 $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 10210 13525 16155 27525 30710 23210 36235 36130 24235 18050 14995 14235 [2,] 11790 17475 24845 31475 32290 24790 41765 40870 29765 25950 30005 19765 $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(10000, 10500, 11000, 11500, 12000, 13000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5z0gh1479637959.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] [1,] 11000 11000 10000 12000 NA [2,] 14000 18500 20500 19500 NA [3,] 21000 22000 25500 26000 NA [4,] 30500 30000 31000 32500 NA [5,] 39000 41000 38000 41000 NA $n [1] 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [1,] 13474.24 16754.77 20710.88 20070.61 NA [2,] 28525.76 27245.23 30289.12 31929.39 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" NA Warning message: In bxp(list(stats = c(11000, 14000, 21000, 30500, 39000, 11000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6n0oz1479637959.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,] 577.3503 1000 500 [2,] 1353.9126 3000 1375 [3,] 2149.5109 5000 2375 [4,] 2653.4141 5500 3000 [5,] 4112.9876 6000 4500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1556.800 3859.733 1633.827 [2,] 2742.222 6140.267 3116.173 $out [1] 5737.305 10000.000 12000.000 8250.000 $group [1] 1 2 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(577.350269189626, 1353.91256382997, 2149.51089103724, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1os3f1479637959.ps tmp/1os3f1479637959.png",intern=TRUE)) character(0) > try(system("convert tmp/29fcc1479637959.ps tmp/29fcc1479637959.png",intern=TRUE)) character(0) > try(system("convert tmp/36jcg1479637959.ps tmp/36jcg1479637959.png",intern=TRUE)) character(0) > try(system("convert tmp/40bn91479637959.ps tmp/40bn91479637959.png",intern=TRUE)) character(0) > try(system("convert tmp/5z0gh1479637959.ps tmp/5z0gh1479637959.png",intern=TRUE)) character(0) > try(system("convert tmp/6n0oz1479637959.ps tmp/6n0oz1479637959.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.162 0.182 2.385