R version 2.7.2 (2008-08-25) 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(29,34,34,30,21,23,18,27,20,25,24,23,18,22,22,18,19,18,22,22,20,14,15,14,19,23,23,17,21,17,24,18,17,18,16,15,21,17,11,13,11,13,13,14,18,13,16,13,15,20,17,18,17,20,18,18,21,19,17,20,19,24,21,21,16,18,17,16,11,14,11,20,22,18,17,18,15,19,18,15,16,17,12,16,14,18,17,10,18,16,13,13,13,13,5,8,5,4,4,1,6,4,5,4,11) > 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] 105 > (np <- floor(n / par1)) [1] 8 > 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] 9 9 9 9 9 9 9 9 9 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 29 18 19 21 15 19 22 14 5 [2,] 34 22 23 17 20 24 18 18 4 [3,] 34 22 23 11 17 21 17 17 4 [4,] 30 18 17 13 18 21 18 10 1 [5,] 21 19 21 11 17 16 15 18 6 [6,] 23 18 17 13 20 18 19 16 4 [7,] 18 22 24 13 18 17 18 13 5 [8,] 27 22 18 14 18 16 15 13 4 [9,] 20 20 17 18 21 11 16 13 11 [10,] 25 14 18 13 19 14 17 13 NA [11,] 24 15 16 16 17 11 12 5 NA [12,] 23 14 15 13 20 20 16 8 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/1cz9k1225643408.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/2l60h1225643408.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/3v17q1225643408.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/4qf2u1225643408.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,] 14 17 11 10 11 13 13 13 11 13.0 5.0 8.0 [2,] 15 18 17 13 15 16 13 14 13 13.5 11.5 13.5 [3,] 19 20 17 18 17 18 18 16 17 15.5 15.5 15.5 [4,] 21 23 22 18 19 19 18 18 20 18.5 16.5 20.0 [5,] 29 24 23 21 21 23 24 22 21 25.0 24.0 23.0 $n [1] 9 9 9 9 9 9 9 9 9 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 15.84 17.36667 14.36667 15.36667 14.89333 16.42 15.36667 13.89333 13.31333 [2,] 22.16 22.63333 19.63333 20.63333 19.10667 19.58 20.63333 18.10667 20.68667 [,10] [,11] [,12] [1,] 12.70693 12.70693 11.86901 [2,] 18.29307 18.29307 19.13099 $out [1] 5 34 4 34 4 30 1 6 4 5 27 4 $group [1] 1 2 2 3 3 4 4 5 6 7 8 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(14, 15, 19, 21, 29, 17, 18, 20, 23, 24, 11, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5r0jt1225643408.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] [,7] [,8] [,9] [1,] 18.0 14.0 15 11.0 15 11.0 12.0 5.0 4 [2,] 22.0 16.5 17 13.0 17 15.0 15.5 11.5 4 [3,] 24.5 18.5 18 13.0 18 17.5 17.0 13.0 4 [4,] 29.5 22.0 22 16.5 20 20.5 18.0 16.5 5 [5,] 34.0 22.0 24 21.0 21 24.0 19.0 18.0 6 $n [1] 12 12 12 12 12 12 12 12 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 21.0792 15.99141 15.71947 11.40363 16.63168 14.99141 15.85973 10.71947 [2,] 27.9208 21.00859 20.28053 14.59637 19.36832 20.00859 18.14027 15.28053 [,9] [1,] 3.473333 [2,] 4.526667 $out [1] 22 1 11 $group [1] 7 9 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(18, 22, 24.5, 29.5, 34, 14, 16.5, 18.5, 22, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6e1zu1225643408.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,] 14.50000 15.50 14.0000 [2,] 16.17361 15.75 15.7500 [3,] 16.38889 17.00 16.6875 [4,] 17.31250 18.00 17.7500 [5,] 18.44444 20.00 20.5000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 15.86943 15.97376 15.77529 [2,] 16.90834 18.02624 17.59971 $out [1] 20 $group [1] 1 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(14.5, 16.1736111111111, 16.3888888888889, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1cz9k1225643408.ps tmp/1cz9k1225643408.png") > system("convert tmp/2l60h1225643408.ps tmp/2l60h1225643408.png") > system("convert tmp/3v17q1225643408.ps tmp/3v17q1225643408.png") > system("convert tmp/4qf2u1225643408.ps tmp/4qf2u1225643408.png") > system("convert tmp/5r0jt1225643408.ps tmp/5r0jt1225643408.png") > system("convert tmp/6e1zu1225643408.ps tmp/6e1zu1225643408.png") > > > proc.time() user system elapsed 1.297 0.832 1.559