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(680.2,668.9,611.4,640.8,549.8,541.8,628.6,686.5,611.8,588.4,566.9,563.7,569.9,635.4,590.8,634.3,576.1,351.6,507.5,586.2,666.4,693.6,650.6,654.8,733.5,648.1,678.1,816.2,591.0,563.5,742.5,694.4,728.6,749.0,538.9,568.5,692.8,580.5,506.9,612.8,442.9,523.3,596.7,533.7,523.1,559.2,430.7,538.2,612.4,428.0,522.4,531.1,425.9,410.3,551.0,555.6,460.2,288.9,392.3,400.5,399.0) > 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] 61 > (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] 6 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 680.2 569.9 733.5 692.8 612.4 399 [2,] 668.9 635.4 648.1 580.5 428.0 NA [3,] 611.4 590.8 678.1 506.9 522.4 NA [4,] 640.8 634.3 816.2 612.8 531.1 NA [5,] 549.8 576.1 591.0 442.9 425.9 NA [6,] 541.8 351.6 563.5 523.3 410.3 NA [7,] 628.6 507.5 742.5 596.7 551.0 NA [8,] 686.5 586.2 694.4 533.7 555.6 NA [9,] 611.8 666.4 728.6 523.1 460.2 NA [10,] 588.4 693.6 749.0 559.2 288.9 NA [11,] 566.9 650.6 538.9 430.7 392.3 NA [12,] 563.7 654.8 568.5 538.2 400.5 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/1uovd1193148876.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/2van41193148876.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/3fp331193148876.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/4u1lz1193148876.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,] 399.0 580.5 506.9 612.8 425.9 351.6 507.5 533.7 460.2 559.2 392.3 538.2 [2,] 569.9 580.5 522.4 612.8 442.9 410.3 551.0 555.6 523.1 559.2 430.7 538.2 [3,] 646.3 635.4 590.8 634.3 549.8 523.3 596.7 586.2 611.8 588.4 538.9 563.7 [4,] 692.8 648.1 611.4 640.8 576.1 541.8 628.6 686.5 666.4 693.6 566.9 568.5 [5,] 733.5 668.9 678.1 640.8 591.0 563.5 742.5 694.4 728.6 749.0 650.6 568.5 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 567.0255 587.634 527.9128 614.5153 455.6812 430.3824 541.868 493.7064 [2,] 725.5745 683.166 653.6872 654.0847 643.9188 616.2176 651.532 678.6936 [,9] [,10] [,11] [,12] [1,] 510.5446 493.4333 442.6614 542.2901 [2,] 713.0554 683.3667 635.1386 585.1099 $out [1] 428.0 816.2 531.1 288.9 654.8 400.5 $group [1] 2 4 4 10 12 12 $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(399, 569.9, 646.3, 692.8, 733.5, 580.5, 580.5, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5am7t1193148876.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,] 541.80 507.50 538.90 430.70 288.90 399 [2,] 565.30 573.00 579.75 515.00 405.40 399 [3,] 611.60 612.55 686.25 535.95 444.10 399 [4,] 654.85 652.70 738.00 588.60 541.05 399 [5,] 686.50 693.60 816.20 692.80 612.40 399 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 570.7556 576.1983 614.0711 502.3805 382.2291 399 [2,] 652.4444 648.9017 758.4289 569.5195 505.9709 399 $out [1] 351.6 $group [1] 2 $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(541.8, 565.3, 611.6, 654.85, 686.5, 507.5, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6ssye1193148876.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,] 478.10 523.30 476.0500 [2,] 531.14 556.75 531.4250 [3,] 587.05 589.60 592.2750 [4,] 608.27 623.05 623.7250 [5,] 647.04 646.30 635.0875 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 551.8705 559.3601 550.1764 [2,] 622.2295 619.8399 634.3736 $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(478.1, 531.14, 587.05, 608.27, 647.04, 523.3, > dev.off() null device 1 > > system("convert tmp/1uovd1193148876.ps tmp/1uovd1193148876.png") > system("convert tmp/2van41193148876.ps tmp/2van41193148876.png") > system("convert tmp/3fp331193148876.ps tmp/3fp331193148876.png") > system("convert tmp/4u1lz1193148876.ps tmp/4u1lz1193148876.png") > system("convert tmp/5am7t1193148876.ps tmp/5am7t1193148876.png") > system("convert tmp/6ssye1193148876.ps tmp/6ssye1193148876.png") > > > proc.time() user system elapsed 1.347 0.818 1.608