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(940,950,920,930,930,900,940,840,890,850,830,940,960,900,940,920,930,970,930,780,810,870,720,880,920,920,950,950,890,960,780,780,760,860,740,1020,890,1040,920,900,950,990,840,740,840,960,790,1010,900,970,920,980,890,1000,880,740,860,940,760,1010,870,980,920,950,880,980,910,730,880,820,690,990,800,960,910,950,940,1010,890,660,860,840,740,980,820,1080,930,970,930,1010,880,740,860,810,750,890,790,1000,890,970,900,990,910,730,850,840,830,950) > 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,] 940 960 920 890 900 870 800 820 790 NA [2,] 950 900 920 1040 970 980 960 1080 1000 NA [3,] 920 940 950 920 920 920 910 930 890 NA [4,] 930 920 950 900 980 950 950 970 970 NA [5,] 930 930 890 950 890 880 940 930 900 NA [6,] 900 970 960 990 1000 980 1010 1010 990 NA [7,] 940 930 780 840 880 910 890 880 910 NA [8,] 840 780 780 740 740 730 660 740 730 NA [9,] 890 810 760 840 860 880 860 860 850 NA [10,] 850 870 860 960 940 820 840 810 840 NA [11,] 830 720 740 790 760 690 740 750 830 NA [12,] 940 880 1020 1010 1010 990 980 890 950 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 10 -60 0 150 70 110 160 260 210 NA [2,] -30 40 30 -120 -50 -60 -50 -150 -110 NA [3,] 10 -20 0 -20 60 30 40 40 80 NA [4,] 0 10 -60 50 -90 -70 -10 -40 -70 NA [5,] -30 40 70 40 110 100 70 80 90 NA [6,] 40 -40 -180 -150 -120 -70 -120 -130 -80 NA [7,] -100 -150 0 -100 -140 -180 -230 -140 -180 NA [8,] 50 30 -20 100 120 150 200 120 120 NA [9,] -40 60 100 120 80 -60 -20 -50 -10 NA [10,] -20 -150 -120 -170 -180 -130 -100 -60 -10 NA [11,] 110 160 280 220 250 300 240 140 120 NA [12,] 20 40 -130 -110 -140 -190 -160 -100 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/1eevb1344515281.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/25zu71344515281.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/37bnd1344515281.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/4pukl1344515281.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,] 790 900 910 900 880 960 840 660 810 810 690 880 [2,] 820 950 920 930 890 970 880 730 840 840 740 940 [3,] 890 970 920 950 930 990 890 740 860 850 750 980 [4,] 920 1000 930 970 930 1000 910 780 860 870 790 1010 [5,] 960 1040 940 980 950 1010 940 840 890 870 830 1020 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 837.3333 943.6667 914.7333 928.9333 908.9333 974.2 874.2 713.6667 [2,] 942.6667 996.3333 925.2667 971.0667 951.0667 1005.8 905.8 766.3333 [,9] [,10] [,11] [,12] [1,] 849.4667 834.2 723.6667 943.1333 [2,] 870.5333 865.8 776.3333 1016.8667 $out [1] 1080 950 890 900 780 760 960 940 $group [1] 2 3 3 6 7 9 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(790, 820, 890, 920, 960, 900, 950, 970, 1000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5g1wd1344515281.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,] -60 -150 -20 -90 -30 -180 -230 -20 -60 -180 110 -190 [2,] 10 -110 0 -70 40 -130 -180 50 -40 -150 140 -150 [3,] 110 -50 30 -40 70 -120 -140 120 -10 -120 220 -120 [4,] 160 -30 40 0 90 -70 -100 120 80 -60 250 -40 [5,] 260 40 80 50 110 -40 0 200 120 -10 300 40 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 31 -92.133333 8.933333 -76.866667 43.66667 -151.6 -182.13333 83.13333 [2,] 189 -7.866667 51.066667 -3.133333 96.33333 -88.4 -97.86667 156.86667 [,9] [,10] [,11] [,12] [1,] -73.2 -167.4 162.0667 -181.44758 [2,] 53.2 -72.6 277.9333 -58.55242 $out [1] 40 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-60, 10, 110, 160, 260, -150, -110, -50, -30, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6qe1g1344515281.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,] 830 720 740 740 740 690 660 740 730 NA [2,] 870 840 780 840 870 845 820 815 835 NA [3,] 925 910 905 910 910 895 900 885 895 NA [4,] 940 935 950 975 975 965 955 950 960 NA [5,] 950 970 1020 1040 1010 990 1010 1080 1000 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 893.0725 866.6699 827.4619 848.4256 862.1088 840.2672 838.4256 823.4256 [2,] 956.9275 953.3301 982.5381 971.5744 957.8912 949.7328 961.5744 946.5744 [,9] [,10] [1,] 837.9867 NA [2,] 952.0133 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(830, 870, 925, 940, 950, 720, 840, 910, 935, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7b3d31344515281.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,] 748.8889 740 755.0 [2,] 855.5556 855 852.5 [3,] 900.0000 905 902.5 [4,] 955.0000 960 962.5 [5,] 978.8889 990 985.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 854.6427 857.1088 852.3283 [2,] 945.3573 952.8912 952.6717 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(748.888888888889, 855.555555555556, 900, 955, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1eevb1344515281.ps tmp/1eevb1344515281.png",intern=TRUE)) character(0) > try(system("convert tmp/25zu71344515281.ps tmp/25zu71344515281.png",intern=TRUE)) character(0) > try(system("convert tmp/37bnd1344515281.ps tmp/37bnd1344515281.png",intern=TRUE)) character(0) > try(system("convert tmp/4pukl1344515281.ps tmp/4pukl1344515281.png",intern=TRUE)) character(0) > try(system("convert tmp/5g1wd1344515281.ps tmp/5g1wd1344515281.png",intern=TRUE)) character(0) > try(system("convert tmp/6qe1g1344515281.ps tmp/6qe1g1344515281.png",intern=TRUE)) character(0) > try(system("convert tmp/7b3d31344515281.ps tmp/7b3d31344515281.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.319 0.533 2.864