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(104.8,105.6,118.3,89.9,90.2,107,64.5,92.6,95.8,94.3,91.2,86.3,77.6,82.5,97.7,83.3,84.2,92.8,77.4,72.5,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] 80 > (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] 7 7 7 7 7 7 7 7 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 104.8 77.6 81.6 75.8 77.2 84.2 89.5 [2,] 105.6 82.5 84.1 79.8 79.4 87.7 83.5 [3,] 118.3 97.7 88.1 99.0 90.4 103.3 97.4 [4,] 89.9 83.3 85.3 88.5 81.4 88.2 87.8 [5,] 90.2 84.2 82.9 86.7 85.8 93.4 90.4 [6,] 107.0 92.8 84.8 97.9 103.6 106.3 97.1 [7,] 64.5 77.4 71.2 94.3 73.6 73.1 79.4 [8,] 92.6 72.5 68.9 72.9 75.7 78.6 85.0 [9,] 95.8 88.8 94.3 91.8 99.2 101.6 NA [10,] 94.3 93.4 97.6 93.2 88.7 101.4 NA [11,] 91.2 92.6 85.6 86.5 94.6 98.5 NA [12,] 86.3 90.7 91.9 98.9 98.7 99.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/1chpj1193251792.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/2joqi1193251792.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/3jfpr1193251792.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/4yif81193251792.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,] 75.80 79.40 88.10 81.40 82.9 84.80 64.50 68.9 88.80 88.70 85.6 86.3 [2,] 77.40 81.15 93.90 84.30 85.0 94.95 72.15 72.7 91.80 93.20 86.5 90.7 [3,] 81.60 83.50 97.70 87.80 86.7 97.90 73.60 75.7 95.05 93.85 91.9 95.3 [4,] 86.85 85.90 101.15 88.35 90.3 104.95 78.40 81.8 99.20 97.60 94.6 98.9 [5,] 89.50 87.70 103.30 89.90 93.4 107.00 79.40 92.6 101.60 101.40 98.5 99.0 $n [1] 7 7 7 7 7 7 7 7 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 75.95661 80.66338 93.37042 85.3814 83.53493 91.92816 69.8676 70.26563 [2,] 87.24339 86.33662 102.02958 90.2186 89.86507 103.87184 77.3324 81.13437 [,9] [,10] [,11] [,12] [1,] 90.27676 91.01186 86.67524 90.01074 [2,] 99.82324 96.68814 97.12476 100.58926 $out [1] 104.8 105.6 118.3 94.3 $group [1] 1 2 3 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(75.8, 77.4, 81.6, 86.85, 89.5, 79.4, 81.15, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5foya1193251792.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,] 86.30 72.50 71.20 72.90 73.60 73.10 79.40 [2,] 90.05 80.05 82.25 83.15 78.30 85.95 84.25 [3,] 93.45 86.50 85.05 90.15 87.25 95.95 88.65 [4,] 105.20 92.70 90.00 96.10 96.65 101.50 93.75 [5,] 118.30 97.70 97.60 99.00 103.60 106.30 97.40 $n [1] 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 86.53998 80.73025 81.51517 84.24342 78.88044 88.85754 83.34316 [2,] 100.36002 92.26975 88.58483 96.05658 95.61956 103.04246 93.95684 $out [1] 64.5 68.9 $group [1] 1 3 $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(86.3, 90.05, 93.45, 105.2, 118.3, 72.5, 80.05, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6phie1193251792.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.21429 73.600 75.27500 [2,] 85.23571 82.550 82.82500 [3,] 89.57857 89.850 89.26875 [4,] 95.00833 95.175 95.20000 [5,] 99.17143 97.900 99.95000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 85.12121 84.09165 83.62443 [2,] 94.03593 95.60835 94.91307 $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(76.2142857142857, 85.2357142857143, 89.5785714285714, > dev.off() null device 1 > > system("convert tmp/1chpj1193251792.ps tmp/1chpj1193251792.png") > system("convert tmp/2joqi1193251792.ps tmp/2joqi1193251792.png") > system("convert tmp/3jfpr1193251792.ps tmp/3jfpr1193251792.png") > system("convert tmp/4yif81193251792.ps tmp/4yif81193251792.png") > system("convert tmp/5foya1193251792.ps tmp/5foya1193251792.png") > system("convert tmp/6phie1193251792.ps tmp/6phie1193251792.png") > > > proc.time() user system elapsed 1.370 0.828 1.589