R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(865911,858030,850038,833499,997113,988455,865911,784437,792318,792318,801087,816849,865911,850038,874569,914862,1144188,1144188,1095237,1046175,1086468,1135530,1144188,1168719,1242312,1193250,1193250,1266843,1470861,1487400,1446330,1348206,1421799,1421799,1429680,1470861,1503273,1519812,1519812,1568874,1757130,1806081,1813962,1691418,1757130,1732599,1683537,1789542,1813962,1772892,1781550,1838493,2051280,2157174,2157174,2108223,2181705,2108223,2067042,2222886,2247306,2189586,2336661,2394381,2565987,2679873,2664111,2655342,2721054,2713062,2615049,2762124,2811186,2762124,2966142,3064266,3292704,3382836,3358416,3309354,3350424,3399486,3235761,3366297,3448548,3415359,3628035,3701517,4012317,4069260,3995778,4036848,4061379,4085910,3930066,4077141,4158615,4077141,4314459,4387941,4706622,4755684,4771446,4853697,4853697,4886109,4739034,4812627,4861578,4771446,5033184,5082246,5408808,5466528,5548002,5621595,5629476,5638134,5491059,5638134) > 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] [1,] 865911 865911 1242312 1503273 1813962 2247306 2811186 3448548 4158615 [2,] 858030 850038 1193250 1519812 1772892 2189586 2762124 3415359 4077141 [3,] 850038 874569 1193250 1519812 1781550 2336661 2966142 3628035 4314459 [4,] 833499 914862 1266843 1568874 1838493 2394381 3064266 3701517 4387941 [5,] 997113 1144188 1470861 1757130 2051280 2565987 3292704 4012317 4706622 [6,] 988455 1144188 1487400 1806081 2157174 2679873 3382836 4069260 4755684 [7,] 865911 1095237 1446330 1813962 2157174 2664111 3358416 3995778 4771446 [8,] 784437 1046175 1348206 1691418 2108223 2655342 3309354 4036848 4853697 [9,] 792318 1086468 1421799 1757130 2181705 2721054 3350424 4061379 4853697 [10,] 792318 1135530 1421799 1732599 2108223 2713062 3399486 4085910 4886109 [11,] 801087 1144188 1429680 1683537 2067042 2615049 3235761 3930066 4739034 [12,] 816849 1168719 1470861 1789542 2222886 2762124 3366297 4077141 4812627 [,10] [,11] [1,] 4861578 NA [2,] 4771446 NA [3,] 5033184 NA [4,] 5082246 NA [5,] 5408808 NA [6,] 5466528 NA [7,] 5548002 NA [8,] 5621595 NA [9,] 5629476 NA [10,] 5638134 NA [11,] 5491059 NA [12,] 5638134 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/1wq9a1377069042.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/2q6un1377069042.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/3k9bt1377069042.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/4o7gj1377069042.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] [1,] 865911 850038 850038 833499 997113 988455 865911 784437 792318 [2,] 1242312 1193250 1193250 1266843 1470861 1487400 1446330 1348206 1421799 [3,] 2030634 1981239 2059106 2116437 2308634 2418524 2410642 2381782 2451380 [4,] 3448548 3415359 3628035 3701517 4012317 4069260 3995778 4036848 4061379 [5,] 4861578 4771446 5033184 5082246 5408808 5466528 5548002 5621595 5629476 [,10] [,11] [,12] [1,] 792318 801087 816849 [2,] 1421799 1429680 1470861 [3,] 2410642 2341046 2492505 [4,] 4085910 3930066 4077141 [5,] 5638134 5491059 5638134 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 928310.5 870984.7 842589.8 899976.8 1038821 1128523 1136837 1038430 [2,] 3132957.5 3091493.3 3275621.2 3332897.2 3578446 3708524 3684448 3725135 [,9] [,10] [,11] [,12] [1,] 1132540 1079546 1091753 1190304 [2,] 3770219 3741739 3590338 3794706 $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(865911, 1242312, 2030634, 3448548, 4861578, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5rhob1377069042.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,] 784437.0 850038.0 1193250 1503273 1772892 2189586 2762124 3415359 4077141 [2,] 796702.5 894715.5 1254578 1544343 1826228 2365521 3015204 3664776 4351200 [3,] 841768.5 1090852.5 1421799 1712008 2087632 2635196 3301029 4004048 4747359 [4,] 865911.0 1144188.0 1458596 1773336 2157174 2696468 3362356 4065320 4833162 [5,] 865911.0 1168719.0 1487400 1813962 2222886 2762124 3399486 4085910 4886109 [,10] [,11] [1,] 4771446 NA [2,] 5057715 NA [3,] 5478794 NA [4,] 5625536 NA [5,] 5638134 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 810202 977066.4 1328745 1607563 1936686 2484249 3142690 3821357 4527533 [2,] 873335 1204638.6 1514853 1816454 2238579 2786142 3459368 4186738 4967185 [,10] [,11] [1,] 5219807 NA [2,] 5737780 NA $out [1] 997113 988455 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(784437, 796702.5, 841768.5, 865911, 865911, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6yh821377069042.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,] 1374868 3921408 1977160 [2,] 1488268 4215946 2193762 [3,] 1578870 4580082 2294092 [4,] 1636860 4829222 2363454 [5,] 1663770 4845816 2420966 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1511096 4300363 2216695 [2,] 1646644 4859801 2371490 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1374868.33324882, 1488267.76078495, 1578870.2381513, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1wq9a1377069042.ps tmp/1wq9a1377069042.png",intern=TRUE)) character(0) > try(system("convert tmp/2q6un1377069042.ps tmp/2q6un1377069042.png",intern=TRUE)) character(0) > try(system("convert tmp/3k9bt1377069042.ps tmp/3k9bt1377069042.png",intern=TRUE)) character(0) > try(system("convert tmp/4o7gj1377069042.ps tmp/4o7gj1377069042.png",intern=TRUE)) character(0) > try(system("convert tmp/5rhob1377069042.ps tmp/5rhob1377069042.png",intern=TRUE)) character(0) > try(system("convert tmp/6yh821377069042.ps tmp/6yh821377069042.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.788 1.118 5.863