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(100.3,97.6,89.1,99.1,94.9,96.5,92.6,80.8,89.5,101.4,95.9,92.3,91.2,88.3,80.7,89.9,87.2,86.9,82.8,72.6,81.3,91.2,87.3,83.4,81.7,80.2,74.1,80.6,79.0,79.3,71.2,78.1,68.2,81.0,106.9,123.7,73.7,69.2,72.5,75.7,73.5,70.4,65.7,68.1,62.4,64.7,77.7,85.9,61.0,57.4,75.1,75.9,71.8,72.3,67.3,71.5,67.6,74.2,77.6,76.4,74.2) > 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,] 100.3 91.2 81.7 73.7 61.0 74.2 [2,] 97.6 88.3 80.2 69.2 57.4 NA [3,] 89.1 80.7 74.1 72.5 75.1 NA [4,] 99.1 89.9 80.6 75.7 75.9 NA [5,] 94.9 87.2 79.0 73.5 71.8 NA [6,] 96.5 86.9 79.3 70.4 72.3 NA [7,] 92.6 82.8 71.2 65.7 67.3 NA [8,] 80.8 72.6 78.1 68.1 71.5 NA [9,] 89.5 81.3 68.2 62.4 67.6 NA [10,] 101.4 91.2 81.0 64.7 74.2 NA [11,] 95.9 87.3 106.9 77.7 77.6 NA [12,] 92.3 83.4 123.7 85.9 76.4 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/1bidq1225651242.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/275te1225651242.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/3ox571225651242.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/4c6tz1225651242.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,] 61.00 57.4 72.5 75.7 71.8 70.4 65.7 68.1 62.4 64.7 77.6 76.4 [2,] 73.70 69.2 74.1 75.9 73.5 72.3 67.3 71.5 67.6 74.2 77.7 83.4 [3,] 77.95 80.2 75.1 80.6 79.0 79.3 71.2 72.6 68.2 81.0 87.3 85.9 [4,] 91.20 88.3 80.7 89.9 87.2 86.9 82.8 78.1 81.3 91.2 95.9 92.3 [5,] 100.30 97.6 89.1 99.1 94.9 96.5 92.6 80.8 89.5 101.4 106.9 92.3 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 66.66193 66.70399 70.43646 70.70764 69.31961 68.98368 60.24774 67.93646 [2,] 89.23807 93.69601 79.76354 90.49236 88.68039 89.61632 82.15226 77.26354 [,9] [,10] [,11] [,12] [1,] 58.51961 68.98784 74.43993 79.61128 [2,] 77.88039 93.01216 100.16007 92.18872 $out [1] 123.7 $group [1] 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(61, 73.7, 77.95, 91.2, 100.3, 57.4, 69.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/51qp91225651242.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,] 80.80 72.60 71.20 62.40 57.40 74.2 [2,] 90.90 82.05 76.10 66.90 67.45 74.2 [3,] 95.40 87.05 79.75 71.45 72.05 74.2 [4,] 98.35 89.10 81.35 74.70 75.50 74.2 [5,] 101.40 91.20 81.70 85.90 77.60 74.2 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 92.002 83.83445 77.35544 67.89237 68.37834 74.2 [2,] 98.798 90.26555 82.14456 75.00763 75.72166 74.2 $out [1] 68.2 106.9 123.7 $group [1] 3 3 3 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(80.8, 90.9, 95.4, 98.35, 101.4, 72.6, 82.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6ihfm1225651242.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,] 73.800 68.20 74.450 [2,] 77.110 73.85 76.225 [3,] 80.715 79.15 79.975 [4,] 83.370 80.80 82.800 [5,] 92.340 87.30 87.850 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 77.85977 75.98006 76.9761 [2,] 83.57023 82.31994 82.9739 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(73.8, 77.11, 80.715, 83.37, 92.34, 68.2, 73.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1bidq1225651242.ps tmp/1bidq1225651242.png") > system("convert tmp/275te1225651242.ps tmp/275te1225651242.png") > system("convert tmp/3ox571225651242.ps tmp/3ox571225651242.png") > system("convert tmp/4c6tz1225651242.ps tmp/4c6tz1225651242.png") > system("convert tmp/51qp91225651242.ps tmp/51qp91225651242.png") > system("convert tmp/6ihfm1225651242.ps tmp/6ihfm1225651242.png") > > > proc.time() user system elapsed 2.302 1.366 2.526