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(1020,970,1030,970,1070,1650,1010,980,1050,1010,1040,1120,1090,1060,990,950,1540,870,1070,1050,1020,960,1100,1190,1040,1090,1050,850,1100,850,1040,990,1040,1100,1030,1290,1040,1170,1040,860,1090,870,1080,1000,980,1080,1040,1280,1140,1220,1080,790,1020,830,1150,1030,900,1140,1010,1270,1090,1090,980,850,1010,810,1070,1040,880,1110,1010,1230,490,1040,1010,860,1010,800,1130,1040,940,1070,1030,1320,1040,1070,1070,770,1010,810,1150,1030,890,1010,1120,1250,990,1020,1110,830,1030,870,1260,980,940,970,1100,1320) > 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,] 1020 1090 1040 1040 1140 1090 490 1040 990 NA [2,] 970 1060 1090 1170 1220 1090 1040 1070 1020 NA [3,] 1030 990 1050 1040 1080 980 1010 1070 1110 NA [4,] 970 950 850 860 790 850 860 770 830 NA [5,] 1070 1540 1100 1090 1020 1010 1010 1010 1030 NA [6,] 1650 870 850 870 830 810 800 810 870 NA [7,] 1010 1070 1040 1080 1150 1070 1130 1150 1260 NA [8,] 980 1050 990 1000 1030 1040 1040 1030 980 NA [9,] 1050 1020 1040 980 900 880 940 890 940 NA [10,] 1010 960 1100 1080 1140 1110 1070 1010 970 NA [11,] 1040 1100 1030 1040 1010 1010 1030 1120 1100 NA [12,] 1120 1190 1290 1280 1270 1230 1320 1250 1320 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -50 -30 50 130 80 0 550 30 30 NA [2,] 60 -70 -40 -130 -140 -110 -30 0 90 NA [3,] -60 -40 -200 -180 -290 -130 -150 -300 -280 NA [4,] 100 590 250 230 230 160 150 240 200 NA [5,] 580 -670 -250 -220 -190 -200 -210 -200 -160 NA [6,] -640 200 190 210 320 260 330 340 390 NA [7,] -30 -20 -50 -80 -120 -30 -90 -120 -280 NA [8,] 70 -30 50 -20 -130 -160 -100 -140 -40 NA [9,] -40 -60 60 100 240 230 130 120 30 NA [10,] 30 140 -70 -40 -130 -100 -40 110 130 NA [11,] 80 90 260 240 260 220 290 130 220 NA [12,] -30 -150 -250 -140 -180 -740 -280 -260 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/1s7pp1343999708.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/267d61343999708.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/3lqa71343999708.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/4l5db1343999708.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,] 990 970 980 790 1010 800 1010 980 880 960 1010 1190 [2,] 1020 1040 1010 830 1010 810 1070 990 900 1010 1030 1230 [3,] 1040 1070 1040 850 1030 850 1080 1030 940 1070 1040 1270 [4,] 1090 1090 1070 860 1090 870 1150 1040 1020 1100 1100 1290 [5,] 1140 1090 1110 860 1100 870 1260 1050 1050 1140 1120 1320 $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,] 1003.133 1043.667 1008.4 834.2 987.8667 818.4 1037.867 1003.667 876.8 [2,] 1076.867 1096.333 1071.6 865.8 1072.1333 881.6 1122.133 1056.333 1003.2 [,10] [,11] [,12] [1,] 1022.6 1003.133 1238.4 [2,] 1117.4 1076.867 1301.6 $out [1] 490 1170 1220 970 950 770 1540 1650 1120 $group [1] 1 2 2 4 4 4 5 6 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(990, 1020, 1040, 1090, 1140, 970, 1040, 1070, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5caah1343999708.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,] -50 -140 -300 100 -250 190 -120 -160 -60 -130 80 -280 [2,] 0 -110 -280 160 -220 200 -120 -130 30 -70 130 -270 [3,] 30 -40 -180 230 -200 260 -80 -40 100 -40 220 -215 [4,] 80 0 -130 240 -190 330 -30 -20 130 110 260 -145 [5,] 130 90 -40 250 -160 390 -20 70 240 140 290 -30 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -12.13333 -97.93333 -259 187.8667 -215.8 191.5333 -127.4 -97.93333 [2,] 72.13333 17.93333 -101 272.1333 -184.2 328.4667 -32.6 17.93333 [,9] [,10] [,11] [,12] [1,] 47.33333 -134.8 151.5333 -284.8268 [2,] 152.66667 54.8 288.4667 -145.1732 $out [1] 550 590 580 -670 -640 -280 -740 $group [1] 1 4 5 5 6 7 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-50, 0, 30, 80, 130, -140, -110, -40, 0, 90, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6w9fm1343999708.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,] 970 870 990 860 790 810 800 770 830 NA [2,] 995 975 1010 990 955 930 900 950 955 NA [3,] 1025 1055 1040 1040 1055 1025 1020 1035 1005 NA [4,] 1060 1095 1095 1085 1145 1090 1055 1095 1105 NA [5,] 1120 1190 1100 1170 1270 1230 1130 1250 1320 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 995.3531 1000.267 1001.231 996.6699 968.3397 952.0229 949.3035 [2,] 1054.6469 1109.733 1078.769 1083.3301 1141.6603 1097.9771 1090.6965 [,8] [,9] [,10] [1,] 968.8645 936.584 NA [2,] 1101.1355 1073.416 NA $out [1] 1650 1540 850 850 1290 1280 490 1320 $group [1] 1 2 3 3 3 4 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(970, 995, 1025, 1060, 1120, 870, 975, 1055, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7ysje1343999708.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,] 858.8889 940 960.0 [2,] 976.6667 985 987.5 [3,] 1045.0000 1040 1052.5 [4,] 1089.4444 1070 1065.0 [5,] 1252.2222 1080 1110.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 993.5613 1001.231 1017.152 [2,] 1096.4387 1078.769 1087.848 $out [1] 850 850 1270 845 840 1260 $group [1] 2 2 2 3 3 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(858.888888888889, 976.666666666667, 1045, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1s7pp1343999708.ps tmp/1s7pp1343999708.png",intern=TRUE)) character(0) > try(system("convert tmp/267d61343999708.ps tmp/267d61343999708.png",intern=TRUE)) character(0) > try(system("convert tmp/3lqa71343999708.ps tmp/3lqa71343999708.png",intern=TRUE)) character(0) > try(system("convert tmp/4l5db1343999708.ps tmp/4l5db1343999708.png",intern=TRUE)) character(0) > try(system("convert tmp/5caah1343999708.ps tmp/5caah1343999708.png",intern=TRUE)) character(0) > try(system("convert tmp/6w9fm1343999708.ps tmp/6w9fm1343999708.png",intern=TRUE)) character(0) > try(system("convert tmp/7ysje1343999708.ps tmp/7ysje1343999708.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.419 0.803 4.236