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(19.4,19.4,19.4,19.5,19.5,19.5,28.7,28.7,28.7,21.8,21.8,21.8,20,20,20,22.6,22.6,22.6,22.4,22.4,22.4,18.6,18.6,18.6,16.2,16.2,16.2,13.8,13.8,13.8,24.1,24.1,24.1,19.9,19.9,19.9,22.3,22.3,22.3,20.9,20.9,20.9,23.5,23.5,23.5,23.1,23.1,23.1,25.7,25.7,25.7,19.7,19.7,19.7,23.1,23.1,23.1,20.7,20.7,20.7,18,18,18,16.9,16.9,16.9,24.4,24.4,24.4,15.5,15.5,15.5,18.4,18.4,18.4,16.2,16.2,16.2,20.6,20.6,20.6,19.8,19.8,19.8) > 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,] 19.4 20.0 16.2 22.3 25.7 18.0 18.4 NA [2,] 19.4 20.0 16.2 22.3 25.7 18.0 18.4 NA [3,] 19.4 20.0 16.2 22.3 25.7 18.0 18.4 NA [4,] 19.5 22.6 13.8 20.9 19.7 16.9 16.2 NA [5,] 19.5 22.6 13.8 20.9 19.7 16.9 16.2 NA [6,] 19.5 22.6 13.8 20.9 19.7 16.9 16.2 NA [7,] 28.7 22.4 24.1 23.5 23.1 24.4 20.6 NA [8,] 28.7 22.4 24.1 23.5 23.1 24.4 20.6 NA [9,] 28.7 22.4 24.1 23.5 23.1 24.4 20.6 NA [10,] 21.8 18.6 19.9 23.1 20.7 15.5 19.8 NA [11,] 21.8 18.6 19.9 23.1 20.7 15.5 19.8 NA [12,] 21.8 18.6 19.9 23.1 20.7 15.5 19.8 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [2,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [3,] 0.1 2.6 -2.4 -1.4 -6.0 -1.1 -2.2 NA [4,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [5,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [6,] 9.2 -0.2 10.3 2.6 3.4 7.5 4.4 NA [7,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [8,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [9,] -6.9 -3.8 -4.2 -0.4 -2.4 -8.9 -0.8 NA [10,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [11,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NA [12,] -1.8 -2.4 2.4 2.6 -2.7 2.9 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/1kfm71381938509.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/2nch51381938509.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/3b8mt1381938509.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/4uiyg1381938509.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,] 16.20 16.20 16.20 13.80 13.80 13.80 20.60 20.60 20.60 18.60 18.60 18.60 [2,] 18.20 18.20 18.20 16.55 16.55 16.55 22.75 22.75 22.75 19.20 19.20 19.20 [3,] 19.40 19.40 19.40 19.50 19.50 19.50 23.50 23.50 23.50 19.90 19.90 19.90 [4,] 21.15 21.15 21.15 20.30 20.30 20.30 24.25 24.25 24.25 21.25 21.25 21.25 [5,] 22.30 22.30 22.30 22.60 22.60 22.60 24.40 24.40 24.40 23.10 23.10 23.10 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 17.63831 17.63831 17.63831 17.26056 17.26056 17.26056 22.60422 22.60422 [2,] 21.16169 21.16169 21.16169 21.73944 21.73944 21.73944 24.39578 24.39578 [,9] [,10] [,11] [,12] [1,] 22.60422 18.67577 18.67577 18.67577 [2,] 24.39578 21.12423 21.12423 21.12423 $out [1] 25.7 25.7 25.7 28.7 28.7 28.7 15.5 15.5 15.5 $group [1] 1 2 3 7 8 9 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(16.2, 18.2, 19.4, 21.15, 22.3, 16.2, 18.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5dn3l1381938509.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,] 0 0 -2.4 0 0 -0.20 0 0 -8.90 0 0 -2.7 [2,] 0 0 -2.3 0 0 3.00 0 0 -5.55 0 0 -2.4 [3,] 0 0 -1.4 0 0 4.40 0 0 -3.80 0 0 0.3 [4,] 0 0 -0.5 0 0 8.35 0 0 -1.60 0 0 2.6 [5,] 0 0 0.1 0 0 10.30 0 0 -0.40 0 0 2.9 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 0 0 -2.474931 0 0 1.205066 0 0 -6.158876 0 0 [2,] 0 0 -0.325069 0 0 7.594934 0 0 -1.441124 0 0 [,12] [1,] -2.925161 [2,] 3.525161 $out [1] 2.6 -6.0 $group [1] 3 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.4, -2.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6pb9g1381938509.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,] 19.40 18.6 13.80 20.9 19.7 15.50 16.2 NA [2,] 19.45 19.3 15.00 21.6 20.2 16.20 17.3 NA [3,] 20.65 21.2 18.05 22.7 21.9 17.45 19.1 NA [4,] 25.25 22.5 22.00 23.3 24.4 21.20 20.2 NA [5,] 28.70 22.6 24.10 23.5 25.7 24.40 20.6 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 18.00458 19.74046 14.85725 21.92462 19.98435 15.16947 17.77729 NA [2,] 23.29542 22.65954 21.24275 23.47538 23.81565 19.73053 20.42271 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(19.4, 19.45, 20.65, 25.25, 28.7, 18.6, 19.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7sxab1381938509.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,] 18.51429 19.40 18.4250 [2,] 19.21429 19.45 19.0500 [3,] 19.95714 19.70 19.9500 [4,] 21.91429 21.70 21.8625 [5,] 23.82857 23.50 23.5000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 18.72565 18.67376 18.6672 [2,] 21.18863 20.72624 21.2328 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(18.5142857142857, 19.2142857142857, 19.9571428571429, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kfm71381938509.ps tmp/1kfm71381938509.png",intern=TRUE)) character(0) > try(system("convert tmp/2nch51381938509.ps tmp/2nch51381938509.png",intern=TRUE)) character(0) > try(system("convert tmp/3b8mt1381938509.ps tmp/3b8mt1381938509.png",intern=TRUE)) character(0) > try(system("convert tmp/4uiyg1381938509.ps tmp/4uiyg1381938509.png",intern=TRUE)) character(0) > try(system("convert tmp/5dn3l1381938509.ps tmp/5dn3l1381938509.png",intern=TRUE)) character(0) > try(system("convert tmp/6pb9g1381938509.ps tmp/6pb9g1381938509.png",intern=TRUE)) character(0) > try(system("convert tmp/7sxab1381938509.ps tmp/7sxab1381938509.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.072 0.542 3.610