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(108.8,113.2,105.5,77.8,102.1,97,95.5,99.3,86.4,92.4,85.7,61.9,104.9,107.9,95.6,79.8,94.8,93.7,108.1,96.9,88.8,106.7,86.8,69.8,110.9,105.4,99.2,84.4,87.2,91.9,97.9,94.5,85,100.3,78.7,65.8,104.8,96,103.3,82.9,91.4,94.5,109.3,92.1,99.3,109.6,87.5,73.1,110.7,111.6,110.7,84,101.6,102.1,113.9,99,100.4,111.1,93,74.1) > par1 = '20' > #'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] 3 > 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] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 > arr [,1] [,2] [,3] [,4] [1,] 108.8 88.8 91.4 NA [2,] 113.2 106.7 94.5 NA [3,] 105.5 86.8 109.3 NA [4,] 77.8 69.8 92.1 NA [5,] 102.1 110.9 99.3 NA [6,] 97.0 105.4 109.6 NA [7,] 95.5 99.2 87.5 NA [8,] 99.3 84.4 73.1 NA [9,] 86.4 87.2 110.7 NA [10,] 92.4 91.9 111.6 NA [11,] 85.7 97.9 110.7 NA [12,] 61.9 94.5 84.0 NA [13,] 104.9 85.0 101.6 NA [14,] 107.9 100.3 102.1 NA [15,] 95.6 78.7 113.9 NA [16,] 79.8 65.8 99.0 NA [17,] 94.8 104.8 100.4 NA [18,] 93.7 96.0 111.1 NA [19,] 108.1 103.3 93.0 NA [20,] 96.9 82.9 74.1 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/1ivhy1193581419.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/24wxo1193581419.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/3ipfr1193581419.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/4dfxu1193581419.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] [1,] 88.8 94.50 86.80 69.80 99.3 97.0 87.50 73.10 86.40 91.90 85.7 [2,] 90.1 100.60 96.15 73.80 100.7 101.2 91.50 78.75 86.80 92.15 91.8 [3,] 91.4 106.70 105.50 77.80 102.1 105.4 95.50 84.40 87.20 92.40 97.9 [4,] 100.1 109.95 107.40 84.95 106.5 107.5 97.35 91.85 98.95 102.00 104.3 [5,] 108.8 113.20 109.30 92.10 110.9 109.6 99.20 99.30 110.70 111.60 110.7 [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [1,] 61.90 85.00 100.3 78.70 65.8 94.8 93.70 93.00 74.1 [2,] 72.95 93.30 101.2 87.15 72.8 97.6 94.85 98.15 78.5 [3,] 84.00 101.60 102.1 95.60 79.8 100.4 96.00 103.30 82.9 [4,] 89.25 103.25 105.0 104.75 89.4 102.6 103.55 105.70 89.9 [5,] 94.50 104.90 107.9 113.90 99.0 104.8 111.10 108.10 96.9 $n [1] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 82.27787 98.1708 95.2376 67.62882 96.80916 99.65306 90.16355 72.45 [2,] 100.52213 115.2292 115.7624 87.97118 107.39084 111.14694 100.83645 96.35 [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] 76.1166 83.4147 86.49733 69.13092 92.52348 98.63359 79.54504 64.65726 [2,] 98.2834 101.3853 109.30267 98.86908 110.67652 105.56641 111.65496 94.94274 [,17] [,18] [,19] [,20] [1,] 95.83893 88.06374 96.41279 72.50077 [2,] 104.96107 103.93626 110.18721 93.29923 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" Warning message: In bxp(list(stats = c(88.8, 90.1, 91.4, 100.1, 108.8, 94.5, 100.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5vhy31193581419.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] [1,] 77.80 65.8 73.10 NA [2,] 89.40 84.7 91.75 NA [3,] 96.25 93.2 99.85 NA [4,] 105.20 101.8 110.15 NA [5,] 113.20 110.9 113.90 NA $n [1] 20 20 20 0 $conf [,1] [,2] [,3] [,4] [1,] 90.66788 87.1586 93.3493 NA [2,] 101.83212 99.2414 106.3507 NA $out [1] 61.9 $group [1] 1 $names [1] "1" "2" "3" NA > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6u3m51193581419.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.90000 77.8 79.3750 [2,] 89.83333 85.8 89.0875 [3,] 97.63333 95.8 97.5625 [4,] 101.00000 102.1 101.8500 [5,] 104.80000 106.7 105.2750 $n [1] 20 20 20 $conf [,1] [,2] [,3] [1,] 93.68816 90.04123 93.05352 [2,] 101.57850 101.55877 102.07148 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(79.9, 89.8333333333333, 97.6333333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1ivhy1193581419.ps tmp/1ivhy1193581419.png") > system("convert tmp/24wxo1193581419.ps tmp/24wxo1193581419.png") > system("convert tmp/3ipfr1193581419.ps tmp/3ipfr1193581419.png") > system("convert tmp/4dfxu1193581419.ps tmp/4dfxu1193581419.png") > system("convert tmp/5vhy31193581419.ps tmp/5vhy31193581419.png") > system("convert tmp/6u3m51193581419.ps tmp/6u3m51193581419.png") > > > proc.time() user system elapsed 2.427 1.368 2.675