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(119.5,125,145,105.3,116.9,120.1,88.9,78.4,114.6,113.3,117,99.6,99.4,101.9,115.2,108.5,113.8,121,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,146.9,108.7,99.4) > 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,] 119.5 99.4 93.4 90.1 99.0 102.5 118.1 [2,] 125.0 101.9 101.5 96.9 106.3 112.4 119.0 [3,] 145.0 115.2 110.4 125.9 128.9 135.6 142.7 [4,] 105.3 108.5 105.9 112.0 111.1 105.1 123.6 [5,] 116.9 113.8 108.4 100.0 102.9 127.7 129.6 [6,] 120.1 121.0 113.9 123.9 130.0 137.0 146.9 [7,] 88.9 92.2 86.1 79.8 87.0 91.0 108.7 [8,] 78.4 90.2 69.4 83.4 87.5 90.5 99.4 [9,] 114.6 101.5 101.2 113.6 117.6 122.4 NA [10,] 113.3 126.6 100.5 112.9 103.4 123.3 NA [11,] 117.0 93.9 98.0 104.0 110.8 124.3 NA [12,] 99.6 89.8 106.6 109.9 112.6 120.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/19ubv1193402872.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/2200a1193402872.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/3p4uh1193402872.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/4nuu21193402872.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,] 90.1 96.9 110.40 105.10 100.00 113.90 79.80 69.40 101.2 100.5 93.9 [2,] 96.2 101.7 120.55 105.60 105.65 120.55 86.55 80.90 101.5 103.4 98.0 [3,] 99.4 106.3 128.90 108.50 113.80 123.90 88.90 87.50 114.1 113.1 107.4 [4,] 110.3 115.7 139.15 111.55 122.30 133.50 91.60 90.35 117.6 123.3 117.0 [5,] 119.5 125.0 145.00 112.00 129.60 146.90 92.20 99.40 122.4 126.6 124.3 [,12] [1,] 89.80 [2,] 99.60 [3,] 108.25 [4,] 112.60 [5,] 120.00 $n [1] 7 7 7 7 7 7 7 7 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 90.9797 97.93943 117.7924 104.9468 103.8569 116.1665 85.88422 81.85661 [2,] 107.8203 114.66057 140.0076 112.0532 123.7431 131.6335 91.91578 93.14339 [,9] [,10] [,11] [,12] [1,] 103.7150 100.2639 95.14439 99.86458 [2,] 124.4850 125.9361 119.65561 116.63542 $out [1] 123.6 108.7 $group [1] 4 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(90.1, 96.2, 99.4, 110.3, 119.5, 96.9, 101.7, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5lh131193402872.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,] 78.40 89.80 86.10 79.80 87.00 90.5 99.40 [2,] 102.45 93.05 95.70 93.50 100.95 103.8 113.40 [3,] 115.75 101.70 101.35 106.95 108.55 121.2 121.30 [4,] 119.80 114.50 107.50 113.25 115.10 126.0 136.15 [5,] 145.00 126.60 113.90 125.90 130.00 137.0 146.90 $n [1] 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 107.8365 91.91651 95.96794 97.9419 102.0961 111.0744 108.5915 [2,] 123.6635 111.48349 106.73206 115.9581 115.0039 131.3256 134.0085 $out [1] 69.4 $group [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(78.4, 102.45, 115.75, 119.8, 145, 89.8, 93.05, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6txj71193402872.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,] 103.1429 87.500 103.2500 [2,] 104.7798 102.850 104.9437 [3,] 109.6071 108.375 108.6375 [4,] 113.7595 113.950 113.6312 [5,] 114.1857 128.900 113.9750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 105.5114 103.3122 104.6751 [2,] 113.7029 113.4378 112.5999 $out [1] 129.10000 127.54286 90.52857 85.54286 129.85000 127.02500 89.07500 [8] 85.62500 $group [1] 1 1 1 1 3 3 3 3 $names [1] "mean" "median" "midrange" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(103.142857142857, 104.779761904762, 109.607142857143, > dev.off() null device 1 > > system("convert tmp/19ubv1193402872.ps tmp/19ubv1193402872.png") > system("convert tmp/2200a1193402872.ps tmp/2200a1193402872.png") > system("convert tmp/3p4uh1193402872.ps tmp/3p4uh1193402872.png") > system("convert tmp/4nuu21193402872.ps tmp/4nuu21193402872.png") > system("convert tmp/5lh131193402872.ps tmp/5lh131193402872.png") > system("convert tmp/6txj71193402872.ps tmp/6txj71193402872.png") > > > proc.time() user system elapsed 1.525 0.928 1.779