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(679,687,638,628,604,713,712,693,697,555,486,470,465,426,384,379,381,380,351,346,339,336,333,324,324,321,304,343,407,389,361,353,361,387,692,704,742,721,843,847,945,946,946,945,1082,1075,820,832,851,1090,1203,1239,1535,1527,1480,1452,1383,1381,1429,1376,1602,1597,2003,1958,1997,1986,2129,2115,2297,2250,2309,2648,2627,2711,2732,2825,2932,2910,2969,2999,2965,2846,2847,2751) > 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,] 679 465 324 742 851 1602 2627 NA [2,] 687 426 321 721 1090 1597 2711 NA [3,] 638 384 304 843 1203 2003 2732 NA [4,] 628 379 343 847 1239 1958 2825 NA [5,] 604 381 407 945 1535 1997 2932 NA [6,] 713 380 389 946 1527 1986 2910 NA [7,] 712 351 361 946 1480 2129 2969 NA [8,] 693 346 353 945 1452 2115 2999 NA [9,] 697 339 361 1082 1383 2297 2965 NA [10,] 555 336 387 1075 1381 2250 2846 NA [11,] 486 333 692 820 1429 2309 2847 NA [12,] 470 324 704 832 1376 2648 2751 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 8 -39 -3 -21 239 -5 84 NA [2,] -49 -42 -17 122 113 406 21 NA [3,] -10 -5 39 4 36 -45 93 NA [4,] -24 2 64 98 296 39 107 NA [5,] 109 -1 -18 1 -8 -11 -22 NA [6,] -1 -29 -28 0 -47 143 59 NA [7,] -19 -5 -8 -1 -28 -14 30 NA [8,] 4 -7 8 137 -69 182 -34 NA [9,] -142 -3 26 -7 -2 -47 -119 NA [10,] -69 -3 305 -255 48 59 1 NA [11,] -16 -9 12 12 -53 339 -96 NA [12,] -5 0 38 19 226 -21 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/wessaorg/rcomp/tmp/1wnp31381919566.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/wessaorg/rcomp/tmp/25mkg1381919566.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/wessaorg/rcomp/tmp/394n61381919566.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/wessaorg/rcomp/tmp/4ijs91381919566.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,] 324.0 321.0 304 343.0 381.0 380.0 351.0 346.0 339 336.0 333 [2,] 572.0 556.5 511 503.5 505.5 551.0 536.5 523.0 529 471.0 589 [3,] 742.0 721.0 843 847.0 945.0 946.0 946.0 945.0 1082 1075.0 820 [4,] 1226.5 1343.5 1603 1598.5 1766.0 1756.5 1804.5 1783.5 1840 1815.5 1869 [5,] 1602.0 1597.0 2732 2825.0 2932.0 2910.0 2969.0 2999.0 2965 2846.0 2847 [,12] [1,] 324 [2,] 587 [3,] 832 [4,] 2012 [5,] 2751 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 351.1432 251.0163 190.8752 193.0837 192.2497 226.0948 188.7709 [2,] 1132.8568 1190.9837 1495.1248 1500.9163 1697.7503 1665.9052 1703.2291 [,8] [,9] [,10] [,11] [,12] [1,] 192.2497 299.0919 272.0863 55.60465 -18.98701 [2,] 1697.7503 1864.9081 1877.9137 1584.39535 1682.98701 $out [1] 2627 2711 $group [1] 1 2 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(324, 572, 742, 1226.5, 1602, 321, 556.5, 721, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/58mj41381919566.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] [,11] [,12] [1,] -39 -49.0 -45.0 -24.0 -22.0 -47.0 -28.0 -69.0 -142.0 -69.0 -96.0 -21.0 [2,] -13 -29.5 -7.5 20.5 -14.5 -28.5 -16.5 -20.5 -83.0 -36.0 -34.5 -5.0 [3,] -3 21.0 4.0 64.0 -8.0 -1.0 -8.0 4.0 -7.0 1.0 -9.0 9.5 [4,] 46 117.5 37.5 102.5 0.0 29.5 -3.0 72.5 -2.5 53.5 12.0 38.0 [5,] 84 122.0 93.0 107.0 1.0 59.0 -1.0 182.0 26.0 59.0 12.0 38.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -38.23385 -66.78603 -22.87327 15.03092 -16.6591661 -35.63666 -16.06198221 [2,] 32.23385 108.78603 30.87327 112.96908 0.6591661 33.63666 0.06198221 [,8] [,9] [,10] [,11] [,12] [1,] -51.5381 -55.0733 -52.44796 -36.76905 -18.23639 [2,] 59.5381 41.0733 54.44796 18.76905 37.23639 $out [1] 239 406 296 109 143 30 305 -255 339 226 $group [1] 1 2 4 5 6 7 10 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-39, -13, -3, 46, 84, -49, -29.5, 21, 117.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ew0i1381919566.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,] 470.0 324.0 304.0 721 1090 1597.0 2627.0 NA [2,] 579.5 337.5 333.5 826 1221 1972.0 2741.5 NA [3,] 658.5 365.0 361.0 896 1382 2059.0 2846.5 NA [4,] 695.0 382.5 398.0 946 1466 2273.5 2948.5 NA [5,] 713.0 426.0 407.0 1082 1535 2648.0 2999.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 605.8197 344.4752 331.5811 841.2672 1270.254 1921.484 2752.086 NA [2,] 711.1803 385.5248 390.4189 950.7328 1493.746 2196.516 2940.914 NA $out [1] 465 692 704 851 $group [1] 2 3 3 5 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(470, 579.5, 658.5, 695, 713, 324, 337.5, 365, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7pr1b1381919566.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,] 1041.429 721 899.25 [2,] 1166.143 826 1054.00 [3,] 1262.929 896 1148.25 [4,] 1276.000 946 1177.50 [5,] 1303.429 1082 1299.50 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1212.822 841.2672 1091.921 [2,] 1313.035 950.7328 1204.579 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1041.42857142857, 1166.14285714286, 1262.92857142857, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1wnp31381919566.ps tmp/1wnp31381919566.png",intern=TRUE)) character(0) > try(system("convert tmp/25mkg1381919566.ps tmp/25mkg1381919566.png",intern=TRUE)) character(0) > try(system("convert tmp/394n61381919566.ps tmp/394n61381919566.png",intern=TRUE)) character(0) > try(system("convert tmp/4ijs91381919566.ps tmp/4ijs91381919566.png",intern=TRUE)) character(0) > try(system("convert tmp/58mj41381919566.ps tmp/58mj41381919566.png",intern=TRUE)) character(0) > try(system("convert tmp/6ew0i1381919566.ps tmp/6ew0i1381919566.png",intern=TRUE)) character(0) > try(system("convert tmp/7pr1b1381919566.ps tmp/7pr1b1381919566.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.375 0.717 4.077