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(108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,126.3,112.9,115.9) > 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] 60 > (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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 108.4 123.9 128.4 127.3 128.0 NA [2,] 117.0 124.9 121.1 117.2 129.6 NA [3,] 103.8 112.7 119.5 119.8 125.8 NA [4,] 100.8 121.9 128.7 116.2 119.5 NA [5,] 110.6 100.6 108.7 111.0 115.7 NA [6,] 104.0 104.3 105.5 112.4 113.6 NA [7,] 112.6 120.4 119.8 130.6 129.7 NA [8,] 107.3 107.5 111.3 109.1 112.0 NA [9,] 98.9 102.9 110.6 118.8 116.8 NA [10,] 109.8 125.6 120.1 123.9 126.3 NA [11,] 104.9 107.5 97.5 101.6 112.9 NA [12,] 102.2 108.8 107.7 112.8 115.9 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/1diq01193402355.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/283mg1193402355.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/39pbr1193402355.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/4ire91193402355.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,] 123.9 117.0 103.8 116.2 108.7 104.0 112.6 107.3 98.9 120.1 97.5 102.2 [2,] 123.9 117.2 112.7 116.2 108.7 104.3 119.8 107.5 102.9 120.1 101.6 107.7 [3,] 127.3 121.1 119.5 119.5 110.6 105.5 120.4 109.1 110.6 123.9 104.9 108.8 [4,] 128.0 124.9 119.8 121.9 111.0 112.4 129.7 111.3 116.8 125.6 107.5 112.8 [5,] 128.4 129.6 125.8 128.7 111.0 113.6 130.6 112.0 118.8 126.3 112.9 115.9 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 124.4030 115.6592 114.4832 115.4724 108.9748 99.77656 113.4047 106.4149 [2,] 130.1970 126.5408 124.5168 123.5276 112.2252 111.22344 127.3953 111.7851 [,9] [,10] [,11] [,12] [1,] 100.7783 120.0137 100.7311 105.1964 [2,] 120.4217 127.7863 109.0689 112.4036 $out [1] 108.4 100.8 100.6 115.7 109.8 $group [1] 1 4 5 5 10 $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(123.9, 123.9, 127.3, 128, 128.4, 117, 117.2, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/58fzb1193402355.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,] 98.9 100.60 97.5 101.60 112.00 NA [2,] 103.0 105.90 108.2 111.70 114.65 NA [3,] 106.1 110.75 115.4 116.70 118.15 NA [4,] 110.2 122.90 120.6 121.85 127.15 NA [5,] 117.0 125.60 128.7 130.60 129.70 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 102.8160 102.9962 109.7443 112.0705 112.4487 NA [2,] 109.3840 118.5038 121.0557 121.3295 123.8513 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(98.9, 103, 106.1, 110.2, 117, 100.6, 105.9, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6yiz61193402355.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,] 104.88 104.90 104.550 [2,] 109.38 108.95 109.625 [3,] 112.96 115.05 113.250 [4,] 121.55 120.75 121.950 [5,] 123.20 127.30 125.950 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 107.4092 109.6679 107.6285 [2,] 118.5108 120.4321 118.8715 $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(104.88, 109.38, 112.96, 121.55, 123.2, 104.9, > dev.off() null device 1 > > system("convert tmp/1diq01193402355.ps tmp/1diq01193402355.png") > system("convert tmp/283mg1193402355.ps tmp/283mg1193402355.png") > system("convert tmp/39pbr1193402355.ps tmp/39pbr1193402355.png") > system("convert tmp/4ire91193402355.ps tmp/4ire91193402355.png") > system("convert tmp/58fzb1193402355.ps tmp/58fzb1193402355.png") > system("convert tmp/6yiz61193402355.ps tmp/6yiz61193402355.png") > > > proc.time() user system elapsed 1.476 0.930 1.752