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(99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.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] 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,] 99.3 98.6 96.0 100.1 106.3 NA [2,] 99.2 99.6 95.8 98.5 105.2 NA [3,] 108.3 114.3 103.0 112.9 117.2 NA [4,] 105.6 107.8 102.2 101.4 106.9 NA [5,] 99.5 101.2 98.4 107.1 108.2 NA [6,] 107.4 112.5 111.4 110.8 113.0 NA [7,] 93.1 100.5 86.6 90.3 97.2 NA [8,] 88.1 93.9 91.3 95.5 99.9 NA [9,] 110.7 116.2 107.9 111.4 108.1 NA [10,] 113.1 112.0 101.8 113.0 118.1 NA [11,] 99.6 106.4 104.4 107.5 109.1 NA [12,] 93.6 95.7 93.4 95.9 93.3 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/1pau81225741514.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/2gb2m1225741514.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/3a61y1225741514.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/45tra1225741514.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,] 98.6 98.5 103.0 101.4 98.4 110.8 86.6 88.1 107.9 112.0 104.4 93.3 [2,] 98.6 98.5 108.3 102.2 99.5 110.8 90.3 91.3 108.1 112.0 104.4 93.4 [3,] 99.3 99.2 112.9 105.6 101.2 111.4 93.1 93.9 110.7 113.0 106.4 93.6 [4,] 100.1 99.6 114.3 106.9 107.1 112.5 97.2 95.5 111.4 113.1 107.5 95.7 [5,] 100.1 99.6 117.2 107.8 108.2 113.0 100.5 99.9 116.2 113.1 109.1 95.9 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 98.2401 98.42274 108.6604 102.279 95.82986 110.1988 88.22448 90.93229 [2,] 100.3599 99.97726 117.1396 108.921 106.57014 112.6012 97.97552 96.86771 [,9] [,10] [,11] [,12] [1,] 108.3682 112.2227 104.2095 91.97483 [2,] 113.0318 113.7773 108.5905 95.22517 $out [1] 96.0 106.3 95.8 105.2 107.4 101.8 118.1 99.6 $group [1] 1 1 2 2 6 10 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(98.6, 98.6, 99.3, 100.1, 100.1, 98.5, 98.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5rv2i1225741514.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,] 88.10 93.90 86.6 90.30 93.30 NA [2,] 96.40 99.10 94.6 97.20 102.55 NA [3,] 99.55 103.80 100.1 104.25 107.50 NA [4,] 107.85 112.25 103.7 111.10 111.05 NA [5,] 113.10 116.20 111.4 113.00 118.10 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 94.32758 97.8022 95.94943 97.91012 103.6231 NA [2,] 104.77242 109.7978 104.25057 110.58988 111.3769 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(88.1, 96.4, 99.55, 107.85, 113.1, 93.9, 99.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6c0rp1225741514.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,] 93.54 93.10 93.400 [2,] 97.02 96.55 96.800 [3,] 103.83 103.40 103.925 [4,] 110.94 111.05 110.525 [5,] 111.60 113.00 112.550 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 97.481 96.78645 97.66494 [2,] 110.179 110.01355 110.18506 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/1pau81225741514.ps tmp/1pau81225741514.png") > system("convert tmp/2gb2m1225741514.ps tmp/2gb2m1225741514.png") > system("convert tmp/3a61y1225741514.ps tmp/3a61y1225741514.png") > system("convert tmp/45tra1225741514.ps tmp/45tra1225741514.png") > system("convert tmp/5rv2i1225741514.ps tmp/5rv2i1225741514.png") > system("convert tmp/6c0rp1225741514.ps tmp/6c0rp1225741514.png") > > > proc.time() user system elapsed 1.288 0.842 2.275