R version 2.5.1 (2007-06-27) 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(8.5,8.5,8.5,8.6,8.7,8.7,8.7,8.8,8.8,8.8,8.9,8.9,8.9,8.9,8.9,8.9,8.9,8.9,8.9,8.9,8.9,9,9,9,9,9,9,9,9.1,9.1,9.1,9.1,9.1,9.1,9,9,9,8.9,8.9,8.9,8.8,8.9,8.9,8.8,8.8,8.8,8.6,8.5,8.5,8.5,8.5,8.5,8.3,8.2,8.2,8.1,8,7.9,7.9,7.8,7.8,7.6,7.5,7.5,7.3,7.2,7.1,6.9,6.9,6.8,6.8,6.7) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 8.5 8.9 9.0 9.0 8.5 7.8 NA [2,] 8.5 8.9 9.0 8.9 8.5 7.6 NA [3,] 8.5 8.9 9.0 8.9 8.5 7.5 NA [4,] 8.6 8.9 9.0 8.9 8.5 7.5 NA [5,] 8.7 8.9 9.1 8.8 8.3 7.3 NA [6,] 8.7 8.9 9.1 8.9 8.2 7.2 NA [7,] 8.7 8.9 9.1 8.9 8.2 7.1 NA [8,] 8.8 8.9 9.1 8.8 8.1 6.9 NA [9,] 8.8 8.9 9.1 8.8 8.0 6.9 NA [10,] 8.8 9.0 9.1 8.8 7.9 6.8 NA [11,] 8.9 9.0 9.0 8.6 7.9 6.8 NA [12,] 8.9 9.0 9.0 8.5 7.8 6.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/13fcz1193404730.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/2rih71193404730.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/3vm4q1193404730.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/4e8vt1193404730.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,] 7.8 8.5 8.5 8.50 8.30 7.2 8.2 6.9 6.9 6.8 6.80 6.7 [2,] 8.5 8.5 8.5 8.50 8.30 8.2 8.2 8.1 8.0 7.9 7.90 7.8 [3,] 8.7 8.7 8.7 8.75 8.75 8.8 8.8 8.8 8.8 8.8 8.75 8.7 [4,] 9.0 8.9 8.9 8.90 8.90 8.9 8.9 8.9 8.9 9.0 9.00 9.0 [5,] 9.0 9.0 9.0 9.00 9.10 9.1 9.1 9.1 9.1 9.1 9.00 9.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 8.377484 8.441987 8.441987 8.491987 8.36298 8.348477 8.348477 8.283974 [2,] 9.022516 8.958013 8.958013 9.008013 9.13702 9.251523 9.251523 9.316026 [,9] [,10] [,11] [,12] [1,] 8.219471 8.090464 8.040464 7.925961 [2,] 9.380529 9.509536 9.459536 9.474039 $out [1] 7.6 7.5 7.5 7.3 7.1 $group [1] 2 3 4 5 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(7.8, 8.5, 8.7, 9, 9, 8.5, 8.5, 8.7, 8.9, 9, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/53haq1193404730.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] [,7] [1,] 8.50 8.90 9.00 8.80 7.80 6.70 NA [2,] 8.55 8.90 9.00 8.80 7.95 6.85 NA [3,] 8.70 8.90 9.05 8.85 8.20 7.15 NA [4,] 8.80 8.95 9.10 8.90 8.50 7.50 NA [5,] 8.90 9.00 9.10 9.00 8.50 7.80 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 8.585973 8.877195 9.00439 8.80439 7.949141 6.85353 NA [2,] 8.814027 8.922805 9.09561 8.89561 8.450859 7.44647 NA $out [1] 8.6 8.5 $group [1] 4 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(8.5, 8.55, 8.7, 8.8, 8.9, 8.9, 8.9, 8.9, 8.95, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6lv0h1193404730.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,] 8.316667 8.70 8.4750 [2,] 8.408333 8.70 8.5375 [3,] 8.491667 8.75 8.6125 [4,] 8.558333 8.80 8.7000 [5,] 8.616667 8.80 8.7375 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 8.423251 8.70439 8.538383 [2,] 8.560083 8.79561 8.686617 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(8.31666666666667, 8.40833333333333, 8.49166666666667, > dev.off() null device 1 > > system("convert tmp/13fcz1193404730.ps tmp/13fcz1193404730.png") > system("convert tmp/2rih71193404730.ps tmp/2rih71193404730.png") > system("convert tmp/3vm4q1193404730.ps tmp/3vm4q1193404730.png") > system("convert tmp/4e8vt1193404730.ps tmp/4e8vt1193404730.png") > system("convert tmp/53haq1193404730.ps tmp/53haq1193404730.png") > system("convert tmp/6lv0h1193404730.ps tmp/6lv0h1193404730.png") > > > proc.time() user system elapsed 1.398 0.861 1.647