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(23,23,19,11,13,8,0,2,7,5,9,6,10,11,16,14,14,9,17,16,21,41,14,13,19,18,27,26,30,27,33,26,26,35,39,37,39,40,44,45,46,34,34,39,40,41,40,41,32,30,33,30,40,39,36,34,35,41,44,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,] 23 10 19 39 32 NA [2,] 23 11 18 40 30 NA [3,] 19 16 27 44 33 NA [4,] 11 14 26 45 30 NA [5,] 13 14 30 46 40 NA [6,] 8 9 27 34 39 NA [7,] 0 17 33 34 36 NA [8,] 2 16 26 39 34 NA [9,] 7 21 26 40 35 NA [10,] 5 41 35 41 41 NA [11,] 9 14 39 40 44 NA [12,] 6 13 37 41 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/13z191225458007.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/2or6n1225458007.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/3di3y1225458007.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/4yi021225458007.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,] 10 11 16 11 13 8 0 2 7 35 9 6 [2,] 19 18 19 14 14 9 17 16 21 35 14 13 [3,] 23 23 27 26 30 27 33 26 26 41 39 37 [4,] 32 30 33 30 40 34 34 34 35 41 40 41 [5,] 39 40 44 45 46 39 36 39 40 41 44 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,] 13.81423 14.52083 17.10764 14.69444 11.62847 9.335063 20.98784 13.28125 [2,] 32.18577 31.47917 36.89236 37.30556 48.37153 44.664937 45.01216 38.71875 [,9] [,10] [,11] [,12] [1,] 16.10764 36.76042 20.62847 17.21527 [2,] 35.89236 45.23958 57.37153 56.78473 $out [1] 5 $group [1] 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(10, 19, 23, 32, 39, 11, 18, 23, 30, 40, 16, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/59d5s1225458007.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,] 0.0 9.0 18 34.0 30.0 NA [2,] 5.5 12.0 26 39.0 32.5 NA [3,] 8.5 14.0 27 40.0 35.5 NA [4,] 16.0 16.5 34 42.5 40.5 NA [5,] 23.0 21.0 39 46.0 44.0 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 3.710880 11.94752 23.35115 38.40363 31.85115 NA [2,] 13.289120 16.05248 30.64885 41.59637 39.14885 NA $out [1] 41 59 $group [1] 2 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(0, 5.5, 8.5, 16, 23, 9, 12, 14, 16.5, 21, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6g2iw1225458007.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.9 35 27.00 [5,] 32.6 41 28.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 23.3563 22.89504 24.60973 [2,] 27.6437 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.9, 32.6, 23, 26, 27, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/13z191225458007.ps tmp/13z191225458007.png") > system("convert tmp/2or6n1225458007.ps tmp/2or6n1225458007.png") > system("convert tmp/3di3y1225458007.ps tmp/3di3y1225458007.png") > system("convert tmp/4yi021225458007.ps tmp/4yi021225458007.png") > system("convert tmp/59d5s1225458007.ps tmp/59d5s1225458007.png") > system("convert tmp/6g2iw1225458007.ps tmp/6g2iw1225458007.png") > > > proc.time() user system elapsed 1.350 0.838 2.707