R version 2.12.0 (2010-10-15) Copyright (C) 2010 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), Mean Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_meanplot.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)) > darr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > dx <- diff(x) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + darr[j,ari[j]] <- dx[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 > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -10346 -63332 -105861 -72555 -147377 -126564 -188772 -178527 -104737 [2,] -10356 -51862 52987 31160 -41506 -84045 -73688 32183 104737 [3,] -20703 0 -20804 10346 -42529 63343 84035 20803 52986 [4,] 209485 199229 178426 272817 284297 272807 200252 136920 63231 [5,] -10357 20703 -42539 0 20804 84044 178425 178426 84035 [6,] -157723 -157724 -168070 -157723 -52986 -20702 -42528 -126574 -84035 [7,] -104737 -178426 -125540 -20703 52986 41395 0 63343 51863 [8,] 10346 94391 115184 63332 -10458 -10346 20803 -52986 -63241 [9,] 0 0 32183 -31160 -84034 -104738 -72666 -31059 -10346 [10,] 10356 73689 31160 84045 94492 178426 188884 241768 262460 [11,] 21826 42529 41405 104738 104737 42529 0 -52986 21826 [12,] -63231 -10357 -84045 20803 42529 62208 -32183 -73689 -84034 [,10] [,11] [1,] -147368 NA [2,] 125541 NA [3,] 52885 NA [4,] 63333 NA [5,] 94391 NA [6,] -94391 NA [7,] 73688 NA [8,] -32182 NA [9,] -115195 NA [10,] 241758 NA [11,] 0 NA [12,] NA NA > arr.mean <- array(NA,dim=par1) > arr.median <- array(NA,dim=par1) > arr.midrange <- array(NA,dim=par1) > for (j in 1:par1) + { + arr.mean[j] <- mean(arr[j,],na.rm=TRUE) + arr.median[j] <- median(arr[j,],na.rm=TRUE) + arr.midrange[j] <- (quantile(arr[j,],0.75,na.rm=TRUE) + quantile(arr[j,],0.25,na.rm=TRUE)) / 2 + } > overall.mean <- mean(x) > overall.median <- median(x) > overall.midrange <- (quantile(x,0.75) + quantile(x,0.25)) / 2 > postscript(file="/var/www/rcomp/tmp/1qhqf1343736413.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.mean,type='b',ylab='mean',main='Mean Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.mean,0) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2ynf01343736413.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.median,type='b',ylab='median',main='Median Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.median,0) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3jqde1343736413.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.midrange,type='b',ylab='midrange',main='Midrange Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.midrange,0) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/4hy5v1343736413.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/www/rcomp/tmp/5thq71343736413.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(darr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Differenced Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -188772.0 -84045 -42529.0 63231.0 -42539.0 -168070.0 -178426.0 -63241 [2,] -147377.0 -51862 -20703.0 136920.0 0.0 -157723.0 -104737.0 -32182 [3,] -116212.5 10402 15574.5 199740.5 52419.5 -110482.5 20697.5 0 [4,] -72555.0 52987 52986.0 272807.0 94391.0 -52986.0 52986.0 63332 [5,] -10346.0 125541 84035.0 284297.0 178426.0 -20702.0 73688.0 115184 [,9] [,10] [,11] [,12] [1,] -115195.0 10356 -52986.0 -84045 [2,] -84034.0 73689 0.0 -73689 [3,] -31109.5 136459 31615.5 -32183 [4,] 0.0 241758 42529.0 20803 [5,] 32183.0 262460 104738.0 62208 $n [1] 10 10 10 10 10 10 10 10 10 10 10 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -153596.55 -41984.74 -21243.46 131845.9 5257.993 -162813.28 -58107.2 [2,] -78828.45 62788.74 52392.46 267635.1 99581.007 -58151.72 99502.2 [,8] [,9] [,10] [,11] [,12] [1,] -47722.6 -73096.24 52485.03 10366.32 -81948.79 [2,] 47722.6 10877.24 220432.97 52864.68 17582.79 $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(-188772, -147377, -116212.5, -72555, -10346, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6bn9h1343736413.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/www/rcomp/tmp/7zos81343736413.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(cbind(arr.mean,arr.median,arr.midrange)) > names(z) <- list('mean','median','midrange') > (boxplot(z,notch=TRUE,col='grey',ylab='Overall Central Tendency',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 861684.1 609579.0 839647.4 [2,] 933231.7 704253.5 912787.5 [3,] 1024991.8 864282.8 1004723.9 [4,] 1104525.6 906299.8 1082484.6 [5,] 1163396.6 1009015.0 1131036.8 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 946863.4 772128.1 927324 [2,] 1103120.1 956437.4 1082124 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(861684.1, 933231.7, 1024991.75, 1104525.65, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qhqf1343736413.ps tmp/1qhqf1343736413.png",intern=TRUE)) character(0) > try(system("convert tmp/2ynf01343736413.ps tmp/2ynf01343736413.png",intern=TRUE)) character(0) > try(system("convert tmp/3jqde1343736413.ps tmp/3jqde1343736413.png",intern=TRUE)) character(0) > try(system("convert tmp/4hy5v1343736413.ps tmp/4hy5v1343736413.png",intern=TRUE)) character(0) > try(system("convert tmp/5thq71343736413.ps tmp/5thq71343736413.png",intern=TRUE)) character(0) > try(system("convert tmp/6bn9h1343736413.ps tmp/6bn9h1343736413.png",intern=TRUE)) character(0) > try(system("convert tmp/7zos81343736413.ps tmp/7zos81343736413.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.630 1.070 2.729