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(88.8,93.4,92.6,90.7,81.6,84.1,88.1,85.3,82.9,84.8,71.2,68.9,94.3,97.6,85.6,91.9,75.8,79.8,99,88.5,86.7,97.9,94.3,72.9,91.8,93.2,86.5,98.9,77.2,79.4,90.4,81.4,85.8,103.6,73.6,75.7,99.2,88.7,94.6,98.7,84.2,87.7,103.3,88.2,93.4,106.3,73.1,78.6,101.6,101.4,98.5,99,89.5,83.5,97.4,87.8,90.4,97.1,79.4,85) > 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,] 88.8 94.3 91.8 99.2 101.6 NA [2,] 93.4 97.6 93.2 88.7 101.4 NA [3,] 92.6 85.6 86.5 94.6 98.5 NA [4,] 90.7 91.9 98.9 98.7 99.0 NA [5,] 81.6 75.8 77.2 84.2 89.5 NA [6,] 84.1 79.8 79.4 87.7 83.5 NA [7,] 88.1 99.0 90.4 103.3 97.4 NA [8,] 85.3 88.5 81.4 88.2 87.8 NA [9,] 82.9 86.7 85.8 93.4 90.4 NA [10,] 84.8 97.9 103.6 106.3 97.1 NA [11,] 71.2 94.3 73.6 73.1 79.4 NA [12,] 68.9 72.9 75.7 78.6 85.0 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/1cea11193930330.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/23s221193930330.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/3b5bk1193930330.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/4ihpd1193930330.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,] 88.8 88.7 85.6 90.7 75.8 79.4 88.1 81.4 82.9 97.1 71.2 68.9 [2,] 91.8 93.2 86.5 91.9 77.2 79.8 90.4 85.3 85.8 97.1 73.1 72.9 [3,] 94.3 93.4 92.6 98.7 81.6 83.5 97.4 87.8 86.7 97.9 73.6 75.7 [4,] 99.2 97.6 94.6 98.9 84.2 84.1 99.0 88.2 90.4 103.6 79.4 78.6 [5,] 101.6 101.4 98.5 99.0 89.5 87.7 103.3 88.5 93.4 106.3 79.4 85.0 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 89.07118 90.29097 86.87656 93.75382 76.65382 80.46163 91.32326 85.75087 [2,] 99.52882 96.50903 98.32344 103.64618 86.54618 86.53837 103.47674 89.84913 [,9] [,10] [,11] [,12] [1,] 83.44965 93.30712 69.14844 71.6724 [2,] 89.95035 102.49288 78.05156 79.7276 $out [1] 84.8 94.3 $group [1] 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(88.8, 91.8, 94.3, 99.2, 101.6, 88.7, 93.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/53s811193930330.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.20 72.90 73.60 73.10 79.40 NA [2,] 82.25 82.70 78.30 85.95 86.40 NA [3,] 85.05 90.20 86.15 91.05 93.75 NA [4,] 89.75 95.95 92.50 98.95 98.75 NA [5,] 93.40 99.00 103.60 106.30 101.60 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 81.6292 84.15659 79.67328 85.12061 88.11708 NA [2,] 88.4708 96.24341 92.62672 96.97939 99.38292 NA $out [1] 68.9 $group [1] 1 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(71.2, 82.25, 85.05, 89.75, 93.4, 72.9, 82.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/68hhy1193930330.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.22 73.60 75.750 [2,] 82.28 82.55 81.325 [3,] 89.70 90.20 89.325 [4,] 95.39 95.85 95.400 [5,] 97.94 98.70 100.350 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 83.72044 84.13378 82.9053 [2,] 95.67956 96.26622 95.7447 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(76.22, 82.28, 89.7, 95.39, 97.94, 73.6, 82.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1cea11193930330.ps tmp/1cea11193930330.png") > system("convert tmp/23s221193930330.ps tmp/23s221193930330.png") > system("convert tmp/3b5bk1193930330.ps tmp/3b5bk1193930330.png") > system("convert tmp/4ihpd1193930330.ps tmp/4ihpd1193930330.png") > system("convert tmp/53s811193930330.ps tmp/53s811193930330.png") > system("convert tmp/68hhy1193930330.ps tmp/68hhy1193930330.png") > > > proc.time() user system elapsed 1.319 0.856 1.522