R version 2.8.0 (2008-10-20) 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(41,35,34,36,39,40,30,33,30,32,41,40,41,40,39,34,34,46,45,44,40,39,37,39,35,26,26,33,27,30,26,27,18,19,13,14,41,21,16,17,9,14,14,16,11,10,6,9,5,7,2,0,8,13,11,19,23,23,43,59) > 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,] 41 41 35 41 5 NA [2,] 35 40 26 21 7 NA [3,] 34 39 26 16 2 NA [4,] 36 34 33 17 0 NA [5,] 39 34 27 9 8 NA [6,] 40 46 30 14 13 NA [7,] 30 45 26 14 11 NA [8,] 33 44 27 16 19 NA [9,] 30 40 18 11 23 NA [10,] 32 39 19 10 23 NA [11,] 41 37 13 6 43 NA [12,] 40 39 14 9 59 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/1tjxs1229383208.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/2k6xw1229383208.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/3t7001229383208.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/4iif81229383208.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,] 35 7 2 0 8 13 11 16 11 10 6 9 [2,] 35 21 16 17 9 14 14 19 18 19 13 14 [3,] 41 26 26 33 27 30 26 27 23 23 37 39 [4,] 41 35 34 34 34 40 30 33 30 32 41 40 [5,] 41 40 39 36 39 46 45 44 40 39 43 59 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 36.76042 16.10764 13.28125 20.98784 9.335063 11.62847 14.69444 17.10764 [2,] 45.23958 35.89236 38.71875 45.01216 44.664937 48.37153 37.30556 36.89236 [,9] [,10] [,11] [,12] [1,] 14.52083 13.81423 17.21527 20.62847 [2,] 31.47917 32.18577 56.78473 57.37153 $out [1] 5 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(35, 35, 41, 41, 41, 7, 21, 26, 35, 40, 2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5etd41229383208.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,] 30.0 34.0 13.0 6.0 0 NA [2,] 32.5 38.0 18.5 9.5 6 NA [3,] 35.5 39.5 26.0 14.0 12 NA [4,] 40.0 42.5 28.5 16.5 23 NA [5,] 41.0 46.0 35.0 21.0 43 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 32.0792 37.44752 21.43893 10.80725 4.246186 NA [2,] 38.9208 41.55248 30.56107 17.19275 19.753814 NA $out [1] 41 59 $group [1] 4 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(30, 32.5, 35.5, 40, 41, 34, 38, 39.5, 42.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6shea1229383208.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,] 23.4 23 21.50 [2,] 24.2 26 24.50 [3,] 25.5 27 25.75 [4,] 28.3 35 27.00 [5,] 32.6 41 28.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 23.62996 22.89504 24.60973 [2,] 27.37004 31.10496 26.89027 $out [1] 38 $group [1] 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(23.4, 24.2, 25.5, 28.3, 32.6, 23, 26, 27, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1tjxs1229383208.ps tmp/1tjxs1229383208.png") > system("convert tmp/2k6xw1229383208.ps tmp/2k6xw1229383208.png") > system("convert tmp/3t7001229383208.ps tmp/3t7001229383208.png") > system("convert tmp/4iif81229383208.ps tmp/4iif81229383208.png") > system("convert tmp/5etd41229383208.ps tmp/5etd41229383208.png") > system("convert tmp/6shea1229383208.ps tmp/6shea1229383208.png") > > > proc.time() user system elapsed 1.067 0.805 1.318