R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(500,510,590,490,540,530,550,510,390,480,530,690,570,460,540,510,520,520,580,480,410,530,540,670,570,400,510,570,470,640,650,500,340,450,600,680,630,480,400,520,470,610,670,500,290,470,660,650,570,500,400,500,340,530,680,480,340,460,630,650,550,470,240,430,390,570,700,620,280,480,560,560,560,550,140,380,390,500,750,680,280,360,590,580,490,610,170,320,440,510,770,660,300,350,580,620,490,640,150,290,370,560,780,690,310,280,590,590) > 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,] 500 570 570 630 570 550 560 490 490 NA [2,] 510 460 400 480 500 470 550 610 640 NA [3,] 590 540 510 400 400 240 140 170 150 NA [4,] 490 510 570 520 500 430 380 320 290 NA [5,] 540 520 470 470 340 390 390 440 370 NA [6,] 530 520 640 610 530 570 500 510 560 NA [7,] 550 580 650 670 680 700 750 770 780 NA [8,] 510 480 500 500 480 620 680 660 690 NA [9,] 390 410 340 290 340 280 280 300 310 NA [10,] 480 530 450 470 460 480 360 350 280 NA [11,] 530 540 600 660 630 560 590 580 590 NA [12,] 690 670 680 650 650 560 580 620 590 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 10 -110 -170 -150 -70 -80 -10 120 150 NA [2,] 80 80 110 -80 -100 -230 -410 -440 -490 NA [3,] -100 -30 60 120 100 190 240 150 140 NA [4,] 50 10 -100 -50 -160 -40 10 120 80 NA [5,] -10 0 170 140 190 180 110 70 190 NA [6,] 20 60 10 60 150 130 250 260 220 NA [7,] -40 -100 -150 -170 -200 -80 -70 -110 -90 NA [8,] -120 -70 -160 -210 -140 -340 -400 -360 -380 NA [9,] 90 120 110 180 120 200 80 50 -30 NA [10,] 50 10 150 190 170 80 230 230 310 NA [11,] 160 130 80 -10 20 0 -10 40 0 NA [12,] -120 -100 -50 -80 -100 0 -90 -130 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/wessaorg/rcomp/tmp/1l3991344844932.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/wessaorg/rcomp/tmp/2kb9a1344844932.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/wessaorg/rcomp/tmp/3qkov1344844932.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/wessaorg/rcomp/tmp/4xdv01344844932.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,] 490 400 140 290 340 500 550 480 280 280 530 560 [2,] 500 470 170 380 390 520 650 500 290 360 560 590 [3,] 560 500 400 490 440 530 680 510 310 460 590 650 [4,] 570 550 510 510 470 570 750 660 340 480 600 670 [5,] 630 640 590 570 540 640 780 690 410 530 660 690 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 523.1333 457.8667 220.9333 421.5333 397.8667 503.6667 627.3333 425.7333 [2,] 596.8667 542.1333 579.0667 558.4667 482.1333 556.3333 732.6667 594.2667 [,9] [,10] [,11] [,12] [1,] 283.6667 396.8 568.9333 607.8667 [2,] 336.3333 523.2 611.0667 692.1333 $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(490, 500, 560, 570, 630, 400, 470, 500, 550, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/51ity1344844932.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,] -170 -490 -30 -160 -10 10 -200 -400 50 10 -10 -130 [2,] -110 -410 60 -50 70 60 -150 -360 80 80 0 -110 [3,] -70 -100 120 10 140 130 -100 -210 110 170 20 -95 [4,] 10 80 150 50 180 220 -80 -140 120 230 80 -65 [5,] 150 110 240 120 190 260 -40 -70 180 310 160 0 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -133.2 -358.0667 72.6 -42.66667 82.06667 45.73333 -136.86667 -325.86667 [2,] -6.8 158.0667 167.4 62.66667 197.93333 214.26667 -63.13333 -94.13333 [,9] [,10] [,11] [,12] [1,] 88.93333 91 -22.13333 -120.13765 [2,] 131.06667 249 62.13333 -69.86235 $out [1] -100 200 -30 $group [1] 3 9 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-170, -110, -70, 10, 150, -490, -410, -100, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6sd6j1344844932.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,] 480 410 340 290 340 240 140 170 150 NA [2,] 495 495 460 470 430 410 370 335 300 NA [3,] 520 525 540 510 500 515 525 500 525 NA [4,] 545 555 620 640 600 565 585 615 615 NA [5,] 590 580 680 670 680 700 750 770 780 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 497.1947 497.6336 467.0229 432.4619 422.4619 444.3035 426.9371 372.2901 [2,] 542.8053 552.3664 612.9771 587.5381 577.5381 585.6965 623.0629 627.7099 [,9] [,10] [1,] 381.3264 NA [2,] 668.6736 NA $out [1] 390 690 670 $group [1] 1 1 2 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(480, 495, 520, 545, 590, 410, 495, 525, 555, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7p1xm1344844932.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,] 326.6667 310 315.0 [2,] 432.7778 450 425.0 [3,] 530.5556 505 522.5 [4,] 577.7778 575 580.0 [5,] 681.1111 680 700.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 464.4201 447.9867 451.8035 [2,] 596.6910 562.0133 593.1965 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(326.666666666667, 432.777777777778, 530.555555555556, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1l3991344844932.ps tmp/1l3991344844932.png",intern=TRUE)) character(0) > try(system("convert tmp/2kb9a1344844932.ps tmp/2kb9a1344844932.png",intern=TRUE)) character(0) > try(system("convert tmp/3qkov1344844932.ps tmp/3qkov1344844932.png",intern=TRUE)) character(0) > try(system("convert tmp/4xdv01344844932.ps tmp/4xdv01344844932.png",intern=TRUE)) character(0) > try(system("convert tmp/51ity1344844932.ps tmp/51ity1344844932.png",intern=TRUE)) character(0) > try(system("convert tmp/6sd6j1344844932.ps tmp/6sd6j1344844932.png",intern=TRUE)) character(0) > try(system("convert tmp/7p1xm1344844932.ps tmp/7p1xm1344844932.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.175 0.544 2.742