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(46,48,48,48,45,44,45,45,45,42,43,50,46,46,45,49,46,45,49,47,45,48,51,48,49,51,54,52,52,53,51,55,53,51,52,54,58,57,52,50,53,50,50,51,53,49,54,57,58,56,60,55,54,52,55,56,54,53,59,62,63,64,75,77,79,77,82,83,81,78,79,79,73) > 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] 73 > (np <- floor(n / par1)) [1] 6 > 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] 7 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 46 46 49 58 58 63 73 [2,] 48 46 51 57 56 64 NA [3,] 48 45 54 52 60 75 NA [4,] 48 49 52 50 55 77 NA [5,] 45 46 52 53 54 79 NA [6,] 44 45 53 50 52 77 NA [7,] 45 49 51 50 55 82 NA [8,] 45 47 55 51 56 83 NA [9,] 45 45 53 53 54 81 NA [10,] 42 48 51 49 53 78 NA [11,] 43 51 52 54 59 79 NA [12,] 50 48 54 57 62 79 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/1xr561225458758.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/2awte1225458758.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/300pm1225458758.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/4nchl1225458758.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,] 46.0 46.0 45 48 45.0 44 45.0 45 45 42 43 48.0 [2,] 47.5 48.0 48 49 46.0 45 49.0 47 45 48 51 50.0 [3,] 58.0 53.5 53 51 52.5 51 50.5 53 53 50 53 55.5 [4,] 60.5 57.0 60 55 54.0 53 55.0 56 54 53 59 62.0 [5,] 73.0 64.0 75 55 54.0 53 55.0 56 54 53 59 79.0 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 50.23661 47.69471 45.25961 47.12981 47.33974 45.83974 46.62981 47.19471 [2,] 65.76339 59.30529 60.74039 54.87019 57.66026 56.16026 54.37019 58.80529 [,9] [,10] [,11] [,12] [1,] 47.19471 46.77484 47.83974 47.75961 [2,] 58.80529 53.22516 58.16026 63.24039 $out [1] 77 79 77 82 83 81 78 79 $group [1] 4 5 6 7 8 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(46, 47.5, 58, 60.5, 73, 46, 48, 53.5, 57, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5ndyg1225458758.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] [,7] [1,] 42.0 45.0 49.0 49.0 52.0 75.0 73 [2,] 44.5 45.5 51.0 50.0 54.0 76.0 73 [3,] 45.0 46.5 52.0 52.5 55.5 78.5 73 [4,] 48.0 48.5 53.5 55.5 58.5 80.0 73 [5,] 50.0 51.0 55.0 58.0 62.0 83.0 73 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 43.40363 45.13168 50.85973 49.99141 53.44752 76.67557 73 [2,] 46.59637 47.86832 53.14027 55.00859 57.55248 80.32443 73 $out [1] 63 64 $group [1] 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(42, 44.5, 45, 48, 50, 45, 45.5, 46.5, 48.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6isbz1225458758.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,] 53.50000 50.00 49.5000 [2,] 54.25000 51.00 50.5000 [3,] 55.25000 53.00 51.8125 [4,] 56.15476 53.25 53.8750 [5,] 58.33333 55.50 55.8750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 54.38123 51.97376 50.27314 [2,] 56.11877 54.02624 53.35186 $out [1] 58 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(53.5, 54.25, 55.25, 56.1547619047619, 58.3333333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1xr561225458758.ps tmp/1xr561225458758.png") > system("convert tmp/2awte1225458758.ps tmp/2awte1225458758.png") > system("convert tmp/300pm1225458758.ps tmp/300pm1225458758.png") > system("convert tmp/4nchl1225458758.ps tmp/4nchl1225458758.png") > system("convert tmp/5ndyg1225458758.ps tmp/5ndyg1225458758.png") > system("convert tmp/6isbz1225458758.ps tmp/6isbz1225458758.png") > > > proc.time() user system elapsed 1.240 0.783 1.606