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(82.7,88.9,105.9,100.8,94,105,58.5,87.6,113.1,112.5,89.6,74.5,82.7,90.1,109.4,96,89.2,109.1,49.1,92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84.0,103.3,88.5,99.0,105.9,44.7,94.0,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6) > 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] 65 > (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 6 6 6 6 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 82.7 82.7 71.9 76.7 85.2 92.3 [2,] 88.9 90.1 82.9 84.0 91.3 99.4 [3,] 105.9 109.4 90.1 103.3 106.5 85.9 [4,] 100.8 96.0 100.7 88.5 92.4 109.4 [5,] 94.0 89.2 90.7 99.0 97.5 97.6 [6,] 105.0 109.1 108.8 105.9 107.0 NA [7,] 58.5 49.1 44.1 44.7 51.1 NA [8,] 87.6 92.9 93.6 94.0 98.6 NA [9,] 113.1 107.7 107.4 107.1 102.2 NA [10,] 112.5 103.5 96.5 104.8 114.3 NA [11,] 89.6 91.1 93.6 102.5 99.4 NA [12,] 74.5 79.8 76.5 77.7 72.5 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/1dbxb1226087082.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/2i8f91226087082.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/3m4mj1226087082.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/4g90j1226087082.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,] 71.9 82.9 85.9 88.50 89.20 105.0 44.1 92.9 107.1 96.5 89.6 72.5 [2,] 76.7 84.0 90.1 92.40 90.70 105.9 44.7 92.9 107.1 103.5 91.1 74.5 [3,] 82.7 89.5 104.6 98.35 95.75 107.0 49.1 93.6 107.4 104.8 93.6 76.5 [4,] 85.2 91.3 106.5 100.80 97.60 108.8 51.1 94.0 107.7 112.5 99.4 77.7 [5,] 92.3 99.4 109.4 109.40 99.00 109.1 58.5 94.0 107.7 114.3 102.5 79.8 $n [1] 6 6 6 6 6 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 77.21723 84.79126 94.02147 92.93173 91.29928 104.9509 44.57778 92.82274 [2,] 88.18277 94.20874 115.17853 103.76827 100.20072 109.0491 53.62222 94.37726 [,9] [,10] [,11] [,12] [1,] 106.9760 98.44062 87.73524 74.23889 [2,] 107.8240 111.15938 99.46476 78.76111 $out [1] 87.6 98.6 113.1 102.2 $group [1] 8 8 9 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(71.9, 76.7, 82.7, 85.2, 92.3, 82.9, 84, 89.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5s1l61226087082.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,] 58.50 79.80 71.90 76.70 72.50 85.9 [2,] 85.15 85.95 79.70 80.85 88.25 92.3 [3,] 91.80 92.00 92.15 96.50 98.05 97.6 [4,] 105.45 105.60 98.60 104.05 104.35 99.4 [5,] 113.10 109.40 108.80 107.10 114.30 109.4 $n [1] 12 12 12 12 12 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 82.54103 83.0375 83.52958 85.91832 90.70668 92.58316 [2,] 101.05897 100.9625 100.77042 107.08168 105.39332 102.61684 $out [1] 49.1 44.1 44.7 51.1 $group [1] 2 3 4 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(58.5, 85.15, 91.8, 105.45, 113.1, 79.8, 85.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6vb8h1226087082.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,] 76.20000 76.500 76.1000 [2,] 85.67500 86.100 84.7500 [3,] 94.95333 94.675 94.9000 [4,] 103.25167 104.700 103.6125 [5,] 107.50000 107.400 108.0000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 86.9365 86.19142 86.29669 [2,] 102.9702 103.15858 103.50331 $out [1] 49.5 49.1 47.9 $group [1] 1 2 3 $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/1dbxb1226087082.ps tmp/1dbxb1226087082.png") > system("convert tmp/2i8f91226087082.ps tmp/2i8f91226087082.png") > system("convert tmp/3m4mj1226087082.ps tmp/3m4mj1226087082.png") > system("convert tmp/4g90j1226087082.ps tmp/4g90j1226087082.png") > system("convert tmp/5s1l61226087082.ps tmp/5s1l61226087082.png") > system("convert tmp/6vb8h1226087082.ps tmp/6vb8h1226087082.png") > > > proc.time() user system elapsed 1.279 0.823 1.540