R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(16,19,21,19,18,16,22,18,20,20,16,15,16,16,19,20,17,11,11,11,12,8,14,13,17,21,20,17,18,16,20,20,20,20,24,23,14,21,23,21,24,24,23,21,20,20,21,14,18,16,19,19,15,13,11,9,11,13,5,0) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Mean Plot (v1.0.1) 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 > #Technical description: Write here your technical program description > par1 <- as.numeric(par1) > (n <- length(x)) [1] 60 > (np <- floor(n / par1)) [1] 5 > arr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + if (j == par1) j = 0 + } > ari [1] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 16 16 17 14 18 NA [2,] 19 16 21 21 16 NA [3,] 21 19 20 23 19 NA [4,] 19 20 17 21 19 NA [5,] 18 17 18 24 15 NA [6,] 16 11 16 24 13 NA [7,] 22 11 20 23 11 NA [8,] 18 11 20 21 9 NA [9,] 20 12 20 20 11 NA [10,] 20 8 20 20 13 NA [11,] 16 14 24 21 5 NA [12,] 15 13 23 14 0 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/www/html/rcomp/tmp/1g7181229172193.ps",horizontal=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/www/html/rcomp/tmp/2vfy71229172193.ps",horizontal=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/www/html/rcomp/tmp/3v10p1229172193.ps",horizontal=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/www/html/rcomp/tmp/4yw6m1229172193.ps",horizontal=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 16 19 19 17 11 11 9 11 8 5 13 [2,] 16 16 19 19 17 13 11 11 12 13 14 13 [3,] 16 19 20 19 18 16 20 18 20 20 16 14 [4,] 17 21 21 20 18 16 22 20 20 20 21 15 [5,] 18 21 23 21 18 16 23 21 20 20 24 15 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 15.29340 15.46701 18.58681 18.29340 17.29340 13.88021 12.22743 11.64062 [2,] 16.70660 22.53299 21.41319 19.70660 18.70660 18.11979 27.77257 24.35938 [,9] [,10] [,11] [,12] [1,] 14.34722 15.05382 11.05382 12.58681 [2,] 25.65278 24.94618 20.94618 15.41319 $out [1] 14 17 24 15 24 23 0 $group [1] 1 4 5 5 6 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(16, 16, 16, 17, 18, 16, 16, 19, 21, 21, 19, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5rowr1229172193.ps",horizontal=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] [1,] 15.0 8.0 16.0 20 0 NA [2,] 16.0 11.0 17.5 20 10 NA [3,] 18.5 13.5 20.0 21 13 NA [4,] 20.0 16.5 20.5 23 17 NA [5,] 22.0 20.0 24.0 24 19 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 16.67557 10.99141 18.63168 19.63168 9.807253 NA [2,] 20.32443 16.00859 21.36832 22.36832 16.192747 NA $out [1] 14 14 $group [1] 4 4 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(15, 16, 18.5, 20, 22, 8, 11, 13.5, 16.5, 20, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6teer1229172193.ps",horizontal=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,] 13.0 14.0 14.00 [2,] 16.0 16.0 15.75 [3,] 16.4 18.5 16.50 [4,] 18.5 20.0 18.00 [5,] 20.4 20.0 20.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 15.25973 16.67557 15.47376 [2,] 17.54027 20.32443 17.52624 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(13, 16, 16.4, 18.5, 20.4, 14, 16, 18.5, 20, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1g7181229172193.ps tmp/1g7181229172193.png") > system("convert tmp/2vfy71229172193.ps tmp/2vfy71229172193.png") > system("convert tmp/3v10p1229172193.ps tmp/3v10p1229172193.png") > system("convert tmp/4yw6m1229172193.ps tmp/4yw6m1229172193.png") > system("convert tmp/5rowr1229172193.ps tmp/5rowr1229172193.png") > system("convert tmp/6teer1229172193.ps tmp/6teer1229172193.png") > > > proc.time() user system elapsed 1.093 0.847 1.707