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 = '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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1060 1300 1430 1260 1340 1630 NA [2,] 1050 1280 1260 1095 1265 1225 NA [3,] 1025 1390 1495 1160 1155 1200 NA [4,] 1085 1340 1125 1095 930 1265 NA [5,] 1160 1110 895 1300 880 1140 NA [6,] 1310 1325 1085 1215 925 1270 NA [7,] 1445 1265 870 1245 980 1445 NA [8,] 1445 1150 1185 1350 1015 1305 NA [9,] 1615 1430 1455 1300 1040 1665 NA [10,] 1650 1655 1540 1280 1365 1830 NA [11,] 1255 1570 1615 1270 1160 1690 NA [12,] 1175 1345 1200 1065 1115 1520 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -10 -20 -170 -165 -75 -405 NA [2,] -25 110 235 65 -110 -25 NA [3,] 60 -50 -370 -65 -225 65 NA [4,] 75 -230 -230 205 -50 -125 NA [5,] 150 215 190 -85 45 130 NA [6,] 135 -60 -215 30 55 175 NA [7,] 0 -115 315 105 35 -140 NA [8,] 170 280 270 -50 25 360 NA [9,] 35 225 85 -20 325 165 NA [10,] -395 -85 75 -10 -205 -140 NA [11,] -80 -225 -415 -205 -45 -170 NA [12,] 125 85 60 275 515 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/1tk7n1413630034.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/2gy9k1413630034.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/3hg8e1413630034.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/49b1p1413630034.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,] 1060 1050.0 1025 930 880 925.0 870 1015 1040.0 1280 1160 1065.0 [2,] 1260 1095.0 1155 1085 895 1085.0 980 1150 1300.0 1365 1255 1115.0 [3,] 1320 1242.5 1180 1110 1125 1242.5 1255 1245 1442.5 1595 1420 1187.5 [4,] 1430 1265.0 1390 1265 1160 1310.0 1445 1350 1615.0 1655 1615 1345.0 [5,] 1630 1280.0 1495 1340 1300 1325.0 1445 1445 1665.0 1830 1690 1520.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1210.345 1132.845 1028.417 993.8942 954.0664 1097.368 955.06 1115.994 [2,] 1429.655 1352.155 1331.583 1226.1058 1295.9336 1387.632 1554.94 1374.006 [,9] [,10] [,11] [,12] [1,] 1239.315 1407.941 1187.788 1039.143 [2,] 1645.685 1782.059 1652.212 1335.857 $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(1060, 1260, 1320, 1430, 1630, 1050, 1095, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5jtjq1413630034.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 -110 -370.0 -230.0 -85 -215.0 -140.0 -50 -20 -395.0 -415.0 60 [2,] -170 -25 -225.0 -230.0 45 -60.0 -115.0 25 35 -205.0 -225.0 85 [3,] -120 20 -57.5 -87.5 140 42.5 17.5 220 125 -112.5 -187.5 125 [4,] -20 110 60.0 75.0 190 135.0 105.0 280 225 -10.0 -80.0 275 [5,] -10 235 65.0 205.0 215 175.0 315.0 360 325 75.0 -45.0 515 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -216.75484 -67.07936 -241.3342 -284.2349 46.47032 -83.2813 -124.4071 [2,] -23.24516 107.07936 126.3342 109.2349 233.52968 168.2813 159.4071 [,8] [,9] [,10] [,11] [,12] [1,] 55.51676 2.443863 -238.2813 -281.02968 -9.253521 [2,] 384.48324 247.556137 13.2813 -93.97032 259.253521 $out [1] -405 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-170, -170, -120, -20, -10, -110, -25, 20, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6j4bo1413630034.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] [1,] 1025.0 1110.0 870 1065.0 880.0 1140.0 NA [2,] 1072.5 1272.5 1105 1127.5 955.0 1245.0 NA [3,] 1215.0 1332.5 1230 1252.5 1077.5 1375.0 NA [4,] 1445.0 1410.0 1475 1290.0 1212.5 1647.5 NA [5,] 1650.0 1570.0 1615 1350.0 1365.0 1830.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1045.1 1269.785 1061.241 1178.383 960.0525 1191.417 NA [2,] 1384.9 1395.215 1398.759 1326.617 1194.9475 1558.583 NA $out [1] 1655 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1025, 1072.5, 1215, 1445, 1650, 1110, 1272.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/75wua1413630034.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,] 1080.833 1110.00 1051.875 [2,] 1192.083 1183.75 1202.188 [3,] 1237.083 1243.75 1235.938 [4,] 1377.083 1370.00 1385.000 [5,] 1553.333 1595.00 1531.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1152.704 1158.8 1152.555 [2,] 1321.463 1328.7 1319.320 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1080.83333333333, 1192.08333333333, 1237.08333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1tk7n1413630034.ps tmp/1tk7n1413630034.png",intern=TRUE)) character(0) > try(system("convert tmp/2gy9k1413630034.ps tmp/2gy9k1413630034.png",intern=TRUE)) character(0) > try(system("convert tmp/3hg8e1413630034.ps tmp/3hg8e1413630034.png",intern=TRUE)) character(0) > try(system("convert tmp/49b1p1413630034.ps tmp/49b1p1413630034.png",intern=TRUE)) character(0) > try(system("convert tmp/5jtjq1413630034.ps tmp/5jtjq1413630034.png",intern=TRUE)) character(0) > try(system("convert tmp/6j4bo1413630034.ps tmp/6j4bo1413630034.png",intern=TRUE)) character(0) > try(system("convert tmp/75wua1413630034.ps tmp/75wua1413630034.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.402 0.376 2.807