R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) 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(580,610,550,515,555,580,585,545,580,605,625,600,590,605,475,535,560,610,585,560,590,625,620,615,560,665,495,555,545,605,610,610,550,600,660,590,555,650,530,565,580,630,605,595,565,585,685,585,520,670,525,565,575,610,605,575,565,575,720,580,565,675,525,575,560,585,550,560,605,585,685,585,555,660,530,575,580,615,570,550,635,580,690,575,590,685,540,580,615,605,565,555,625,605,685,540,610,680,560,575,590,625,520,590,625,560,715,575) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean Plot (v1.0.4) 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 > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 108 > (np <- floor(n / par1)) [1] 9 > arr <- array(NA,dim=c(par1,np+1)) > darr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > dx <- diff(x) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + darr[j,ari[j]] <- dx[i] + if (j == par1) j = 0 + } > ari [1] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 580 590 560 555 520 565 555 590 610 NA [2,] 610 605 665 650 670 675 660 685 680 NA [3,] 550 475 495 530 525 525 530 540 560 NA [4,] 515 535 555 565 565 575 575 580 575 NA [5,] 555 560 545 580 575 560 580 615 590 NA [6,] 580 610 605 630 610 585 615 605 625 NA [7,] 585 585 610 605 605 550 570 565 520 NA [8,] 545 560 610 595 575 560 550 555 590 NA [9,] 580 590 550 565 565 605 635 625 625 NA [10,] 605 625 600 585 575 585 580 605 560 NA [11,] 625 620 660 685 720 685 690 685 715 NA [12,] 600 615 590 585 580 585 575 540 575 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 30 15 105 95 150 110 105 95 70 NA [2,] -60 -130 -170 -120 -145 -150 -130 -145 -120 NA [3,] -35 60 60 35 40 50 45 40 15 NA [4,] 40 25 -10 15 10 -15 5 35 15 NA [5,] 25 50 60 50 35 25 35 -10 35 NA [6,] 5 -25 5 -25 -5 -35 -45 -40 -105 NA [7,] -40 -25 0 -10 -30 10 -20 -10 70 NA [8,] 35 30 -60 -30 -10 45 85 70 35 NA [9,] 25 35 50 20 10 -20 -55 -20 -65 NA [10,] 20 -5 60 100 145 100 110 80 155 NA [11,] -25 -5 -70 -100 -140 -100 -115 -145 -140 NA [12,] -10 -55 -35 -65 -15 -30 15 70 NA 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/fisher/rcomp/tmp/1kphb1377081006.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/21y0v1377081006.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/3stfu1377081006.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/4c0mx1377081006.ps",horizontal=F,onefile=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,] 520 650 525 535 545 605 520 545 550 560 620 575 [2,] 555 650 525 555 560 605 565 555 565 580 660 575 [3,] 565 665 530 565 575 610 585 560 590 585 685 585 [4,] 590 675 540 575 580 615 605 590 625 605 690 590 [5,] 610 685 560 580 590 630 610 610 635 625 720 600 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 546.5667 651.8333 522.1 554.4667 564.4667 604.7333 563.9333 541.5667 558.4 [2,] 583.4333 678.1667 537.9 575.5333 585.5333 615.2667 606.0667 578.4333 621.6 [,10] [,11] [,12] [1,] 571.8333 669.2 577.1 [2,] 598.1667 700.8 592.9 $out [1] 610 605 475 495 515 615 580 585 615 540 $group [1] 2 2 3 3 4 5 6 6 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(520, 555, 565, 590, 610, 650, 650, 665, 675, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5pelh1377081006.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(darr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Differenced Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 30 -170 15 -15 -10 -45 -40 -60 -65 -5 -145 -65.0 [2,] 70 -145 35 5 25 -40 -25 -10 -20 60 -140 -45.0 [3,] 95 -130 40 15 35 -25 -10 35 10 100 -100 -22.5 [4,] 105 -120 50 25 50 -5 0 45 25 110 -70 2.5 [5,] 150 -120 60 40 60 5 10 85 50 155 -5 70.0 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 76.56667 -143.1667 32.1 4.466667 21.83333 -43.433333 -23.166667 [2,] 113.43333 -116.8333 47.9 25.533333 48.16667 -6.566667 3.166667 [,8] [,9] [,10] [,11] [,12] [1,] 6.033333 -13.7 73.66667 -136.86667 -49.034182 [2,] 63.966667 33.7 126.33333 -63.13333 4.034182 $out [1] 15 -60 -35 -105 70 $group [1] 1 2 3 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(30, 70, 95, 105, 150, -170, -145, -130, -120, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6ydst1377081006.ps",horizontal=F,onefile=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] [,8] [,9] [,10] [1,] 515.0 535.0 495.0 530.0 520.0 525 530.0 540.0 520.0 NA [2,] 552.5 560.0 552.5 565.0 565.0 560 562.5 560.0 567.5 NA [3,] 580.0 590.0 595.0 585.0 575.0 580 577.5 597.5 590.0 NA [4,] 602.5 612.5 610.0 617.5 607.5 595 625.0 620.0 625.0 NA [5,] 625.0 625.0 665.0 685.0 670.0 605 690.0 685.0 680.0 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 557.1947 566.0544 568.7739 561.0544 555.6155 564.0363 548.9933 570.1336 [2,] 602.8053 613.9456 621.2261 608.9456 594.3845 595.9637 606.0067 624.8664 [,9] [,10] [1,] 563.7739 NA [2,] 616.2261 NA $out [1] 475 720 675 685 715 $group [1] 2 5 6 6 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(515, 552.5, 580, 602.5, 625, 535, 560, 590, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7g53y1377081006.ps",horizontal=F,onefile=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,] 525.5556 530 532.50 [2,] 570.2778 565 571.25 [3,] 580.0000 585 583.75 [4,] 600.2778 600 602.50 [5,] 607.2222 610 610.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 566.3168 569.0363 569.4967 [2,] 593.6832 600.9637 598.0033 $out [1] 655.5556 676.1111 665.0000 685.0000 662.5000 675.0000 $group [1] 1 1 2 2 3 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(525.555555555556, 570.277777777778, 580, 600.277777777778, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kphb1377081006.ps tmp/1kphb1377081006.png",intern=TRUE)) character(0) > try(system("convert tmp/21y0v1377081006.ps tmp/21y0v1377081006.png",intern=TRUE)) character(0) > try(system("convert tmp/3stfu1377081006.ps tmp/3stfu1377081006.png",intern=TRUE)) character(0) > try(system("convert tmp/4c0mx1377081006.ps tmp/4c0mx1377081006.png",intern=TRUE)) character(0) > try(system("convert tmp/5pelh1377081006.ps tmp/5pelh1377081006.png",intern=TRUE)) character(0) > try(system("convert tmp/6ydst1377081006.ps tmp/6ydst1377081006.png",intern=TRUE)) character(0) > try(system("convert tmp/7g53y1377081006.ps tmp/7g53y1377081006.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.594 0.727 4.306