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(58.972,59.249,63.955,53.785,52.760,44.795,37.348,32.370,32.717,40.974,33.591,21.124,58.608,46.865,51.378,46.235,47.206,45.382,41.227,33.795,31.295,42.625,33.625,21.538,56.421,53.152,53.536,52.408,41.454,38.271,35.306,26.414,31.917,38.030,27.534,18.387,50.556,43.901,48.572,43.899,37.532,40.357,35.489,29.027,34.485,42.598,30.306,26.451,47.460,50.104,61.465,53.726,39.477,43.895,31.481,29.896,33.842,39.120,33.702,25.094) > 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,] 58.972 58.608 56.421 50.556 47.460 NA [2,] 59.249 46.865 53.152 43.901 50.104 NA [3,] 63.955 51.378 53.536 48.572 61.465 NA [4,] 53.785 46.235 52.408 43.899 53.726 NA [5,] 52.760 47.206 41.454 37.532 39.477 NA [6,] 44.795 45.382 38.271 40.357 43.895 NA [7,] 37.348 41.227 35.306 35.489 31.481 NA [8,] 32.370 33.795 26.414 29.027 29.896 NA [9,] 32.717 31.295 31.917 34.485 33.842 NA [10,] 40.974 42.625 38.030 42.598 39.120 NA [11,] 33.591 33.625 27.534 30.306 33.702 NA [12,] 21.124 21.538 18.387 26.451 25.094 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/1afk41225293369.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/2kog01225293369.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/3rz7d1225293369.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/4xtko1225293369.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] [1,] 47.460 43.901 48.572 43.899 37.532 38.271 35.306 26.414 31.295 38.030 [2,] 50.556 46.865 51.378 46.235 39.477 40.357 35.306 29.027 31.917 39.120 [3,] 56.421 50.104 53.536 52.408 41.454 43.895 35.489 29.896 32.717 40.974 [4,] 58.608 53.152 61.465 53.726 47.206 44.795 37.348 32.370 33.842 42.598 [5,] 58.972 59.249 63.955 53.785 52.760 45.382 37.348 33.795 34.485 42.625 [,11] [,12] [1,] 27.534 18.387 [2,] 30.306 21.124 [3,] 33.591 21.538 [4,] 33.625 25.094 [5,] 33.702 26.451 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 50.73148 45.66162 46.40855 47.11488 35.99271 40.75912 34.04613 27.53384 [2,] 62.11052 54.54638 60.66345 57.70112 46.91529 47.03088 36.93187 32.25816 [,9] [,10] [,11] [,12] [1,] 31.3568 38.51645 31.2458 18.73281 [2,] 34.0772 43.43155 35.9362 24.34319 $out [1] 41.227 31.481 $group [1] 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(47.46, 50.556, 56.421, 58.608, 58.972, 43.901, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5vchq1225293369.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,] 21.1240 21.5380 18.3870 26.4510 25.0940 NA [2,] 33.1540 33.7100 29.7255 32.3955 32.5915 NA [3,] 42.8845 44.0035 38.1505 38.9445 39.2985 NA [4,] 56.3785 47.0355 52.7800 43.9000 48.7820 NA [5,] 63.9550 58.6080 56.4210 50.5560 61.4650 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 32.29165 37.92565 27.63519 33.69722 31.91390 NA [2,] 53.47735 50.08135 48.66581 44.19178 46.68310 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(21.124, 33.154, 42.8845, 56.3785, 63.955, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/64yuj1225293369.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,] 22.5188 21.538 23.1090 [2,] 32.3014 33.154 32.4225 [3,] 41.6047 41.214 41.7175 [4,] 50.3324 51.256 49.9945 [5,] 55.7812 56.421 56.4215 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 33.38064 32.95756 33.70279 [2,] 49.82876 49.47044 49.73221 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(22.5188, 32.3014, 41.6047, 50.3324, 55.7812, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1afk41225293369.ps tmp/1afk41225293369.png") > system("convert tmp/2kog01225293369.ps tmp/2kog01225293369.png") > system("convert tmp/3rz7d1225293369.ps tmp/3rz7d1225293369.png") > system("convert tmp/4xtko1225293369.ps tmp/4xtko1225293369.png") > system("convert tmp/5vchq1225293369.ps tmp/5vchq1225293369.png") > system("convert tmp/64yuj1225293369.ps tmp/64yuj1225293369.png") > > > proc.time() user system elapsed 1.286 0.835 2.139