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. 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(542,565,555,499,511,526,532,549,561,557,566,588,620,626,620,573,573,574,580,590,593,597,595,612,628,629,621,569,567,573,584,589,591,595,594,611,613,611,594,543,537,544,555,561,562,555,547,565,578,580,569,507,501,509,510,517,519,512,509,519) > 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,] 542 620 628 613 578 NA [2,] 565 626 629 611 580 NA [3,] 555 620 621 594 569 NA [4,] 499 573 569 543 507 NA [5,] 511 573 567 537 501 NA [6,] 526 574 573 544 509 NA [7,] 532 580 584 555 510 NA [8,] 549 590 589 561 517 NA [9,] 561 593 591 562 519 NA [10,] 557 597 595 555 512 NA [11,] 566 595 594 547 509 NA [12,] 588 612 611 565 519 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/1na4z1193601344.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/2sf4y1193601344.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/35nrn1193601344.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/45b3v1193601344.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,] 542 565 555 499 501 509 510 517 519 512 509 519 [2,] 578 580 569 507 511 526 532 549 561 555 547 565 [3,] 613 611 594 543 537 544 555 561 562 557 566 588 [4,] 620 626 620 569 567 573 580 589 591 595 594 611 [5,] 628 629 621 573 573 574 584 590 593 597 595 612 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 583.3229 578.4965 557.9635 499.191 497.4305 510.7899 521.0833 532.7361 [2,] 642.6771 643.5035 630.0365 586.809 576.5695 577.2101 588.9167 589.2639 [,9] [,10] [,11] [,12] [1,] 540.8021 528.7361 532.7899 555.4965 [2,] 583.1979 585.2639 599.2101 620.5035 $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(542, 578, 613, 620, 628, 565, 580, 611, 626, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/58wnf1193601344.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,] 499 573 567.0 537.0 501.0 NA [2,] 529 577 578.5 545.5 509.0 NA [3,] 552 594 592.5 558.0 514.5 NA [4,] 563 616 616.0 579.5 544.0 NA [5,] 588 626 629.0 613.0 580.0 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 536.4924 576.2118 575.396 542.4924 498.5363 NA [2,] 567.5076 611.7882 609.604 573.5076 530.4637 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(499, 529, 552, 563, 588, 573, 577, 594, 616, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6z06s1193601344.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,] 537.8 537.0 538.00 [2,] 548.7 549.5 552.75 [3,] 562.7 561.5 572.75 [4,] 585.4 591.0 591.25 [5,] 602.2 613.0 603.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 545.9609 542.5716 555.1899 [2,] 579.4391 580.4284 590.3101 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(537.8, 548.7, 562.7, 585.4, 602.2, 537, 549.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1na4z1193601344.ps tmp/1na4z1193601344.png") > system("convert tmp/2sf4y1193601344.ps tmp/2sf4y1193601344.png") > system("convert tmp/35nrn1193601344.ps tmp/35nrn1193601344.png") > system("convert tmp/45b3v1193601344.ps tmp/45b3v1193601344.png") > system("convert tmp/58wnf1193601344.ps tmp/58wnf1193601344.png") > system("convert tmp/6z06s1193601344.ps tmp/6z06s1193601344.png") > > > proc.time() user system elapsed 1.320 0.853 1.544