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' > x <- x[x>quantile(x,0.05) & x #'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] 53 > (np <- floor(n / par1)) [1] 4 > 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 4 4 4 4 4 4 4 > arr [,1] [,2] [,3] [,4] [,5] [1,] 88.6 86.4 97.2 90.0 81.5 [2,] 94.3 88.0 94.1 83.1 85.3 [3,] 98.3 75.1 80.7 72.4 84.2 [4,] 86.4 103.0 87.8 78.8 90.7 [5,] 80.6 82.1 89.5 87.3 100.3 [6,] 93.4 96.4 99.6 91.0 NA [7,] 71.9 94.3 84.2 80.1 NA [8,] 94.1 90.0 75.1 73.6 NA [9,] 94.9 88.0 92.0 86.4 NA [10,] 96.4 76.1 80.8 74.5 NA [11,] 91.1 82.5 73.1 71.2 NA [12,] 84.4 81.4 99.8 92.4 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/1smq11225288886.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/2hiwy1225288886.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/3mfee1225288886.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/4dq0x1225288886.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,] 81.5 83.1 72.4 86.4 80.6 91.0 71.90 73.60 86.40 74.50 71.20 81.4 [2,] 86.4 85.3 75.1 86.4 82.1 92.2 76.00 74.35 87.20 75.30 72.15 82.9 [3,] 88.6 88.0 80.7 87.8 87.3 94.9 82.15 82.55 90.00 78.45 77.80 88.4 [4,] 90.0 94.1 84.2 90.7 89.5 98.0 89.25 92.05 93.45 88.60 86.80 96.1 [5,] 90.0 94.3 84.2 90.7 100.3 99.6 94.30 94.10 94.90 96.40 91.10 99.8 $n [1] 5 5 5 5 5 4 4 4 4 4 4 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 86.05625 81.78194 74.26996 84.76163 82.07118 90.318 71.6825 68.567 85.0625 [2,] 91.14375 94.21806 87.13004 90.83837 92.52882 99.482 92.6175 96.533 94.9375 [,10] [,11] [,12] [1,] 67.943 66.2265 77.972 [2,] 88.957 89.3735 98.828 $out [1] 97.2 98.3 103.0 78.8 $group [1] 1 3 4 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(81.5, 86.4, 88.6, 90, 90, 83.1, 85.3, 88, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5vyxx1225288886.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] [1,] 71.90 75.10 73.10 71.20 81.5 [2,] 85.40 81.75 80.75 74.05 84.2 [3,] 92.25 87.20 88.65 81.60 85.3 [4,] 94.60 92.15 95.65 88.65 90.7 [5,] 98.30 103.00 99.80 92.40 100.3 $n [1] 12 12 12 12 5 $conf [,1] [,2] [,3] [,4] [,5] [1,] 88.05382 82.45649 81.85401 74.94084 80.70712 [2,] 96.44618 91.94351 95.44599 88.25916 89.89288 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" NA Warning message: In bxp(list(stats = c(71.9, 85.4, 92.25, 94.6, 98.3, 75.1, 81.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6jwo71225288886.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,] 79.4750 77.800 78.63750 [2,] 82.3825 81.425 81.29375 [3,] 88.3500 87.550 87.00000 [4,] 89.4200 88.500 89.32500 [5,] 95.1000 94.900 95.00000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 85.14015 84.32305 83.3369 [2,] 91.55985 90.77695 90.6631 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(79.475, 82.3825, 88.35, 89.42, 95.1, 77.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1smq11225288886.ps tmp/1smq11225288886.png") > system("convert tmp/2hiwy1225288886.ps tmp/2hiwy1225288886.png") > system("convert tmp/3mfee1225288886.ps tmp/3mfee1225288886.png") > system("convert tmp/4dq0x1225288886.ps tmp/4dq0x1225288886.png") > system("convert tmp/5vyxx1225288886.ps tmp/5vyxx1225288886.png") > system("convert tmp/6jwo71225288886.ps tmp/6jwo71225288886.png") > > > proc.time() user system elapsed 1.288 0.825 1.642