R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(588264,577918,567562,546859,756344,745987,588264,483527,493873,493873,504229,526055,462824,399492,347630,347630,546859,567562,409838,231412,325803,325803,399492,442021,431664,325803,378790,357986,536412,493873,325803,200263,315447,347630,378790,420195,336150,263595,294755,305101,577918,577918,420195,399492,462824,431664,515709,620447,641250,493873,452367,409838,694135,714939,661953,714939,704481,620447,714939,819676,862205,735641,651596,714939,987746,1071790,1051088,1092483,1082137,977399,1155825,1198354,1260562,1071790,998102,1082137,1282389,1460814,1418286,1418286,1439089,1366423,1555307,1555307,1523124,1344597,1376780,1397583,1534503,1712929,1586355,1649698,1596712,1565653,1807421,1754435,1680746,1576009,1680746,1733732,1796963,1880998,1796963,1848826,1785585,1775239,2037699,2059525,1975491,1828123,1953664,2006549,2069882,2164273,2069882,2143570,2111388,1996193,2237951,2237951) > 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,] 588264 462824 431664 336150 641250 862205 1260562 1523124 1680746 [2,] 577918 399492 325803 263595 493873 735641 1071790 1344597 1576009 [3,] 567562 347630 378790 294755 452367 651596 998102 1376780 1680746 [4,] 546859 347630 357986 305101 409838 714939 1082137 1397583 1733732 [5,] 756344 546859 536412 577918 694135 987746 1282389 1534503 1796963 [6,] 745987 567562 493873 577918 714939 1071790 1460814 1712929 1880998 [7,] 588264 409838 325803 420195 661953 1051088 1418286 1586355 1796963 [8,] 483527 231412 200263 399492 714939 1092483 1418286 1649698 1848826 [9,] 493873 325803 315447 462824 704481 1082137 1439089 1596712 1785585 [10,] 493873 325803 347630 431664 620447 977399 1366423 1565653 1775239 [11,] 504229 399492 378790 515709 714939 1155825 1555307 1807421 2037699 [12,] 526055 442021 420195 620447 819676 1198354 1555307 1754435 2059525 [,10] [,11] [1,] 1975491 NA [2,] 1828123 NA [3,] 1953664 NA [4,] 2006549 NA [5,] 2069882 NA [6,] 2164273 NA [7,] 2069882 NA [8,] 2143570 NA [9,] 2111388 NA [10,] 1996193 NA [11,] 2237951 NA [12,] 2237951 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/1r9ls1343749137.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/2i8ha1343749137.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/389pe1343749137.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/4ns1h1343749137.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] [1,] 336150.0 263595.0 294755 305101 536412 493873.0 325803.0 200263 [2,] 462824.0 399492.0 378790 357986 577918 577918.0 420195.0 399492 [3,] 751727.5 656779.5 609579 630899 872045 908888.5 856520.5 903711 [4,] 1523124.0 1344597.0 1376780 1397583 1534503 1712929.0 1586355.0 1649698 [5,] 1975491.0 1828123.0 1953664 2006549 2069882 2164273.0 2069882.0 2143570 [,9] [,10] [,11] [,12] [1,] 315447 325803 378790 420195 [2,] 462824 431664 504229 526055 [3,] 893309 798923 935382 1009015 [4,] 1596712 1565653 1807421 1754435 [5,] 2111388 1996193 2237951 2237951 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 221959.3 184567.4 110943.4 111474.9 394097 341791.8 273860.5 [2,] 1281495.7 1128991.6 1108214.6 1150323.1 1349993 1475985.2 1439180.5 [,8] [,9] [,10] [,11] [,12] [1,] 279058.2 326773.3 232336.9 284255.3 395267.4 [2,] 1528363.8 1459844.7 1365509.1 1586508.7 1622762.6 $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(336150, 462824, 751727.5, 1523124, 1975491, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5cgbe1343749137.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,] 483527.0 231412.0 200263.0 263595.0 409838 651596 998102 1344597 1576009 [2,] 499051.0 336716.5 325803.0 320625.5 557160 798923 1171350 1460354 1707239 [3,] 557210.5 399492.0 368388.0 425929.5 678044 1019417 1392354 1576004 1791274 [4,] 588264.0 452422.5 425929.5 546813.5 714939 1087310 1449952 1681314 1864912 [5,] 588264.0 567562.0 536412.0 620447.0 819676 1198354 1555307 1807421 2059525 [,10] [,11] [1,] 1828123 NA [2,] 1985842 NA [3,] 2069882 NA [4,] 2153922 NA [5,] 2237951 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 516519.9 346717.7 322719.6 322763.6 606079.9 887881.8 1265282 1475223 [2,] 597901.1 452266.3 414056.4 529095.4 750008.1 1150952.2 1519427 1676785 [,9] [,10] [,11] [1,] 1719358 1993220 NA [2,] 1863190 2146544 NA $out [1] 756344 745987 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(483527, 499051, 557210.5, 588264, 588264, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6394r1343749137.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,] 558948.3 1533470 853308.0 [2,] 595496.8 1649125 916349.4 [3,] 632523.2 1685924 1053178.1 [4,] 679132.3 1806848 1120860.0 [5,] 725036.1 1943307 1237293.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 594376.5 1613985 959899.5 [2,] 670669.9 1757863 1146456.8 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(558948.347685475, 595496.756810643, 632523.205834183, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1r9ls1343749137.ps tmp/1r9ls1343749137.png",intern=TRUE)) character(0) > try(system("convert tmp/2i8ha1343749137.ps tmp/2i8ha1343749137.png",intern=TRUE)) character(0) > try(system("convert tmp/389pe1343749137.ps tmp/389pe1343749137.png",intern=TRUE)) character(0) > try(system("convert tmp/4ns1h1343749137.ps tmp/4ns1h1343749137.png",intern=TRUE)) character(0) > try(system("convert tmp/5cgbe1343749137.ps tmp/5cgbe1343749137.png",intern=TRUE)) character(0) > try(system("convert tmp/6394r1343749137.ps tmp/6394r1343749137.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.955 0.456 2.408