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(25,24,25,27,24,26,24,24,21,23,24,23,22,25,26,22,24,22,23,25,24,24,21,22,21,21,20,20,22,21,23,22,24,21,22,20,23,21,21,21,22,24,21,23,25,23,24,25,28,26,25,24,25,26,24,21,22,25,27,26,24,27,23,23,23,25,26,22,23,27,25,24,21,24,22,26,22,25,20,21,23,24,24,18) > 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,] 25 22 21 23 28 24 21 NA [2,] 24 25 21 21 26 27 24 NA [3,] 25 26 20 21 25 23 22 NA [4,] 27 22 20 21 24 23 26 NA [5,] 24 24 22 22 25 23 22 NA [6,] 26 22 21 24 26 25 25 NA [7,] 24 23 23 21 24 26 20 NA [8,] 24 25 22 23 21 22 21 NA [9,] 21 24 24 25 22 23 23 NA [10,] 23 24 21 23 25 27 24 NA [11,] 24 21 22 24 27 25 24 NA [12,] 23 22 20 25 26 24 18 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -1 3 0 -2 -2 3 3 NA [2,] 1 1 -1 0 -1 -4 -2 NA [3,] 2 -4 0 0 -1 0 4 NA [4,] -3 2 2 1 1 0 -4 NA [5,] 2 -2 -1 2 1 2 3 NA [6,] -2 1 2 -3 -2 1 -5 NA [7,] 0 2 -1 2 -3 -4 1 NA [8,] -3 -1 2 2 1 1 2 NA [9,] 2 0 -3 -2 3 4 1 NA [10,] 1 -3 1 1 2 -2 0 NA [11,] -1 1 -2 1 -1 -1 -6 NA [12,] -1 -1 3 3 -2 -3 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/115es1381934950.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/224ze1381934950.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/3u0pp1381934950.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/4273h1381934950.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,] 21.0 21.0 20.0 20.0 22 21.0 20 21.0 21.0 21.0 21.0 18.0 [2,] 21.5 22.5 21.5 21.5 22 23.0 22 21.5 22.5 23.0 23.0 21.0 [3,] 23.0 24.0 23.0 23.0 23 25.0 23 22.0 23.0 24.0 24.0 23.0 [4,] 24.5 25.5 25.0 25.0 24 25.5 24 23.5 24.0 24.5 24.5 24.5 [5,] 28.0 27.0 26.0 27.0 25 26.0 26 25.0 25.0 25.0 25.0 26.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 21.20845 22.20845 20.90986 20.90986 21.80563 23.50704 21.80563 20.80563 [2,] 24.79155 25.79155 25.09014 25.09014 24.19437 26.49296 24.19437 23.19437 [,9] [,10] [,11] [,12] [1,] 22.10422 23.10422 23.10422 20.90986 [2,] 23.89578 24.89578 24.89578 25.09014 $out [1] 27 27 $group [1] 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(21, 21.5, 23, 24.5, 28, 21, 22.5, 24, 25.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5hy0g1381934950.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,] -2.0 -4.0 -1.0 -4.0 -2 -5.0 -4.0 -3 -3.0 -3 -2.0 -3 [2,] -1.5 -1.5 -0.5 -1.5 0 -2.5 -2.0 0 -1.0 -1 -1.5 -2 [3,] 0.0 -1.0 0.0 1.0 2 -2.0 0.0 1 1.0 1 -1.0 -1 [4,] 3.0 0.5 1.0 1.5 2 1.0 1.5 2 2.5 1 0.0 3 [5,] 3.0 1.0 2.0 2.0 3 2.0 2.0 2 4.0 2 1.0 3 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.687327 -2.1943677 -0.8957758 -0.7915516 0.8056323 -4.09014354 -2.090144 [2,] 2.687327 0.1943677 0.8957758 2.7915516 3.1943677 0.09014354 2.090144 [,8] [,9] [,10] [,11] [,12] [1,] -0.1943677 -1.090144 -0.1943677 -1.8957758 -4.225161 [2,] 2.1943677 3.090144 2.1943677 -0.1042242 2.225161 $out [1] -4 4 -6 $group [1] 3 3 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-2, -1.5, 0, 3, 3, -4, -1.5, -1, 0.5, 1, -1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ds9q1381934950.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,] 23.0 21.0 20.0 21 21 22.0 18.0 NA [2,] 23.5 22.0 20.5 21 24 23.0 21.0 NA [3,] 24.0 23.5 21.0 23 25 24.0 22.5 NA [4,] 25.0 24.5 22.0 24 26 25.5 24.0 NA [5,] 27.0 26.0 24.0 25 28 27.0 26.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 23.31584 22.35973 20.31584 21.63168 24.08779 22.85973 21.13168 NA [2,] 24.68416 24.64027 21.68416 24.36832 25.91221 25.14027 23.86832 NA $out [1] 21 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(23, 23.5, 24, 25, 27, 21, 22, 23.5, 24.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7tfyq1381934950.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,] 22.57143 22 22.50 [2,] 23.07143 23 23.00 [3,] 23.21429 23 23.25 [4,] 23.85714 24 23.75 [5,] 24.14286 25 24.25 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 22.85592 22.54389 22.90792 [2,] 23.57266 23.45611 23.59208 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(22.5714285714286, 23.0714285714286, 23.2142857142857, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/115es1381934950.ps tmp/115es1381934950.png",intern=TRUE)) character(0) > try(system("convert tmp/224ze1381934950.ps tmp/224ze1381934950.png",intern=TRUE)) character(0) > try(system("convert tmp/3u0pp1381934950.ps tmp/3u0pp1381934950.png",intern=TRUE)) character(0) > try(system("convert tmp/4273h1381934950.ps tmp/4273h1381934950.png",intern=TRUE)) character(0) > try(system("convert tmp/5hy0g1381934950.ps tmp/5hy0g1381934950.png",intern=TRUE)) character(0) > try(system("convert tmp/6ds9q1381934950.ps tmp/6ds9q1381934950.png",intern=TRUE)) character(0) > try(system("convert tmp/7tfyq1381934950.ps tmp/7tfyq1381934950.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.045 1.069 6.089