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(1120,1120,1190,1190,1190,1190,1070,1200,1090,1130,1140,1240,1180,1080,1190,1140,1160,1200,980,1260,1100,1210,1150,1140,1110,1120,1100,1170,1120,1250,910,1260,1090,1240,1130,1200,1120,1120,1120,1070,1100,1230,930,1240,980,1270,1140,1160,1160,1220,1160,1090,1060,1230,1070,1240,1050,1350,1100,1130,1170,1360,1150,1180,1010,1190,1000,1270,990,1470,1130,1150,1150,1410,1190,1180,990,1170,1080,1350,960,1490,1120,1090,1220,1370,1180,1190,1000,1250,1090,1370,980,1530,1150,1120,1290,1370,1130,1200,910,1220,1040,1340,950,1500,1120,1150) > 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,] 1120 1180 1110 1120 1160 1170 1150 1220 1290 NA [2,] 1120 1080 1120 1120 1220 1360 1410 1370 1370 NA [3,] 1190 1190 1100 1120 1160 1150 1190 1180 1130 NA [4,] 1190 1140 1170 1070 1090 1180 1180 1190 1200 NA [5,] 1190 1160 1120 1100 1060 1010 990 1000 910 NA [6,] 1190 1200 1250 1230 1230 1190 1170 1250 1220 NA [7,] 1070 980 910 930 1070 1000 1080 1090 1040 NA [8,] 1200 1260 1260 1240 1240 1270 1350 1370 1340 NA [9,] 1090 1100 1090 980 1050 990 960 980 950 NA [10,] 1130 1210 1240 1270 1350 1470 1490 1530 1500 NA [11,] 1140 1150 1130 1140 1100 1130 1120 1150 1120 NA [12,] 1240 1140 1200 1160 1130 1150 1090 1120 1150 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 -100 10 0 60 190 260 150 80 NA [2,] 70 110 -20 0 -60 -210 -220 -190 -240 NA [3,] 0 -50 70 -50 -70 30 -10 10 70 NA [4,] 0 20 -50 30 -30 -170 -190 -190 -290 NA [5,] 0 40 130 130 170 180 180 250 310 NA [6,] -120 -220 -340 -300 -160 -190 -90 -160 -180 NA [7,] 130 280 350 310 170 270 270 280 300 NA [8,] -110 -160 -170 -260 -190 -280 -390 -390 -390 NA [9,] 40 110 150 290 300 480 530 550 550 NA [10,] 10 -60 -110 -130 -250 -340 -370 -380 -380 NA [11,] 100 -10 70 20 30 20 -30 -30 30 NA [12,] -60 -30 -80 0 40 0 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/12zy31342173030.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/299xd1342173030.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/3uhx81342173030.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/4r5531342173030.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,] 1110 1080 1100 1070 910 1170 910 1200 950 1130 1100 1090 [2,] 1120 1120 1130 1140 1000 1190 980 1240 980 1240 1120 1130 [3,] 1160 1220 1160 1180 1060 1220 1040 1260 990 1350 1130 1150 [4,] 1180 1370 1190 1190 1120 1230 1070 1340 1090 1490 1140 1160 [5,] 1220 1410 1190 1200 1190 1250 1090 1370 1100 1530 1150 1200 $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,] 1128.4 1088.333 1128.4 1153.667 996.8 1198.933 992.6 1207.333 932.0667 [2,] 1191.6 1351.667 1191.6 1206.333 1123.2 1241.067 1087.4 1312.667 1047.9333 [,10] [,11] [,12] [1,] 1218.333 1119.467 1134.2 [2,] 1481.667 1140.533 1165.8 $out [1] 1290 1240 $group [1] 1 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1110, 1120, 1160, 1180, 1220, 1080, 1120, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/510pt1342173030.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,] -100 -240 -70 -290 130 -300 270 -390 40 -380 -30 -80 [2,] 0 -210 -50 -190 130 -220 270 -390 150 -370 -10 -45 [3,] 60 -60 0 -50 170 -180 280 -260 300 -250 20 0 [4,] 150 0 30 0 180 -160 300 -170 530 -110 30 85 [5,] 260 110 70 30 250 -90 310 -110 550 10 70 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,] -19 -170.6 -42.13333 -150.06667 143.6667 -211.6 264.2 -375.8667 99.86667 [2,] 139 50.6 42.13333 50.06667 196.3333 -148.4 295.8 -144.1333 500.13333 [,10] [,11] [,12] [1,] -386.9333 -1.066667 -72.61987 [2,] -113.0667 41.066667 72.61987 $out [1] 0 40 310 -340 130 350 170 100 $group [1] 5 5 5 6 7 7 7 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-100, 0, 60, 150, 260, -240, -210, -60, 0, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6dgr41342173030.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,] 1070 1080 1090 930 1050 990 960 980 910 NA [2,] 1120 1120 1105 1085 1080 1070 1085 1105 1080 NA [3,] 1165 1155 1125 1120 1145 1160 1160 1185 1175 NA [4,] 1190 1195 1220 1195 1225 1230 1270 1310 1315 NA [5,] 1240 1260 1260 1270 1350 1470 1490 1530 1500 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1133.073 1120.792 1072.548 1069.828 1078.865 1087.023 1075.62 1091.498 [2,] 1196.927 1189.208 1177.452 1170.172 1211.135 1232.977 1244.38 1278.502 [,9] [,10] [1,] 1067.815 NA [2,] 1282.185 NA $out [1] 980 910 $group [1] 2 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(1070, 1120, 1165, 1190, 1240, 1080, 1120, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/76zap1342173030.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,] 1018.889 990 1025.0 [2,] 1095.556 1095 1095.0 [3,] 1156.667 1160 1155.0 [4,] 1227.778 1220 1227.5 [5,] 1354.444 1350 1365.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1096.359 1102.987 1094.566 [2,] 1216.974 1217.013 1215.434 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1018.88888888889, 1095.55555555556, 1156.66666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/12zy31342173030.ps tmp/12zy31342173030.png",intern=TRUE)) character(0) > try(system("convert tmp/299xd1342173030.ps tmp/299xd1342173030.png",intern=TRUE)) character(0) > try(system("convert tmp/3uhx81342173030.ps tmp/3uhx81342173030.png",intern=TRUE)) character(0) > try(system("convert tmp/4r5531342173030.ps tmp/4r5531342173030.png",intern=TRUE)) character(0) > try(system("convert tmp/510pt1342173030.ps tmp/510pt1342173030.png",intern=TRUE)) character(0) > try(system("convert tmp/6dgr41342173030.ps tmp/6dgr41342173030.png",intern=TRUE)) character(0) > try(system("convert tmp/76zap1342173030.ps tmp/76zap1342173030.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.001 0.474 2.477