R version 2.7.2 (2008-08-25) Copyright (C) 2008 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(356.2,359.5,368.4,371,397.5,416.7,413.2,424.3,415,421.7,422.1,429.2,452.1,471.5,488.3,506.2,517.3,538.6,545.3,546.7,540.3,549.2,563.9,581.7,590.7,594.1,604,628.1,662.4,688.6,705.9,701.5,686.2,645.7,668.7,696.7,715.5,741.4,754.3,771.3,797.7,809.9,790.1,830.3,847.7,834.8,824.5,764.6,780,803.2,751.1,755.2,708.2,685.4,680,710.6,702.8,656.3,575.6,567.2,545.2) > 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,] 356.2 452.1 590.7 715.5 780.0 545.2 [2,] 359.5 471.5 594.1 741.4 803.2 NA [3,] 368.4 488.3 604.0 754.3 751.1 NA [4,] 371.0 506.2 628.1 771.3 755.2 NA [5,] 397.5 517.3 662.4 797.7 708.2 NA [6,] 416.7 538.6 688.6 809.9 685.4 NA [7,] 413.2 545.3 705.9 790.1 680.0 NA [8,] 424.3 546.7 701.5 830.3 710.6 NA [9,] 415.0 540.3 686.2 847.7 702.8 NA [10,] 421.7 549.2 645.7 834.8 656.3 NA [11,] 422.1 563.9 668.7 824.5 575.6 NA [12,] 429.2 581.7 696.7 764.6 567.2 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/1t6151225634551.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/2dhf41225634551.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/369ic1225634551.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/4jb7d1225634551.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,] 356.20 359.5 368.4 371.0 397.5 416.7 413.2 424.3 415.0 421.7 422.1 429.2 [2,] 452.10 471.5 488.3 506.2 517.3 538.6 545.3 546.7 540.3 549.2 563.9 567.2 [3,] 567.95 594.1 604.0 628.1 662.4 685.4 680.0 701.5 686.2 645.7 575.6 581.7 [4,] 715.50 741.4 751.1 755.2 708.2 688.6 705.9 710.6 702.8 656.3 668.7 696.7 [5,] 780.00 803.2 754.3 771.3 797.7 809.9 790.1 830.3 847.7 656.3 824.5 764.6 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 398.0485 403.3893 418.3062 452.1572 527.5105 579.4104 566.5204 585.6887 [2,] 737.8515 784.8107 789.6938 804.0428 797.2895 791.3896 793.4796 817.3113 [,9] [,10] [,11] [,12] [1,] 571.3779 570.0234 501.5486 490.1956 [2,] 801.0221 721.3766 649.6514 673.2044 $out [1] 834.8 $group [1] 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(356.2, 452.1, 567.95, 715.5, 780, 359.5, 471.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5frwl1225634551.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,] 356.2 452.10 590.70 715.50 567.20 545.2 [2,] 369.7 497.25 616.05 759.45 668.15 545.2 [3,] 414.1 539.45 665.55 793.90 705.50 545.2 [4,] 421.9 547.95 692.65 827.40 753.15 545.2 [5,] 429.2 581.70 705.90 847.70 803.20 545.2 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 390.2912 516.3254 630.6122 762.9075 666.7309 545.2 [2,] 437.9088 562.5746 700.4878 824.8925 744.2691 545.2 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(356.2, 369.7, 414.1, 421.9, 429.2, 452.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6b6fo1225634551.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,] 573.2833 567.95 602.750 [2,] 600.1500 587.90 609.600 [3,] 613.7900 636.90 618.000 [4,] 627.3700 682.70 627.125 [5,] 642.6800 701.50 631.950 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 601.3748 593.6611 610.0067 [2,] 626.2052 680.1389 625.9933 $out [1] 579.8375 $group [1] 3 $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/1t6151225634551.ps tmp/1t6151225634551.png") > system("convert tmp/2dhf41225634551.ps tmp/2dhf41225634551.png") > system("convert tmp/369ic1225634551.ps tmp/369ic1225634551.png") > system("convert tmp/4jb7d1225634551.ps tmp/4jb7d1225634551.png") > system("convert tmp/5frwl1225634551.ps tmp/5frwl1225634551.png") > system("convert tmp/6b6fo1225634551.ps tmp/6b6fo1225634551.png") > > > proc.time() user system elapsed 1.270 0.825 1.549