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(109.20,88.60,94.30,98.30,86.40,80.60,104.10,108.20,93.40,71.90,94.10,94.90,96.40,91.10,84.40,86.40,88.00,75.10,109.70,103.00,82.10,68.00,96.40,94.30,90.00,88.00,76.10,82.50,81.40,66.50,97.20,94.10,80.70,70.50,87.80,89.50,99.60,84.20,75.10,92.00,80.80,73.10,99.80,90.00,83.10,72.40,78.80,87.30,91.00,80.10,73.60,86.40,74.50,71.20,92.40,81.50,85.30,69.90,84.20,90.70,100.30) > 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] 61 > (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 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 109.2 96.4 90.0 99.6 91.0 100.3 [2,] 88.6 91.1 88.0 84.2 80.1 NA [3,] 94.3 84.4 76.1 75.1 73.6 NA [4,] 98.3 86.4 82.5 92.0 86.4 NA [5,] 86.4 88.0 81.4 80.8 74.5 NA [6,] 80.6 75.1 66.5 73.1 71.2 NA [7,] 104.1 109.7 97.2 99.8 92.4 NA [8,] 108.2 103.0 94.1 90.0 81.5 NA [9,] 93.4 82.1 80.7 83.1 85.3 NA [10,] 71.9 68.0 70.5 72.4 69.9 NA [11,] 94.1 96.4 87.8 78.8 84.2 NA [12,] 94.9 94.3 89.5 87.3 90.7 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/freestat/rcomp/tmp/1d1v51225991415.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/freestat/rcomp/tmp/2pjyg1225991416.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/freestat/rcomp/tmp/3j2ld1225991416.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/freestat/rcomp/tmp/42lj31225991416.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(arr)) > names(z) <- c(1:par1) > (boxplot(log(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] [1,] 4.499810 4.383276 4.298645 4.412798 4.310799 4.197202 4.526127 4.400603 [2,] 4.510860 4.433195 4.318821 4.458988 4.391977 4.265493 4.576771 4.499810 [3,] 4.584834 4.477337 4.332048 4.458988 4.399375 4.291828 4.603168 4.544358 [4,] 4.608166 4.484132 4.435567 4.521789 4.458988 4.318821 4.645352 4.634729 [5,] 4.693181 4.511958 4.546481 4.588024 4.477337 4.389499 4.697749 4.683981 [,9] [,10] [,11] [,12] [1,] 4.390739 4.219508 4.366913 4.469350 [2,] 4.407938 4.247066 4.433195 4.494239 [3,] 4.420045 4.255613 4.475062 4.507557 [4,] 4.446174 4.275276 4.544358 4.546481 [5,] 4.446174 4.282206 4.568506 4.552824 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 4.522069 4.441345 4.249555 4.414613 4.352026 4.254147 4.554709 4.449024 [2,] 4.647600 4.513329 4.414541 4.503363 4.446725 4.329510 4.651628 4.639692 [,9] [,10] [,11] [,12] [1,] 4.393027 4.235679 4.396514 4.470643 [2,] 4.447062 4.275546 4.553609 4.544472 $out [1] 4.536891 $group [1] 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(4.49980967033027, 4.51085950651685, 4.58483418310353, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/5nnk31225991416.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,] 71.9 68.00 66.50 72.40 69.90 100.3 [2,] 87.5 83.25 78.40 76.95 74.05 100.3 [3,] 94.2 89.55 85.15 83.65 82.85 100.3 [4,] 101.2 96.40 89.75 91.00 88.55 100.3 [5,] 109.2 109.70 97.20 99.80 92.40 100.3 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 87.95134 83.5522 79.97319 77.2417 76.23645 100.3 [2,] 100.44866 95.5478 90.32681 90.0583 89.46355 100.3 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(71.9, 87.5, 94.2, 101.2, 109.2, 68, 83.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/6t5s21225991416.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(log(z),notch=TRUE,col='grey',ylab='Overall Central Tendency',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 4.256180 4.255613 4.261270 [2,] 4.400069 4.365712 4.402470 [3,] 4.469637 4.467025 4.474654 [4,] 4.536124 4.525958 4.543760 [5,] 4.611550 4.603168 4.611649 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 4.407582 4.393935 4.410211 [2,] 4.531693 4.540114 4.539097 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(4.25617992480791, 4.40006857837282, 4.46963733982571, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1d1v51225991415.ps tmp/1d1v51225991415.png") > system("convert tmp/2pjyg1225991416.ps tmp/2pjyg1225991416.png") > system("convert tmp/3j2ld1225991416.ps tmp/3j2ld1225991416.png") > system("convert tmp/42lj31225991416.ps tmp/42lj31225991416.png") > system("convert tmp/5nnk31225991416.ps tmp/5nnk31225991416.png") > system("convert tmp/6t5s21225991416.ps tmp/6t5s21225991416.png") > > > proc.time() user system elapsed 1.941 1.279 2.149