R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(105.5,106.4,117.9,89.7,88.5,106.4,61.4,92.3,95.5,92.5,89.6,84.3,76.3,80.7,96.3,81,82.9,90.3,74.8,70.1,86.7,86.4,89.9,88.1,78.8,81.1,85.4,82.6,80.3,81.2,68,67.4,91.3,94.9,82.8,88.6,73.1,76.7,93.2,84.9,83.8,93.5,91.9,69.6,87,90.2,82.7,91.4,74.6,76.1,87.1,78.4,81.3,99.3,71,73.2,95.6,84,90.8,93.6,80.9,84.4,97.3,83.5,88.8,100.7,69.4,74.6,96.6,96.6,93.1,91.8,85.7,79.1,91.3,84.2,85.8,90,76.6,81.3) > 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] 80 > (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 7 7 7 7 7 7 7 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 105.5 76.3 78.8 73.1 74.6 80.9 85.7 [2,] 106.4 80.7 81.1 76.7 76.1 84.4 79.1 [3,] 117.9 96.3 85.4 93.2 87.1 97.3 91.3 [4,] 89.7 81.0 82.6 84.9 78.4 83.5 84.2 [5,] 88.5 82.9 80.3 83.8 81.3 88.8 85.8 [6,] 106.4 90.3 81.2 93.5 99.3 100.7 90.0 [7,] 61.4 74.8 68.0 91.9 71.0 69.4 76.6 [8,] 92.3 70.1 67.4 69.6 73.2 74.6 81.3 [9,] 95.5 86.7 91.3 87.0 95.6 96.6 NA [10,] 92.5 86.4 94.9 90.2 84.0 96.6 NA [11,] 89.6 89.9 82.8 82.7 90.8 93.1 NA [12,] 84.3 88.1 88.6 91.4 93.6 91.8 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/1zw1i1196187745.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/2ll8y1196187745.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/3z2e21196187745.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/4iz491196187745.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,] 73.10 76.10 85.4 78.40 80.30 81.20 61.4 67.40 86.7 84.00 82.70 84.3 [2,] 75.45 77.90 89.2 81.80 82.10 90.15 68.7 69.85 87.0 86.40 82.80 88.1 [3,] 78.80 80.70 93.2 83.50 83.80 93.50 71.0 73.20 93.4 91.35 89.75 90.0 [4,] 83.30 82.75 96.8 84.55 87.15 100.00 75.7 77.95 95.6 94.90 90.80 91.8 [5,] 85.70 84.40 97.3 84.90 88.80 106.40 76.6 81.30 96.6 96.60 93.10 93.6 $n [1] 7 7 7 7 7 7 7 7 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 74.1121 77.80366 88.6614 81.85774 80.78422 87.61774 66.81971 68.36281 [2,] 83.4879 83.59634 97.7386 85.14226 86.81578 99.38226 75.18029 78.03719 [,9] [,10] [,11] [,12] [1,] 87.85272 85.86723 84.58974 87.61338 [2,] 98.94728 96.83277 94.91026 92.38662 $out [1] 105.5 106.4 117.9 89.7 91.9 92.3 $group [1] 1 2 3 4 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(73.1, 75.45, 78.8, 83.3, 85.7, 76.1, 77.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5s2d61196187745.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,] 84.30 70.10 78.80 69.60 71.00 69.4 76.60 [2,] 89.05 78.50 79.55 79.70 75.35 82.2 80.20 [3,] 92.40 84.65 81.90 85.95 82.65 90.3 84.95 [4,] 105.95 89.00 87.00 91.65 92.20 96.6 87.90 [5,] 117.90 96.30 94.90 93.50 99.30 100.7 91.30 $n [1] 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 84.6918 79.86088 78.502 80.49952 74.9646 83.73206 80.64867 [2,] 100.1082 89.43912 85.298 91.40048 90.3354 96.86794 89.25133 $out [1] 61.4 68.0 67.4 $group [1] 1 3 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(84.3, 89.05, 92.4, 105.95, 117.9, 70.1, 78.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6nych1196187745.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.30000 71.000 72.20000 [2,] 82.80000 79.750 79.85000 [3,] 86.31786 86.775 86.08125 [4,] 91.44167 92.275 91.32500 [5,] 95.50000 93.500 95.07500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 82.37633 81.06226 80.84743 [2,] 90.25938 92.48774 91.31507 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(73.3, 82.8, 86.3178571428572, 91.4416666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1zw1i1196187745.ps tmp/1zw1i1196187745.png") > system("convert tmp/2ll8y1196187745.ps tmp/2ll8y1196187745.png") > system("convert tmp/3z2e21196187745.ps tmp/3z2e21196187745.png") > system("convert tmp/4iz491196187745.ps tmp/4iz491196187745.png") > system("convert tmp/5s2d61196187745.ps tmp/5s2d61196187745.png") > system("convert tmp/6nych1196187745.ps tmp/6nych1196187745.png") > > > proc.time() user system elapsed 1.327 0.832 1.572