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(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] 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,] 101.5 101.2 113.6 117.6 122.4 NA [2,] 126.6 100.5 112.9 103.4 123.3 NA [3,] 93.9 98.0 104.0 110.8 124.3 NA [4,] 89.8 106.6 109.9 112.6 120.0 NA [5,] 93.4 90.1 99.0 102.5 118.1 NA [6,] 101.5 96.9 106.3 112.4 119.0 NA [7,] 110.4 125.9 128.9 135.6 142.7 NA [8,] 105.9 112.0 111.1 105.1 123.6 NA [9,] 108.4 100.0 102.9 127.7 129.6 NA [10,] 113.9 123.9 130.0 137.0 146.9 NA [11,] 86.1 79.8 87.0 91.0 108.7 NA [12,] 69.4 83.4 87.5 90.5 99.4 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/1zrfk1193403088.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/2pdbj1193403088.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/3a8up1193403088.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/4z5di1193403088.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,] 101.2 100.5 93.9 106.6 90.1 96.9 125.9 105.1 100.0 113.9 79.8 83.4 [2,] 101.5 103.4 98.0 106.6 93.4 101.5 125.9 105.9 102.9 123.9 86.1 83.4 [3,] 113.6 112.9 104.0 109.9 99.0 106.3 128.9 111.1 108.4 130.0 87.0 87.5 [4,] 117.6 123.3 110.8 112.6 102.5 112.4 135.6 112.0 127.7 137.0 91.0 90.5 [5,] 122.4 126.6 124.3 120.0 102.5 119.0 142.7 112.0 129.6 146.9 91.0 99.4 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 102.2238 98.83871 94.95555 105.6604 92.56996 98.59809 122.046 106.7898 [2,] 124.9762 126.96129 113.04445 114.1396 105.43004 114.00191 135.754 115.4102 [,9] [,10] [,11] [,12] [1,] 90.87638 120.7436 83.53767 82.48316 [2,] 125.92362 139.2564 90.46233 92.51684 $out [1] 89.8 118.1 110.4 123.6 108.7 69.4 $group [1] 4 5 7 8 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(101.2, 101.5, 113.6, 117.6, 122.4, 100.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5tslc1193403088.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,] 69.4 79.80 87.00 90.50 108.70 NA [2,] 91.6 93.50 100.95 102.95 118.55 NA [3,] 101.5 100.25 108.10 111.60 122.85 NA [4,] 109.4 109.30 113.25 122.65 126.95 NA [5,] 126.6 125.90 130.00 137.00 129.60 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 93.3813 93.04351 102.4899 102.6147 119.0187 NA [2,] 109.6187 107.45649 113.7101 120.5853 126.6813 NA $out [1] 142.7 146.9 99.4 $group [1] 5 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(69.4, 91.6, 101.5, 109.4, 126.6, 79.8, 93.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6ys4u1193403088.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,] 90.52 87.00 86.950 [2,] 103.41 101.50 101.175 [3,] 109.52 109.15 109.250 [4,] 113.53 113.25 114.325 [5,] 128.70 130.00 130.750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 104.9042 103.7907 103.2522 [2,] 114.1358 114.5093 115.2478 $out [1] 130.34 86.04 $group [1] 1 1 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(90.52, 103.41, 109.52, 113.53, 128.7, 87, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1zrfk1193403088.ps tmp/1zrfk1193403088.png") > system("convert tmp/2pdbj1193403088.ps tmp/2pdbj1193403088.png") > system("convert tmp/3a8up1193403088.ps tmp/3a8up1193403088.png") > system("convert tmp/4z5di1193403088.ps tmp/4z5di1193403088.png") > system("convert tmp/5tslc1193403088.ps tmp/5tslc1193403088.png") > system("convert tmp/6ys4u1193403088.ps tmp/6ys4u1193403088.png") > > > proc.time() user system elapsed 4.038 2.248 4.795