R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" 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(9969,9692,8943,8802,8250,8515,13973,13905,12467,9490,8483,7610,7839,7107,6584,6053,5725,6480,11663,11628,9203,7781,7020,6908,6912,6668,6189,6007,5148,6685,11044,11034,8986,8146,7818,8176,8935,8929,8835,8455,7924,8973,13575,13844,11738,10467,10145,10833,10179,10107,9533,9165,8382,9018,13911,13761,11316,9855,9034,8932,9278,8876,8298,7733,7226,7688,12226,12081,10439,9008,8377,8346,9167,8945,8428,7973,7446,7785,10561,12791,11583,10112,9597,9332) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 9969 7839 6912 8935 10179 9278 9167 NA [2,] 9692 7107 6668 8929 10107 8876 8945 NA [3,] 8943 6584 6189 8835 9533 8298 8428 NA [4,] 8802 6053 6007 8455 9165 7733 7973 NA [5,] 8250 5725 5148 7924 8382 7226 7446 NA [6,] 8515 6480 6685 8973 9018 7688 7785 NA [7,] 13973 11663 11044 13575 13911 12226 10561 NA [8,] 13905 11628 11034 13844 13761 12081 12791 NA [9,] 12467 9203 8986 11738 11316 10439 11583 NA [10,] 9490 7781 8146 10467 9855 9008 10112 NA [11,] 8483 7020 7818 10145 9034 8377 9597 NA [12,] 7610 6908 8176 10833 8932 8346 9332 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -277 -732 -244 -6 -72 -402 -222 NA [2,] -749 -523 -479 -94 -574 -578 -517 NA [3,] -141 -531 -182 -380 -368 -565 -455 NA [4,] -552 -328 -859 -531 -783 -507 -527 NA [5,] 265 755 1537 1049 636 462 339 NA [6,] 5458 5183 4359 4602 4893 4538 2776 NA [7,] -68 -35 -10 269 -150 -145 2230 NA [8,] -1438 -2425 -2048 -2106 -2445 -1642 -1208 NA [9,] -2977 -1422 -840 -1271 -1461 -1431 -1471 NA [10,] -1007 -761 -328 -322 -821 -631 -515 NA [11,] -873 -112 358 688 -102 -31 -265 NA [12,] 229 4 759 -654 346 821 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/fisher/rcomp/tmp/1cqqi1381927661.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/fisher/rcomp/tmp/2vhuh1381927661.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/fisher/rcomp/tmp/3tb611381927661.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/fisher/rcomp/tmp/45wco1381927661.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] [1,] 6912.0 6668.0 6189 6007.0 5148.0 6480.0 10561.0 11034.0 8986.0 7781.0 [2,] 8387.0 7991.5 7441 6893.0 6475.5 7186.5 11353.5 11854.5 9821.0 8577.0 [3,] 9167.0 8929.0 8428 7973.0 7446.0 7785.0 12226.0 12791.0 11316.0 9490.0 [4,] 9623.5 9318.5 8889 8628.5 8087.0 8744.0 13743.0 13802.5 11660.5 9983.5 [5,] 10179.0 10107.0 9533 9165.0 8382.0 9018.0 13973.0 13905.0 12467.0 10467.0 [,11] [,12] [1,] 7020.0 6908 [2,] 8097.5 7893 [3,] 8483.0 8346 [4,] 9315.5 9132 [5,] 10145.0 10833 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 8428.582 8136.537 7563.278 6936.587 6483.638 6854.886 10799.03 11627.69 [2,] 9905.418 9721.463 9292.722 9009.413 8408.362 8715.114 13652.97 13954.31 [,9] [,10] [,11] [,12] [1,] 10217.48 8650.061 7755.63 7606.089 [2,] 12414.52 10329.939 9210.37 9085.911 $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(6912, 8387, 9167, 9623.5, 10179, 6668, 7991.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/59nn11381927661.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] [,9] [,10] [1,] -402.0 -578 -565 -859.0 265.0 4359.0 -150.0 -2445.0 -1471.0 -1007.0 [2,] -339.5 -576 -493 -667.5 400.5 4448.5 -106.5 -2265.5 -1466.0 -791.0 [3,] -244.0 -523 -380 -531.0 636.0 4602.0 -35.0 -2048.0 -1431.0 -631.0 [4,] -147.0 -498 -275 -517.0 902.0 5038.0 129.5 -1540.0 -1346.5 -421.5 [5,] -6.0 -479 -141 -328.0 1537.0 5458.0 269.0 -1208.0 -1271.0 -322.0 [,11] [,12] [1,] -265.0 -654.0 [2,] -188.5 4.0 [3,] -102.0 287.5 [4,] 163.5 759.0 [5,] 688.0 821.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -358.9579 -569.5803 -510.1861 -620.8762 336.5123 4249.96 -175.9354 [2,] -129.0421 -476.4197 -249.8139 -441.1238 935.4877 4954.04 105.9354 [,8] [,9] [,10] [,11] [,12] [1,] -2481.257 -1502.363 -851.6594 -312.2087 -199.4994 [2,] -1614.743 -1359.637 -410.3406 108.2087 774.4994 $out [1] -732 -749 -94 2776 2230 -2977 -840 -873 $group [1] 1 2 2 6 7 9 9 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-402, -339.5, -244, -147, -6, -578, -576, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6tof11381927661.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] [1,] 7610.0 5725.0 5148.0 7924.0 8382.0 7226.0 7446.0 NA [2,] 8499.0 6532.0 6428.5 8882.0 9026.0 8015.5 8200.5 NA [3,] 9216.5 7063.5 7365.0 9559.0 9694.0 8626.5 9249.5 NA [4,] 11218.0 8521.0 8581.0 11285.5 10747.5 9858.5 10336.5 NA [5,] 13973.0 9203.0 11044.0 13844.0 11316.0 12226.0 12791.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7976.346 6156.304 6383.23 8462.748 8908.812 7785.895 8275.256 NA [2,] 10456.654 7970.696 8346.77 10655.252 10479.188 9467.105 10223.744 NA $out [1] 11663 11628 13911 13761 $group [1] 2 2 5 5 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(7610, 8499, 9216.5, 11218, 13973, 5725, 6532, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7e1pg1381927661.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,] 7157.286 7446.0 7281.250 [2,] 7996.714 8159.5 8065.125 [3,] 8628.429 8706.0 8680.750 [4,] 10042.214 10403.0 10010.500 [5,] 12720.571 12791.0 12828.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7695.462 7682.725 7793.451 [2,] 9561.395 9729.275 9568.049 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(7157.28571428571, 7996.71428571429, 8628.42857142857, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1cqqi1381927661.ps tmp/1cqqi1381927661.png",intern=TRUE)) character(0) > try(system("convert tmp/2vhuh1381927661.ps tmp/2vhuh1381927661.png",intern=TRUE)) character(0) > try(system("convert tmp/3tb611381927661.ps tmp/3tb611381927661.png",intern=TRUE)) character(0) > try(system("convert tmp/45wco1381927661.ps tmp/45wco1381927661.png",intern=TRUE)) character(0) > try(system("convert tmp/59nn11381927661.ps tmp/59nn11381927661.png",intern=TRUE)) character(0) > try(system("convert tmp/6tof11381927661.ps tmp/6tof11381927661.png",intern=TRUE)) character(0) > try(system("convert tmp/7e1pg1381927661.ps tmp/7e1pg1381927661.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.101 0.564 3.660