R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(1060,1050,1025,1085,1160,1310,1445,1445,1615,1650,1255,1175,1300,1280,1390,1340,1110,1325,1265,1150,1430,1655,1570,1345,1430,1260,1495,1125,895,1085,870,1185,1455,1540,1615,1200,1260,1095,1160,1095,1300,1215,1245,1350,1300,1280,1270,1065,1340,1265,1155,930,880,925,980,1015,1040,1365,1160,1115,1630,1225,1200,1265,1140,1270,1445,1305,1665,1830,1690,1520) > par1 = '52' > par1 <- '52' > #'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] 72 > (np <- floor(n / par1)) [1] 1 > 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] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > arr [,1] [,2] [1,] 1060 880 [2,] 1050 925 [3,] 1025 980 [4,] 1085 1015 [5,] 1160 1040 [6,] 1310 1365 [7,] 1445 1160 [8,] 1445 1115 [9,] 1615 1630 [10,] 1650 1225 [11,] 1255 1200 [12,] 1175 1265 [13,] 1300 1140 [14,] 1280 1270 [15,] 1390 1445 [16,] 1340 1305 [17,] 1110 1665 [18,] 1325 1830 [19,] 1265 1690 [20,] 1150 1520 [21,] 1430 NA [22,] 1655 NA [23,] 1570 NA [24,] 1345 NA [25,] 1430 NA [26,] 1260 NA [27,] 1495 NA [28,] 1125 NA [29,] 895 NA [30,] 1085 NA [31,] 870 NA [32,] 1185 NA [33,] 1455 NA [34,] 1540 NA [35,] 1615 NA [36,] 1200 NA [37,] 1260 NA [38,] 1095 NA [39,] 1160 NA [40,] 1095 NA [41,] 1300 NA [42,] 1215 NA [43,] 1245 NA [44,] 1350 NA [45,] 1300 NA [46,] 1280 NA [47,] 1270 NA [48,] 1065 NA [49,] 1340 NA [50,] 1265 NA [51,] 1155 NA [52,] 930 NA > darr [,1] [,2] [1,] -10 45 [2,] -25 55 [3,] 60 35 [4,] 75 25 [5,] 150 325 [6,] 135 -205 [7,] 0 -45 [8,] 170 515 [9,] 35 -405 [10,] -395 -25 [11,] -80 65 [12,] 125 -125 [13,] -20 130 [14,] 110 175 [15,] -50 -140 [16,] -230 360 [17,] 215 165 [18,] -60 -140 [19,] -115 -170 [20,] 280 NA [21,] 225 NA [22,] -85 NA [23,] -225 NA [24,] 85 NA [25,] -170 NA [26,] 235 NA [27,] -370 NA [28,] -230 NA [29,] 190 NA [30,] -215 NA [31,] 315 NA [32,] 270 NA [33,] 85 NA [34,] 75 NA [35,] -415 NA [36,] 60 NA [37,] -165 NA [38,] 65 NA [39,] -65 NA [40,] 205 NA [41,] -85 NA [42,] 30 NA [43,] 105 NA [44,] -50 NA [45,] -20 NA [46,] -10 NA [47,] -205 NA [48,] 275 NA [49,] -75 NA [50,] -110 NA [51,] -225 NA [52,] -50 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/1yyd11413113259.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/2krv71413113259.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/3um2h1413113259.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/462021413113259.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,] 880 925.0 980.0 1015 1040 1310.0 1160.0 1115 1615.0 1225.0 1200.0 1175 [2,] 880 925.0 980.0 1015 1040 1310.0 1160.0 1115 1615.0 1225.0 1200.0 1175 [3,] 970 987.5 1002.5 1050 1100 1337.5 1302.5 1280 1622.5 1437.5 1227.5 1220 [4,] 1060 1050.0 1025.0 1085 1160 1365.0 1445.0 1445 1630.0 1650.0 1255.0 1265 [5,] 1060 1050.0 1025.0 1085 1160 1365.0 1445.0 1445 1630.0 1650.0 1255.0 1265 [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [1,] 1140 1270 1390.0 1305.0 1110.0 1325.0 1265.0 1150 1430 1655 1570 [2,] 1140 1270 1390.0 1305.0 1110.0 1325.0 1265.0 1150 1430 1655 1570 [3,] 1220 1275 1417.5 1322.5 1387.5 1577.5 1477.5 1335 1430 1655 1570 [4,] 1300 1280 1445.0 1340.0 1665.0 1830.0 1690.0 1520 1430 1655 1570 [5,] 1300 1280 1445.0 1340.0 1665.0 1830.0 1690.0 1520 1430 1655 1570 [,24] [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [1,] 1345 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 [2,] 1345 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 [3,] 1345 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 [4,] 1345 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 [5,] 1345 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 [,36] [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [1,] 1200 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 [2,] 1200 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 [3,] 1200 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 [4,] 1200 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 [5,] 1200 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 [,48] [,49] [,50] [,51] [,52] [1,] 1065 1340 1265 1155 930 [2,] 1065 1340 1265 1155 930 [3,] 1065 1340 1265 1155 930 [4,] 1065 1340 1265 1155 930 [5,] 1065 1340 1265 1155 930 $n [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 768.8988 847.8464 952.2247 971.794 965.9326 1276.052 984.0898 [2,] 1171.1012 1127.1536 1052.7753 1128.206 1234.0674 1398.948 1620.9102 [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [1,] 911.3145 1605.742 962.6778 1166.052 1119.449 1041.243 1263.828 1356.052 [2,] 1648.6855 1639.258 1912.3222 1288.948 1320.551 1398.757 1286.172 1478.948 [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [1,] 1283.397 767.4381 1013.299 1002.678 921.6254 1430 1655 1570 1345 [2,] 1361.603 2007.5619 2141.701 1952.322 1748.3746 1430 1655 1570 1345 [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [1,] 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 1200 [2,] 1430 1260 1495 1125 895 1085 870 1185 1455 1540 1615 1200 [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [1,] 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 1065 [2,] 1260 1095 1160 1095 1300 1215 1245 1350 1300 1280 1270 1065 [,49] [,50] [,51] [,52] [1,] 1340 1265 1155 930 [2,] 1340 1265 1155 930 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" [31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" [46] "46" "47" "48" "49" "50" "51" "52" Warning message: In bxp(list(stats = c(880, 880, 970, 1060, 1060, 925, 925, 987.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5a6881413113259.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] [,13] [1,] -10.0 -25 35.0 25 150.0 -205 -45.0 170.0 -405 -395 -80.0 -125 -20 [2,] -10.0 -25 35.0 25 150.0 -205 -45.0 170.0 -405 -395 -80.0 -125 -20 [3,] 17.5 15 47.5 50 237.5 -35 -22.5 342.5 -185 -210 -7.5 0 55 [4,] 45.0 55 60.0 75 325.0 135 0.0 515.0 35 -25 65.0 125 130 [5,] 45.0 55 60.0 75 325.0 135 0.0 515.0 35 -25 65.0 125 130 [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [1,] 110.0 -140 -230 165 -140 -170.0 280 225 -85 -225 85 -170 [2,] 110.0 -140 -230 165 -140 -170.0 280 225 -85 -225 85 -170 [3,] 142.5 -95 65 190 -100 -142.5 280 225 -85 -225 85 -170 [4,] 175.0 -50 360 215 -60 -115.0 280 225 -85 -225 85 -170 [5,] 175.0 -50 360 215 -60 -115.0 280 225 -85 -225 85 -170 [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [1,] 235 -370 -230 190 -215 315 270 85 75 -415 60 -165 [2,] 235 -370 -230 190 -215 315 270 85 75 -415 60 -165 [3,] 235 -370 -230 190 -215 315 270 85 75 -415 60 -165 [4,] 235 -370 -230 190 -215 315 270 85 75 -415 60 -165 [5,] 235 -370 -230 190 -215 315 270 85 75 -415 60 -165 [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [1,] 65 -65 205 -85 30 105 -50 -20 -10 -205 275 -75 [2,] 65 -65 205 -85 30 105 -50 -20 -10 -205 275 -75 [3,] 65 -65 205 -85 30 105 -50 -20 -10 -205 275 -75 [4,] 65 -65 205 -85 30 105 -50 -20 -10 -205 275 -75 [5,] 65 -65 205 -85 30 105 -50 -20 -10 -205 275 -75 [,50] [,51] [,52] [1,] -110 -225 -50 [2,] -110 -225 -50 [3,] -110 -225 -50 [4,] -110 -225 -50 [5,] -110 -225 -50 $n [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -43.94758 -74.3783 19.56928 -5.861436 41.98498 -414.8578 -72.77529 [2,] 78.94758 104.3783 75.43072 105.861436 433.01502 344.8578 27.77529 [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] -42.94391 -676.5806 -623.3746 -169.4982 -279.3072 -112.5843 69.88013 [2,] 727.94391 306.5806 203.3746 154.4982 279.3072 222.5843 215.11987 [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [1,] -195.550584 -594.1649 134.1386 -189.3783 -203.94758 280 225 -85 [2,] 5.550584 724.1649 245.8614 -10.6217 -81.05242 280 225 -85 [,23] [,24] [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [1,] -225 85 -170 235 -370 -230 190 -215 315 270 85 75 [2,] -225 85 -170 235 -370 -230 190 -215 315 270 85 75 [,35] [,36] [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [1,] -415 60 -165 65 -65 205 -85 30 105 -50 -20 -10 [2,] -415 60 -165 65 -65 205 -85 30 105 -50 -20 -10 [,47] [,48] [,49] [,50] [,51] [,52] [1,] -205 275 -75 -110 -225 -50 [2,] -205 275 -75 -110 -225 -50 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" [31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" [46] "46" "47" "48" "49" "50" "51" "52" Warning message: In bxp(list(stats = c(-10, -10, 17.5, 45, 45, -25, -25, 15, 55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/63qdk1413113259.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] [1,] 870.0 880.0 [2,] 1137.5 1077.5 [3,] 1265.0 1245.0 [4,] 1370.0 1482.5 [5,] 1655.0 1830.0 $n [1] 52 20 $conf [,1] [,2] [1,] 1214.058 1101.914 [2,] 1315.942 1388.086 $out numeric(0) $group numeric(0) $names [1] "1" NA > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/780j81413113259.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,] 870.0 870.0 870.0 [2,] 1140.0 1140.0 1140.0 [3,] 1272.5 1272.5 1272.5 [4,] 1402.5 1402.5 1402.5 [5,] 1655.0 1655.0 1655.0 $n [1] 52 52 52 $conf [,1] [,2] [,3] [1,] 1214.985 1214.985 1214.985 [2,] 1330.015 1330.015 1330.015 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1yyd11413113259.ps tmp/1yyd11413113259.png",intern=TRUE)) character(0) > try(system("convert tmp/2krv71413113259.ps tmp/2krv71413113259.png",intern=TRUE)) character(0) > try(system("convert tmp/3um2h1413113259.ps tmp/3um2h1413113259.png",intern=TRUE)) character(0) > try(system("convert tmp/462021413113259.ps tmp/462021413113259.png",intern=TRUE)) character(0) > try(system("convert tmp/5a6881413113259.ps tmp/5a6881413113259.png",intern=TRUE)) character(0) > try(system("convert tmp/63qdk1413113259.ps tmp/63qdk1413113259.png",intern=TRUE)) character(0) > try(system("convert tmp/780j81413113259.ps tmp/780j81413113259.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.472 0.389 2.899