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(840,880,930,920,940,880,980,860,900,930,870,1000,870,860,930,980,1010,860,1140,880,800,900,900,1000,890,890,870,1000,1050,790,1160,830,730,950,980,910,840,860,880,1030,1060,770,1140,890,740,860,1050,840,810,830,920,1070,1040,740,1250,850,790,810,1080,760,840,820,900,1010,1080,780,1150,820,790,820,1130,800,890,810,950,1090,1090,850,1200,790,800,850,1230,800,930,700,1030,1040,1000,830,1190,720,810,870,1190,800,970,690,1010,1030,950,830,1150,750,840,880,1210,830) > 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,] 840 870 890 840 810 840 890 930 970 NA [2,] 880 860 890 860 830 820 810 700 690 NA [3,] 930 930 870 880 920 900 950 1030 1010 NA [4,] 920 980 1000 1030 1070 1010 1090 1040 1030 NA [5,] 940 1010 1050 1060 1040 1080 1090 1000 950 NA [6,] 880 860 790 770 740 780 850 830 830 NA [7,] 980 1140 1160 1140 1250 1150 1200 1190 1150 NA [8,] 860 880 830 890 850 820 790 720 750 NA [9,] 900 800 730 740 790 790 800 810 840 NA [10,] 930 900 950 860 810 820 850 870 880 NA [11,] 870 900 980 1050 1080 1130 1230 1190 1210 NA [12,] 1000 1000 910 840 760 800 800 800 830 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 40 -10 0 20 20 -20 -80 -230 -280 NA [2,] 50 70 -20 20 90 80 140 330 320 NA [3,] -10 50 130 150 150 110 140 10 20 NA [4,] 20 30 50 30 -30 70 0 -40 -80 NA [5,] -60 -150 -260 -290 -300 -300 -240 -170 -120 NA [6,] 100 280 370 370 510 370 350 360 320 NA [7,] -120 -260 -330 -250 -400 -330 -410 -470 -400 NA [8,] 40 -80 -100 -150 -60 -30 10 90 90 NA [9,] 30 100 220 120 20 30 50 60 40 NA [10,] -60 0 30 190 270 310 380 320 330 NA [11,] 130 100 -70 -210 -320 -330 -430 -390 -380 NA [12,] -130 -110 -70 -30 80 90 130 170 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/1z39b1344496000.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/20y9o1344496000.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/3hrys1344496000.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/4zjxa1344496000.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,] 810 810 870 980 940 740 1140 720 790 810 870 760 [2,] 840 810 900 1000 1000 780 1140 790 790 850 980 800 [3,] 870 830 930 1030 1040 830 1150 830 800 870 1080 830 [4,] 890 860 950 1040 1060 850 1190 860 810 900 1190 910 [5,] 930 890 1010 1090 1090 880 1250 890 840 950 1230 1000 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 843.6667 803.6667 903.6667 1008.933 1008.4 793.1333 1123.667 793.1333 [2,] 896.3333 856.3333 956.3333 1051.067 1071.6 866.8667 1176.333 866.8667 [,9] [,10] [,11] [,12] [1,] 789.4667 843.6667 969.4 772.0667 [2,] 810.5333 896.3333 1190.6 887.9333 $out [1] 970 700 690 1030 920 980 900 730 740 $group [1] 1 2 2 3 4 7 9 9 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(810, 840, 870, 890, 930, 810, 810, 830, 860, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5mez11344496000.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,] -230 -20 -10 -80 -300 280 -470 -150 20 -60 -430 -130 [2,] -80 50 20 -30 -290 320 -400 -80 30 30 -380 -90 [3,] -10 80 110 20 -240 360 -330 -30 50 270 -320 25 [4,] 20 140 140 30 -150 370 -260 40 100 320 -70 110 [5,] 40 140 150 70 -60 370 -120 90 120 380 130 170 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -62.66667 32.6 46.8 -11.6 -313.7333 333.6667 -403.7333 -93.2 13.13333 [2,] 42.66667 127.4 173.2 51.6 -166.2667 386.3333 -256.2667 33.2 86.86667 [,10] [,11] [,12] [1,] 117.2667 -483.2667 -86.72287 [2,] 422.7333 -156.7333 136.72287 $out [1] -280 330 320 100 510 220 $group [1] 1 2 2 6 6 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-230, -80, -10, 20, 40, -20, 50, 80, 140, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6kub71344496000.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,] 840 800 730 740 740 780 790 700 690 NA [2,] 875 865 850 840 800 810 805 805 830 NA [3,] 910 900 900 870 840 830 870 900 915 NA [4,] 935 990 990 1040 1055 1045 1090 1035 1020 NA [5,] 1000 1140 1160 1140 1250 1150 1230 1190 1210 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 882.6336 842.9867 836.1451 778.7787 723.6928 722.8149 740.0096 795.0955 [2,] 937.3664 957.0133 963.8549 961.2213 956.3072 937.1851 999.9904 1004.9045 [,9] [,10] [1,] 828.3397 NA [2,] 1001.6603 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(840, 875, 910, 935, 1000, 800, 865, 900, 990, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/76det1344496000.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,] 800.0000 800 800 [2,] 818.3333 830 830 [3,] 875.0000 870 870 [4,] 1021.6667 1035 1025 [5,] 1151.1111 1150 1165 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 782.2583 776.4981 781.0592 [2,] 967.7417 963.5019 958.9408 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(800, 818.333333333333, 875, 1021.66666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1z39b1344496000.ps tmp/1z39b1344496000.png",intern=TRUE)) character(0) > try(system("convert tmp/20y9o1344496000.ps tmp/20y9o1344496000.png",intern=TRUE)) character(0) > try(system("convert tmp/3hrys1344496000.ps tmp/3hrys1344496000.png",intern=TRUE)) character(0) > try(system("convert tmp/4zjxa1344496000.ps tmp/4zjxa1344496000.png",intern=TRUE)) character(0) > try(system("convert tmp/5mez11344496000.ps tmp/5mez11344496000.png",intern=TRUE)) character(0) > try(system("convert tmp/6kub71344496000.ps tmp/6kub71344496000.png",intern=TRUE)) character(0) > try(system("convert tmp/76det1344496000.ps tmp/76det1344496000.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.126 0.559 2.686