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(467037,460070,447988,442867,436087,431328,484015,509673,512927,502831,470984,471067,476049,474605,470439,461251,454724,455626,516847,525192,522975,518585,509239,512238,519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274) > 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] 72 > (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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 467037 476049 519164 562325 590865 593408 NA [2,] 460070 474605 517009 560854 589379 590072 NA [3,] 447988 470439 509933 555332 584428 579799 NA [4,] 442867 461251 509127 543599 573100 574205 NA [5,] 436087 454724 500857 536662 567456 572775 NA [6,] 431328 455626 506971 542722 569028 572942 NA [7,] 484015 516847 569323 593530 620735 619567 NA [8,] 509673 525192 579714 610763 628884 625809 NA [9,] 512927 522975 577992 612613 628232 619916 NA [10,] 502831 518585 565464 611324 612117 587625 NA [11,] 470984 509239 547344 594167 595404 565742 NA [12,] 471067 512238 554788 595454 597141 557274 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/1lb881193583157.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/2z3921193583157.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/3x2aj1193583157.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/4pi9n1193583157.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] [1,] 467037.0 460070.0 447988.0 442867 436087.0 431328.0 484015.0 509673.0 [2,] 476049.0 474605.0 470439.0 461251 454724.0 455626.0 516847.0 525192.0 [3,] 540744.5 538931.5 532632.5 526363 518759.5 524846.5 581426.5 595238.5 [4,] 590865.0 589379.0 579799.0 573100 567456.0 569028.0 619567.0 625809.0 [5,] 593408.0 590072.0 584428.0 574205 572775.0 572942.0 620735.0 628884.0 [,9] [,10] [,11] [,12] [1,] 512927.0 502831.0 470984 471067 [2,] 522975.0 518585.0 509239 512238 [3,] 595302.5 576544.5 556543 556031 [4,] 619916.0 611324.0 594167 595454 [5,] 628232.0 612117.0 595404 597141 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 466684.5 464898.6 462091.8 454216.8 446043.7 451698.5 515168.8 530337.3 [2,] 614804.5 612964.4 603173.2 598509.2 591475.3 597994.5 647684.2 660139.7 [,9] [,10] [,11] [,12] [1,] 532772.4 516724.8 501761.7 502354 [2,] 657832.6 636364.2 611324.3 609708 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(467037, 476049, 540744.5, 590865, 593408, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5aixn1193583157.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,] 431328.0 454724 500857.0 536662.0 567456.0 557274.0 NA [2,] 445427.5 465845 509530.0 549465.5 578764.0 572858.5 NA [3,] 469010.5 492644 533254.0 577927.5 593134.5 583712.0 NA [4,] 493423.0 517716 567393.5 603108.5 616426.0 606487.5 NA [5,] 512927.0 525192 579714.0 612613.0 628884.0 625809.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 447119.4 468985.3 506862.1 553460.6 575956.6 568373.6 NA [2,] 490901.6 516302.7 559645.9 602394.4 610312.4 599050.4 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(431328, 445427.5, 469010.5, 493423, 512927, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6w9qj1193583157.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,] 511426.8 518759.5 513007.4 [2,] 521005.7 529497.8 523234.9 [3,] 540977.3 548387.8 544095.9 [4,] 566830.2 578985.5 569681.9 [5,] 580005.8 595302.5 580435.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 520076.4 525816.1 522911.1 [2,] 561878.2 570959.4 565280.8 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(511426.833333333, 521005.666666667, 540977.333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1lb881193583157.ps tmp/1lb881193583157.png") > system("convert tmp/2z3921193583157.ps tmp/2z3921193583157.png") > system("convert tmp/3x2aj1193583157.ps tmp/3x2aj1193583157.png") > system("convert tmp/4pi9n1193583157.ps tmp/4pi9n1193583157.png") > system("convert tmp/5aixn1193583157.ps tmp/5aixn1193583157.png") > system("convert tmp/6w9qj1193583157.ps tmp/6w9qj1193583157.png") > > > proc.time() user system elapsed 2.403 1.364 2.607