R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 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(8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3,8.1,7.9,7.9,8.3,8.6,8.7,8.5,8.3,8,8,8.8,8.7,8.5,8.1,7.8,7.7,7.5,7.2,6.9,6.6,6.5,6.6,7.7,8,7.7,7.3,7,7,7.3,7.3,7.1,7.1,7,7,7.5,7.8,7.9,8.1,8.3,8.4) > 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,] 8.7 8.0 7.3 7.7 8.6 7.5 7.3 NA [2,] 8.7 8.0 7.1 8.0 8.7 7.2 7.3 NA [3,] 8.6 7.9 6.8 8.0 8.5 6.9 7.1 NA [4,] 8.5 8.0 6.4 7.7 8.3 6.6 7.1 NA [5,] 8.3 7.7 6.1 7.3 8.0 6.5 7.0 NA [6,] 8.0 7.2 6.5 7.4 8.0 6.6 7.0 NA [7,] 8.2 7.5 7.7 8.1 8.8 7.7 7.5 NA [8,] 8.1 7.3 7.9 8.3 8.7 8.0 7.8 NA [9,] 8.1 7.0 7.5 8.1 8.5 7.7 7.9 NA [10,] 8.0 7.0 6.9 7.9 8.1 7.3 8.1 NA [11,] 7.9 7.0 6.6 7.9 7.8 7.0 8.3 NA [12,] 7.9 7.2 6.9 8.3 7.7 7.0 8.4 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.0 0.0 -0.2 0.3 0.1 -0.3 0.0 NA [2,] -0.1 -0.1 -0.3 0.0 -0.2 -0.3 -0.2 NA [3,] -0.1 0.1 -0.4 -0.3 -0.2 -0.3 0.0 NA [4,] -0.2 -0.3 -0.3 -0.4 -0.3 -0.1 -0.1 NA [5,] -0.3 -0.5 0.4 0.1 0.0 0.1 0.0 NA [6,] 0.2 0.3 1.2 0.7 0.8 1.1 0.5 NA [7,] -0.1 -0.2 0.2 0.2 -0.1 0.3 0.3 NA [8,] 0.0 -0.3 -0.4 -0.2 -0.2 -0.3 0.1 NA [9,] -0.1 0.0 -0.6 -0.2 -0.4 -0.4 0.2 NA [10,] -0.1 0.0 -0.3 0.0 -0.3 -0.3 0.2 NA [11,] 0.0 0.2 0.3 0.4 -0.1 0.0 0.1 NA [12,] 0.1 0.1 0.8 0.3 -0.2 0.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/11m4c1400669230.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/2u3wn1400669230.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/3jf521400669230.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/4nrs91400669230.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,] 7.3 7.10 6.80 6.40 6.10 6.5 7.50 7.80 7.0 6.90 6.6 6.9 [2,] 7.4 7.25 7.00 6.85 6.75 6.8 7.60 7.85 7.6 7.15 7.0 7.1 [3,] 7.7 8.00 7.90 7.70 7.30 7.2 7.70 8.00 7.9 7.90 7.8 7.7 [4,] 8.3 8.35 8.25 8.15 7.85 7.7 8.15 8.20 8.1 8.05 7.9 8.1 [5,] 8.7 8.70 8.60 8.50 8.30 8.0 8.80 8.70 8.5 8.10 8.3 8.4 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.162535 7.343098 7.15352 6.923661 6.643098 6.662535 7.371549 7.790986 [2,] 8.237465 8.656902 8.64648 8.476339 7.956902 7.737465 8.028451 8.209014 [,9] [,10] [,11] [,12] [1,] 7.601408 7.362535 7.262535 7.102816 [2,] 8.198592 8.437465 8.337465 8.297184 $out [1] 7.3 $group [1] 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(7.3, 7.4, 7.7, 8.3, 8.7, 7.1, 7.25, 8, 8.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ir8w1400669230.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.30 -0.30 -0.40 -0.40 -0.50 0.20 -0.20 -0.4 -0.60 -0.3 -0.10 -0.2 [2,] -0.10 -0.25 -0.30 -0.30 -0.15 0.40 -0.10 -0.3 -0.40 -0.3 0.00 0.1 [3,] 0.00 -0.20 -0.20 -0.30 0.00 0.70 0.20 -0.2 -0.20 -0.1 0.10 0.2 [4,] 0.05 -0.10 -0.05 -0.15 0.10 0.95 0.25 -0.1 -0.05 0.0 0.25 0.3 [5,] 0.10 0.00 0.10 -0.10 0.40 1.20 0.30 0.1 0.20 0.2 0.40 0.3 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.08957758 -0.2895776 -0.34929597 -0.3895776 -0.149296 0.3715489 [2,] 0.08957758 -0.1104224 -0.05070403 -0.2104224 0.149296 1.0284511 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.009014354 -0.31943677 -0.409014354 -0.27915516 -0.04929597 0.07099354 [2,] 0.409014354 -0.08056323 0.009014354 0.07915516 0.24929597 0.32900646 $out [1] 0.3 0.8 $group [1] 1 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.3, -0.1, 0, 0.0499999999999998, 0.0999999999999996, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/64ex91400669230.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,] 7.90 7.00 6.10 7.30 7.70 6.50 7.0 NA [2,] 8.00 7.10 6.55 7.70 8.00 6.75 7.1 NA [3,] 8.15 7.40 6.90 7.95 8.40 7.10 7.4 NA [4,] 8.55 7.95 7.40 8.10 8.65 7.60 8.0 NA [5,] 8.70 8.00 7.90 8.30 8.80 8.00 8.4 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.899141 7.012309 6.512309 7.767557 8.103531 6.712309 6.989504 NA [2,] 8.400859 7.787691 7.287691 8.132443 8.696469 7.487691 7.810496 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(7.9, 8, 8.15, 8.55, 8.7, 7, 7.1, 7.4, 7.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7wbju1400669230.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,] 7.242857 7.70 7.2500 [2,] 7.507143 7.70 7.4750 [3,] 7.657143 7.75 7.6125 [4,] 7.864286 7.90 7.8500 [5,] 8.014286 8.00 8.0250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.494248 7.658779 7.44146 [2,] 7.820038 7.841221 7.78354 $out [1] 7.3 7.2 $group [1] 2 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(7.24285714285714, 7.50714285714286, 7.65714285714286, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/11m4c1400669230.ps tmp/11m4c1400669230.png",intern=TRUE)) character(0) > try(system("convert tmp/2u3wn1400669230.ps tmp/2u3wn1400669230.png",intern=TRUE)) character(0) > try(system("convert tmp/3jf521400669230.ps tmp/3jf521400669230.png",intern=TRUE)) character(0) > try(system("convert tmp/4nrs91400669230.ps tmp/4nrs91400669230.png",intern=TRUE)) character(0) > try(system("convert tmp/5ir8w1400669230.ps tmp/5ir8w1400669230.png",intern=TRUE)) character(0) > try(system("convert tmp/64ex91400669230.ps tmp/64ex91400669230.png",intern=TRUE)) character(0) > try(system("convert tmp/7wbju1400669230.ps tmp/7wbju1400669230.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.139 0.606 3.843