R version 2.7.0 (2008-04-22) 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/rcomp/tmp/136451225564389.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/2937w1225564389.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/3iew61225564389.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/4k7mz1225564389.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,] 42.80 50.3 40.9 47.2 35.0 35.7 38.3 46.3 28.4 72.5 36.8 44.1 [2,] 45.10 54.0 49.5 61.0 36.9 39.1 51.3 49.0 41.5 78.4 37.3 44.6 [3,] 54.05 59.4 57.4 61.6 46.6 40.9 66.6 58.5 59.8 80.9 39.7 50.7 [4,] 72.50 70.9 60.8 81.1 54.5 41.4 71.2 67.9 72.0 132.1 40.1 51.9 [5,] 73.70 73.8 60.8 88.2 62.8 41.4 79.2 67.9 79.2 145.5 42.1 51.9 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 36.37612 47.4585 49.41545 47.39739 34.16388 39.27483 52.53871 45.14531 [2,] 71.72388 71.3415 65.38455 75.80261 59.03612 42.52517 80.66129 71.85469 [,9] [,10] [,11] [,12] [1,] 38.24878 42.95572 37.72153 45.54184 [2,] 81.35122 118.84428 41.67847 55.85816 $out [1] 85.7 87.0 112.0 69.0 $group [1] 3 6 8 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(42.8, 45.1, 54.05, 72.5, 73.7, 50.3, 54, 59.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5z35k1225564389.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,] 40.1 39.70 37.30 35.00 28.40 42.8 [2,] 65.9 49.25 49.55 41.80 37.60 42.8 [3,] 79.2 63.65 60.30 48.85 43.00 42.8 [4,] 87.6 72.90 68.75 52.65 48.75 42.8 [5,] 112.0 81.10 80.90 61.60 50.70 42.8 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 69.30248 52.86308 51.54275 43.90124 37.91441 42.8 [2,] 89.09752 74.43692 69.05725 53.79876 48.08559 42.8 $out [1] 132.1 145.5 72.5 78.4 $group [1] 1 2 4 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(40.1, 65.9, 79.2, 87.6, 112, 39.7, 49.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6u99b1225564389.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,] 39.20000 39.70 38.70000 [2,] 50.44000 48.65 46.97500 [3,] 57.94667 57.95 57.18125 [4,] 64.21000 60.70 61.85000 [5,] 67.82000 66.60 71.05000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 51.66608 52.45391 50.39666 [2,] 64.22726 63.44609 63.96584 $out [1] 101.88 80.90 105.25 $group [1] 1 2 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(39.2, 50.44, 57.9466666666667, 64.21, 67.82, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/136451225564389.ps tmp/136451225564389.png") > system("convert tmp/2937w1225564389.ps tmp/2937w1225564389.png") > system("convert tmp/3iew61225564389.ps tmp/3iew61225564389.png") > system("convert tmp/4k7mz1225564389.ps tmp/4k7mz1225564389.png") > system("convert tmp/5z35k1225564389.ps tmp/5z35k1225564389.png") > system("convert tmp/6u99b1225564389.ps tmp/6u99b1225564389.png") > > > proc.time() user system elapsed 2.298 1.339 2.526