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(72.50,59.40,85.70,88.20,62.80,87.00,79.20,112.00,79.20,132.10,40.10,69.00,59.40,73.80,57.40,81.10,46.60,41.40,71.20,67.90,72.00,145.50,39.70,51.90,73.70,70.90,60.80,61.00,54.50,39.10,66.60,58.50,59.80,80.90,37.30,44.60,48.70,54.00,49.50,61.60,35.00,35.70,51.30,49.00,41.50,72.50,42.10,44.10,45.10,50.30,40.90,47.20,36.90,40.90,38.30,46.30,28.40,78.40,36.80,50.70,42.80) > 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] 61 > (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] 6 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 72.5 59.4 73.7 48.7 45.1 42.8 [2,] 59.4 73.8 70.9 54.0 50.3 NA [3,] 85.7 57.4 60.8 49.5 40.9 NA [4,] 88.2 81.1 61.0 61.6 47.2 NA [5,] 62.8 46.6 54.5 35.0 36.9 NA [6,] 87.0 41.4 39.1 35.7 40.9 NA [7,] 79.2 71.2 66.6 51.3 38.3 NA [8,] 112.0 67.9 58.5 49.0 46.3 NA [9,] 79.2 72.0 59.8 41.5 28.4 NA [10,] 132.1 145.5 80.9 72.5 78.4 NA [11,] 40.1 39.7 37.3 42.1 36.8 NA [12,] 69.0 51.9 44.6 44.1 50.7 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/freestat/rcomp/tmp/1y1sf1225740202.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/freestat/rcomp/tmp/2b8l31225740202.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/freestat/rcomp/tmp/3me771225740202.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/freestat/rcomp/tmp/4wobh1225740202.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(arr)) > names(z) <- c(1:par1) > (boxplot(log(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] [1,] 3.756538 3.918005 3.711130 3.854394 3.555348 3.666122 3.645450 3.835142 [2,] 3.808882 3.988984 3.901973 4.110874 3.608212 3.666122 3.937691 3.891820 [3,] 3.984987 4.084294 4.050044 4.120662 3.841601 3.711130 4.198705 4.069027 [4,] 4.283587 4.261270 4.107590 4.395683 3.998201 3.723281 4.265493 4.218036 [5,] 4.300003 4.301359 4.107590 4.479607 4.139955 3.723281 4.371976 4.218036 [,9] [,10] [,11] [,12] [1,] 3.346389 4.283587 3.605498 3.786460 [2,] 3.725693 4.361824 3.618993 3.797734 [3,] 4.091006 4.393214 3.681351 3.925926 [4,] 4.276666 4.883559 3.691376 3.949319 [5,] 4.371976 4.980176 3.740048 3.949319 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.678787 3.891897 3.904756 3.919416 3.566035 3.670742 3.967080 3.838524 [2,] 4.291186 4.276691 4.195333 4.321907 4.117166 3.751518 4.430329 4.299530 [,9] [,10] [,11] [,12] [1,] 3.701690 4.024557 3.630206 3.818816 [2,] 4.480322 4.761871 3.732497 4.033035 $out [1] 4.450853 4.465908 3.575151 4.718499 4.234107 $group [1] 3 6 6 8 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3.75653810258775, 3.80888224650863, 3.98498662822857, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/50cxu1225740202.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(arr) > names(z) <- c(1:np) > (boxplot(log(z),notch=TRUE,col='grey',xlab='Block Index',ylab='Value',main='Notched Box Plots - Sequential Blocks')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [1,] 4.084294 3.681351 3.618993 3.555348 3.346389 3.756538 [2,] 4.187031 3.895460 3.897967 3.732871 3.626831 3.756538 [3,] 4.371976 4.151165 4.099298 3.888750 3.760006 3.756538 [4,] 4.472758 4.289012 4.229988 3.963337 3.886199 3.756538 [5,] 4.883559 4.395683 4.393214 4.283587 3.925926 3.756538 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 4.241654 3.971663 3.947861 3.783632 3.641706 3.756538 [2,] 4.502298 4.330667 4.250734 3.993867 3.878306 3.756538 $out [1] 3.691376 4.980176 4.361824 $group [1] 1 2 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(4.0842942263686, 4.18703078903571, 4.37197629882038, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/61at31225740202.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(log(z),notch=TRUE,col='grey',ylab='Overall Central Tendency',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 3.668677 3.681351 3.655840 [2,] 3.920268 3.883763 3.849247 [3,] 4.059399 4.059536 4.046198 [4,] 4.161382 4.105834 4.124665 [5,] 4.216857 4.393214 4.263384 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.949425 3.958248 3.920578 [2,] 4.169372 4.160823 4.171818 $out [1] 4.623796 4.656338 $group [1] 1 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(3.66867674679642, 3.92026848226562, 4.05939881751768, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1y1sf1225740202.ps tmp/1y1sf1225740202.png") > system("convert tmp/2b8l31225740202.ps tmp/2b8l31225740202.png") > system("convert tmp/3me771225740202.ps tmp/3me771225740202.png") > system("convert tmp/4wobh1225740202.ps tmp/4wobh1225740202.png") > system("convert tmp/50cxu1225740202.ps tmp/50cxu1225740202.png") > system("convert tmp/61at31225740202.ps tmp/61at31225740202.png") > > > proc.time() user system elapsed 1.969 1.301 2.621