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(40927,40856,40778,40635,42103,42032,40927,40194,40265,40265,40336,40486,40856,40414,40856,40486,41661,42181,39973,39381,39894,39823,39381,39453,40336,40194,40336,40336,41298,41440,38790,38790,39823,39310,38427,38790,39674,39232,39161,38206,39602,39894,37023,36952,38427,37615,36218,36810,37465,37615,37173,36290,38128,38128,34893,34673,35556,33939,32314,32835,33939,33055,32464,31210,32906,32977,29743,29664,30256,28418,26430,27235,28339,27164,27093,25910,27826,28197,24585,23780,24293,22305,20246,20909,22156,20688,20909,20026,21864,22084,17668,17375,18180,16050,14134,14797,16414,14504,14355,12880,14504,15017,10451,10451,11113,9347,7359,8392,10230,8242,9055,7950,9717,10308,5592,5229,5963,4196,2800,3384) > 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] 120 > (np <- floor(n / par1)) [1] 10 > 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] 10 10 10 10 10 10 10 10 10 10 10 10 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 40927 40856 40336 39674 37465 33939 28339 22156 16414 10230 NA [2,] 40856 40414 40194 39232 37615 33055 27164 20688 14504 8242 NA [3,] 40778 40856 40336 39161 37173 32464 27093 20909 14355 9055 NA [4,] 40635 40486 40336 38206 36290 31210 25910 20026 12880 7950 NA [5,] 42103 41661 41298 39602 38128 32906 27826 21864 14504 9717 NA [6,] 42032 42181 41440 39894 38128 32977 28197 22084 15017 10308 NA [7,] 40927 39973 38790 37023 34893 29743 24585 17668 10451 5592 NA [8,] 40194 39381 38790 36952 34673 29664 23780 17375 10451 5229 NA [9,] 40265 39894 39823 38427 35556 30256 24293 18180 11113 5963 NA [10,] 40265 39823 39310 37615 33939 28418 22305 16050 9347 4196 NA [11,] 40336 39381 38427 36218 32314 26430 20246 14134 7359 2800 NA [12,] 40486 39453 38790 36810 32835 27235 20909 14797 8392 3384 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/1qd2f1408312420.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/2h9rr1408312420.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/3f3yj1408312420.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/4ukgr1408312420.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] [1,] 10230 8242 9055.0 7950 9717 10308.0 5592 5229.0 5963 4196.0 2800 [2,] 22156 20688 20909.0 20026 21864 22084.0 17668 17375.0 18180 16050.0 14134 [3,] 35702 35335 34818.5 33750 35517 35552.5 32318 32168.5 32906 31178.5 29372 [4,] 40336 40194 40336.0 40336 41298 41440.0 38790 38790.0 39823 39310.0 38427 [5,] 40927 40856 40856.0 40635 42103 42181.0 40927 40194.0 40265 40265.0 40336 [,12] [1,] 3384 [2,] 14797 [3,] 30035 [4,] 38790 [5,] 40486 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 26618.55 25589.02 25112 23602.31 25807 25881.47 21764.61 21468.71 22092.29 [2,] 44785.45 45080.98 44525 43897.69 45227 45223.53 42871.39 42868.29 43719.71 [,10] [,11] [,12] [1,] 19556.88 17234.25 18047.14 [2,] 42800.12 41509.75 42022.86 $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(10230, 22156, 35702, 40336, 40927, 8242, 20688, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/57zdc1408312420.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] [1,] 40194.0 39381.0 38427.0 36218.0 32314 26430.0 20246.0 14134.0 7359.0 [2,] 40300.5 39638.0 38790.0 36987.5 34306 29041.0 23042.5 16712.5 9899.0 [3,] 40706.5 40193.5 40008.5 38316.5 35923 30733.0 25247.5 19103.0 11996.5 [4,] 40927.0 40856.0 40336.0 39417.0 37540 32941.5 27495.0 21386.5 14504.0 [5,] 40927.0 42181.0 41440.0 39894.0 38128 33939.0 28339.0 22156.0 16414.0 [,10] [,11] [1,] 2800.0 NA [2,] 4712.5 NA [3,] 6956.5 NA [4,] 9386.0 NA [5,] 10308.0 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 40420.75 39637.96 39303.36 37208.39 34447.95 28953.96 23216.68 16971.16 [2,] 40992.25 40749.04 40713.64 39424.61 37398.05 32512.04 27278.32 21234.84 [,9] [,10] [,11] [1,] 9896.129 4824.885 NA [2,] 14096.871 9088.115 NA $out [1] 42103 42032 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(40194, 40300.5, 40706.5, 40927, 40927, 39381, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6pwmc1408312420.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,] 11244.50 30697.0 16468.75 [2,] 11902.22 32129.5 17553.38 [3,] 12485.91 33493.5 18628.75 [4,] 13152.83 35702.0 20519.12 [5,] 13914.60 37536.0 22212.75 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 11915.50 31864.06 17276.05 [2,] 13056.32 35122.94 19981.45 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(11244.5020955922, 11902.2168520193, 12485.907371611, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qd2f1408312420.ps tmp/1qd2f1408312420.png",intern=TRUE)) character(0) > try(system("convert tmp/2h9rr1408312420.ps tmp/2h9rr1408312420.png",intern=TRUE)) character(0) > try(system("convert tmp/3f3yj1408312420.ps tmp/3f3yj1408312420.png",intern=TRUE)) character(0) > try(system("convert tmp/4ukgr1408312420.ps tmp/4ukgr1408312420.png",intern=TRUE)) character(0) > try(system("convert tmp/57zdc1408312420.ps tmp/57zdc1408312420.png",intern=TRUE)) character(0) > try(system("convert tmp/6pwmc1408312420.ps tmp/6pwmc1408312420.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.102 0.352 2.488