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. Natural language support but running in an English locale 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(110.40,96.40,101.90,106.20,81.00,94.70,101.00,109.40,102.30,90.70,96.20,96.10,106.00,103.10,102.00,104.70,86.00,92.10,106.90,112.60,101.70,92.00,97.40,97.00,105.40,102.70,98.10,104.50,87.40,89.90,109.80,111.70,98.60,96.90,95.10,97.00,112.70,102.90,97.40,111.40,87.40,96.80,114.10,110.30,103.90,101.60,94.60,95.90,104.70,102.80,98.10,113.90,80.90,95.70,113.20,105.90,108.80,102.30,99.00,100.70,115.50) > 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,] 110.4 106.0 105.4 112.7 104.7 115.5 [2,] 96.4 103.1 102.7 102.9 102.8 NA [3,] 101.9 102.0 98.1 97.4 98.1 NA [4,] 106.2 104.7 104.5 111.4 113.9 NA [5,] 81.0 86.0 87.4 87.4 80.9 NA [6,] 94.7 92.1 89.9 96.8 95.7 NA [7,] 101.0 106.9 109.8 114.1 113.2 NA [8,] 109.4 112.6 111.7 110.3 105.9 NA [9,] 102.3 101.7 98.6 103.9 108.8 NA [10,] 90.7 92.0 96.9 101.6 102.3 NA [11,] 96.2 97.4 95.1 94.6 99.0 NA [12,] 96.1 97.0 97.0 95.9 100.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/rcomp/tmp/13rwq1193401386.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/2o8qv1193401386.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/3hrlf1193401386.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/4hf2r1193401386.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,] 104.7 102.7 97.4 104.5 80.9 89.9 101.0 109.4 98.6 90.7 94.6 95.9 [2,] 105.4 102.7 98.1 104.7 81.0 92.1 106.9 109.4 101.7 92.0 95.1 96.1 [3,] 108.2 102.8 98.1 106.2 86.0 94.7 109.8 110.3 102.3 96.9 96.2 97.0 [4,] 112.7 102.9 101.9 111.4 87.4 95.7 113.2 111.7 103.9 101.6 97.4 97.0 [5,] 115.5 103.1 102.0 113.9 87.4 96.8 114.1 112.6 103.9 102.3 99.0 97.0 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 103.4913 102.6587 95.41493 101.4658 81.47778 92.15625 105.3484 108.6748 [2,] 112.9087 102.9413 100.78507 110.9342 90.52222 97.24375 114.2516 111.9252 [,9] [,10] [,11] [,12] [1,] 100.7455 90.11666 94.57483 96.36406 [2,] 103.8545 103.68334 97.82517 97.63594 $out [1] 96.4 105.9 108.8 100.7 $group [1] 2 8 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(104.7, 105.4, 108.2, 112.7, 115.5, 102.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5x4zi1193401386.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,] 90.70 86.00 87.40 87.40 95.70 115.5 [2,] 95.40 94.55 96.00 96.35 98.55 115.5 [3,] 98.70 101.85 98.35 102.25 102.55 115.5 [4,] 104.25 105.35 104.95 110.85 107.35 115.5 [5,] 110.40 112.60 111.70 114.10 113.90 115.5 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 94.66346 96.92405 94.26784 95.63645 98.53626 115.5 [2,] 102.73654 106.77595 102.43216 108.86355 106.56374 115.5 $out [1] 81.0 80.9 $group [1] 1 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(90.7, 95.4, 98.7, 104.25, 110.4, 86, 94.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6ft0p1193401386.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,] 84.54 86.00 84.2000 [2,] 96.58 96.55 96.4000 [3,] 100.54 100.20 101.4000 [4,] 108.57 107.20 108.4438 [5,] 109.98 110.30 110.5500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 95.07128 95.34246 95.90676 [2,] 106.00872 105.05754 106.89324 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(84.54, 96.58, 100.54, 108.57, 109.98, 86, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/13rwq1193401386.ps tmp/13rwq1193401386.png") > system("convert tmp/2o8qv1193401386.ps tmp/2o8qv1193401386.png") > system("convert tmp/3hrlf1193401386.ps tmp/3hrlf1193401386.png") > system("convert tmp/4hf2r1193401386.ps tmp/4hf2r1193401386.png") > system("convert tmp/5x4zi1193401386.ps tmp/5x4zi1193401386.png") > system("convert tmp/6ft0p1193401386.ps tmp/6ft0p1193401386.png") > > > proc.time() user system elapsed 2.413 1.359 2.610