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(910,910,970,950,980,860,920,950,900,950,950,940,860,810,870,960,970,860,850,910,970,980,970,1000,910,740,810,1050,920,830,880,910,880,960,900,1110,870,720,780,970,1020,830,820,920,840,920,920,1150,820,760,760,960,1010,790,820,880,820,870,870,1230,760,810,850,990,940,850,860,860,780,880,850,1220,850,800,840,1090,810,870,810,860,800,870,860,1220,820,860,750,1020,780,830,860,850,820,790,1020,1230,760,880,760,1090,840,900,930,820,780,870,990,1270) > 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,] 910 860 910 870 820 760 850 820 760 NA [2,] 910 810 740 720 760 810 800 860 880 NA [3,] 970 870 810 780 760 850 840 750 760 NA [4,] 950 960 1050 970 960 990 1090 1020 1090 NA [5,] 980 970 920 1020 1010 940 810 780 840 NA [6,] 860 860 830 830 790 850 870 830 900 NA [7,] 920 850 880 820 820 860 810 860 930 NA [8,] 950 910 910 920 880 860 860 850 820 NA [9,] 900 970 880 840 820 780 800 820 780 NA [10,] 950 980 960 920 870 880 870 790 870 NA [11,] 950 970 900 920 870 850 860 1020 990 NA [12,] 940 1000 1110 1150 1230 1220 1220 1230 1270 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 -50 -170 -150 -60 50 -50 40 120 NA [2,] 60 60 70 60 0 40 40 -110 -120 NA [3,] -20 90 240 190 200 140 250 270 330 NA [4,] 30 10 -130 50 50 -50 -280 -240 -250 NA [5,] -120 -110 -90 -190 -220 -90 60 50 60 NA [6,] 60 -10 50 -10 30 10 -60 30 30 NA [7,] 30 60 30 100 60 0 50 -10 -110 NA [8,] -50 60 -30 -80 -60 -80 -60 -30 -40 NA [9,] 50 10 80 80 50 100 70 -30 90 NA [10,] 0 -10 -60 0 0 -30 -10 230 120 NA [11,] -10 30 210 230 360 370 360 210 280 NA [12,] -80 -90 -240 -330 -470 -370 -400 -470 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/1ko6y1377049705.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/25ry91377049705.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/337e81377049705.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/41m6j1377049705.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,] 760 720 750 950 780 790 810 820 780 790 850 940 [2,] 820 760 760 960 840 830 820 860 800 870 870 1110 [3,] 850 810 810 990 940 850 860 880 820 880 920 1220 [4,] 870 860 850 1050 980 860 880 910 880 950 970 1230 [5,] 910 910 970 1090 1020 900 930 950 970 980 1020 1270 $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,] 823.6667 757.3333 762.6 942.6 866.2667 834.2 828.4 853.6667 777.8667 [2,] 876.3333 862.6667 857.4 1037.4 1013.7333 865.8 891.6 906.3333 862.1333 [,10] [,11] [,12] [1,] 837.8667 867.3333 1156.8 [2,] 922.1333 972.6667 1283.2 $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(760, 820, 850, 870, 910, 720, 760, 810, 860, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5nvs91377049705.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 0 -20 -280 -220 -60 -10 -80 10 -10 -10 -470 [2,] -60 0 140 -240 -120 -10 0 -60 50 -10 210 -435 [3,] -50 40 200 -50 -90 30 30 -50 70 0 230 -350 [4,] 40 60 250 30 50 30 60 -30 80 0 360 -165 [5,] 120 70 330 50 60 60 100 -30 100 0 370 -80 $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,] -102.666667 8.4 142.0667 -192.2 -179.5333333 8.933333 -1.6 -65.8 54.2 [2,] 2.666667 71.6 257.9333 92.2 -0.4666667 51.066667 61.6 -34.2 85.8 [,10] [,11] [,12] [1,] -5.266667 151 -500.8259 [2,] 5.266667 309 -199.1741 $out [1] -110 -120 -110 60 -30 -60 -30 230 120 $group [1] 2 2 7 8 9 10 10 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-170, -60, -50, 40, 120, 0, 0, 40, 60, 70, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/66fwy1377049705.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,] 860 810 740 720 760 760 800 750 760 NA [2,] 910 860 855 825 805 830 810 805 800 NA [3,] 945 935 905 895 845 855 855 840 875 NA [4,] 950 970 940 945 920 910 870 940 960 NA [5,] 980 1000 1050 1020 1010 990 870 1020 1090 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 926.7557 884.8283 866.2309 840.2672 792.5477 818.5115 827.6336 778.4256 [2,] 963.2443 985.1717 943.7691 949.7328 897.4523 891.4885 882.3664 901.5744 [,9] [,10] [1,] 802.0229 NA [2,] 947.9771 NA $out [1] 1110 1150 1230 1220 1090 1220 1230 1270 $group [1] 3 4 5 6 7 7 8 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(860, 910, 945, 950, 980, 810, 860, 935, 970, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7z9xl1377049705.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,] 810.0000 810 805.0 [2,] 841.6667 835 842.5 [3,] 872.7778 870 867.5 [4,] 922.2222 930 915.0 [5,] 1008.8889 990 1005.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 836.0358 826.6699 834.4323 [2,] 909.5197 913.3301 900.5677 $out [1] 1152.222 1220.000 1170.000 $group [1] 1 2 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(810, 841.666666666667, 872.777777777778, 922.222222222222, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ko6y1377049705.ps tmp/1ko6y1377049705.png",intern=TRUE)) character(0) > try(system("convert tmp/25ry91377049705.ps tmp/25ry91377049705.png",intern=TRUE)) character(0) > try(system("convert tmp/337e81377049705.ps tmp/337e81377049705.png",intern=TRUE)) character(0) > try(system("convert tmp/41m6j1377049705.ps tmp/41m6j1377049705.png",intern=TRUE)) character(0) > try(system("convert tmp/5nvs91377049705.ps tmp/5nvs91377049705.png",intern=TRUE)) character(0) > try(system("convert tmp/66fwy1377049705.ps tmp/66fwy1377049705.png",intern=TRUE)) character(0) > try(system("convert tmp/7z9xl1377049705.ps tmp/7z9xl1377049705.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.908 1.102 5.983