R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(20,23,27,23,21,18,16,11,14,-3,2,26,11,11,11,3,8,8,7,3,4,-7,0,-5,5,-1,-4,4,7,6,13,20,21,37,52,59,66,73,71,69,63,68,58,50,50,50,47,60,62,63,56,38,45,39,26,25,19,14,6,4,5,-3,-5,0,-6,4,-3,14,16,17,25,25,30,51,31,31,25,35,39,48,41,47,61,55,63,45,62,55,50,52,45,36,40,32,29,24,28,27,33,33,24,26,38,32,30,26,21,21) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 20 11 5 66 62 5 30 63 28 NA [2,] 23 11 -1 73 63 -3 51 45 27 NA [3,] 27 11 -4 71 56 -5 31 62 33 NA [4,] 23 3 4 69 38 0 31 55 33 NA [5,] 21 8 7 63 45 -6 25 50 24 NA [6,] 18 8 6 68 39 4 35 52 26 NA [7,] 16 7 13 58 26 -3 39 45 38 NA [8,] 11 3 20 50 25 14 48 36 32 NA [9,] 14 4 21 50 19 16 41 40 30 NA [10,] -3 -7 37 50 14 17 47 32 26 NA [11,] 2 0 52 47 6 25 61 29 21 NA [12,] 26 -5 59 60 4 25 55 24 21 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 3 0 -6 7 1 -8 21 -18 -1 NA [2,] 4 0 -3 -2 -7 -2 -20 17 6 NA [3,] -4 -8 8 -2 -18 5 0 -7 0 NA [4,] -2 5 3 -6 7 -6 -6 -5 -9 NA [5,] -3 0 -1 5 -6 10 10 2 2 NA [6,] -2 -1 7 -10 -13 -7 4 -7 12 NA [7,] -5 -4 7 -8 -1 17 9 -9 -6 NA [8,] 3 1 1 0 -6 2 -7 4 -2 NA [9,] -17 -11 16 0 -5 1 6 -8 -4 NA [10,] 5 7 15 -3 -8 8 14 -3 -5 NA [11,] 24 -5 7 13 -2 0 -6 -5 0 NA [12,] -15 10 7 2 1 5 8 4 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/148lc1432976251.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/2w6mj1432976251.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/3liuf1432976251.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/42dj71432976251.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] [,12] [1,] 5 -3 -5 0 -6 4 -3 3 4 -7 0 -5 [2,] 11 11 11 4 8 8 13 14 16 14 6 21 [3,] 28 27 31 31 24 26 26 25 21 26 25 25 [4,] 62 51 56 38 45 39 39 36 40 37 47 55 [5,] 66 73 71 69 63 68 58 50 50 50 61 60 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1.14 5.933333 7.3 13.09333 4.513333 9.673333 12.30667 13.41333 8.36 [2,] 54.86 48.066667 54.7 48.90667 43.486667 42.326667 39.69333 36.58667 33.64 [,10] [,11] [,12] [1,] 13.88667 3.406667 7.093333 [2,] 38.11333 46.593333 42.906667 $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(5, 11, 28, 62, 66, -3, 11, 27, 51, 73, -5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56kqv1432976251.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,] -18 -7 -8 -9 -6 -13 -9 -7 -17 -8 -6 1.0 [2,] -6 -3 -7 -6 -1 -7 -6 -2 -8 -3 -5 1.5 [3,] 0 -2 -2 -5 2 -2 -4 1 -4 5 0 4.5 [4,] 3 4 0 3 5 4 7 2 1 8 7 7.5 [5,] 7 6 8 7 10 12 17 4 6 15 24 10.0 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -4.74 -5.686667 -5.686667 -9.74 -1.16 -7.793333 -10.846667 -1.106667 -8.74 [2,] 4.74 1.686667 1.686667 -0.26 5.16 3.793333 2.846667 3.106667 0.74 [,10] [,11] [,12] [1,] -0.7933333 -6.32 1.148314 [2,] 10.7933333 6.32 7.851686 $out [1] 21 -20 17 -18 16 -15 $group [1] 1 2 2 3 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-18, -6, 0, 3, 7, -7, -3, -2, 4, 6, -8, -7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6affc1432976251.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] [,10] [1,] -3.0 -7.0 -4.0 47.0 4.0 -6.0 25.0 24.0 21.0 NA [2,] 12.5 1.5 4.5 50.0 16.5 -3.0 31.0 34.0 25.0 NA [3,] 19.0 5.5 10.0 61.5 32.0 4.5 40.0 45.0 27.5 NA [4,] 23.0 9.5 29.0 68.5 50.5 16.5 49.5 53.5 32.5 NA [5,] 27.0 11.0 59.0 73.0 63.0 25.0 61.0 63.0 38.0 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 14.21088 1.851146 -1.174614 53.06203 16.49237 -4.394081 31.56203 36.10592 [2,] 23.78912 9.148854 21.174614 69.93797 47.50763 13.394081 48.43797 53.89408 [,9] [,10] [1,] 24.0792 NA [2,] 30.9208 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(-3, 12.5, 19, 23, 27, -7, 1.5, 5.5, 9.5, 11, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7v7741432976251.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,] 23.66667 24.0 21.00 [2,] 26.44444 25.0 25.25 [3,] 27.72222 26.0 26.50 [4,] 30.61111 27.5 32.25 [5,] 32.22222 31.0 38.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 25.82178 24.85973 23.30725 [2,] 29.62267 27.14027 29.69275 $out [1] 21 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(23.6666666666667, 26.4444444444444, 27.7222222222222, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/148lc1432976251.ps tmp/148lc1432976251.png",intern=TRUE)) character(0) > try(system("convert tmp/2w6mj1432976251.ps tmp/2w6mj1432976251.png",intern=TRUE)) character(0) > try(system("convert tmp/3liuf1432976251.ps tmp/3liuf1432976251.png",intern=TRUE)) character(0) > try(system("convert tmp/42dj71432976251.ps tmp/42dj71432976251.png",intern=TRUE)) character(0) > try(system("convert tmp/56kqv1432976251.ps tmp/56kqv1432976251.png",intern=TRUE)) character(0) > try(system("convert tmp/6affc1432976251.ps tmp/6affc1432976251.png",intern=TRUE)) character(0) > try(system("convert tmp/7v7741432976251.ps tmp/7v7741432976251.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.505 0.482 3.020