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(1143,1162,1169,1184,1169,1189,1192,1198,1168,1179,1173,1172,1125,1127,1123,1132,1114,1127,1129,1139,1117,1131,1132,1140,1105,1126,1129,1139,1123,1101,1110,1128,1101,1134,1139,1137,1141,1165,1146,1134,1141,1159,1166,1192,1171,1179,1181,1195,1167,1176,1181,1197,1194,1173,1179,1184,1193,1193,1193,1191,1222,1198,1218,1219,1260,1235,1256,1258,1295,1294,1318,1262) > par1 = '4' > par1 <- '4' > #'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] 18 > 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] 18 18 18 18 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1143 1169 1168 1125 1114 1117 1105 1123 1101 1141 1141 1171 1167 1194 [2,] 1162 1189 1179 1127 1127 1131 1126 1101 1134 1165 1159 1179 1176 1173 [3,] 1169 1192 1173 1123 1129 1132 1129 1110 1139 1146 1166 1181 1181 1179 [4,] 1184 1198 1172 1132 1139 1140 1139 1128 1137 1134 1192 1195 1197 1184 [,15] [,16] [,17] [,18] [,19] [1,] 1193 1222 1260 1295 NA [2,] 1193 1198 1235 1294 NA [3,] 1193 1218 1256 1318 NA [4,] 1191 1219 1258 1262 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 19 20 11 2 13 14 21 -22 33 24 18 8 9 -21 [2,] 7 3 -6 -4 2 1 3 9 5 -19 7 2 5 6 [3,] 15 6 -1 9 10 8 10 18 -2 -12 26 14 16 5 [4,] -15 -30 -47 -18 -22 -35 -16 -27 4 7 -21 -28 -3 9 [,15] [,16] [,17] [,18] [,19] [1,] 0 -24 -25 -1 NA [2,] 0 20 21 24 NA [3,] -2 1 2 -56 NA [4,] 31 41 37 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/1obqc1413637868.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/2psgb1413637868.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/3g2aw1413637868.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/45a1r1413637868.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] [1,] 1101 1101 1110 1128 [2,] 1123 1131 1132 1139 [3,] 1155 1169 1171 1184 [4,] 1193 1189 1192 1197 [5,] 1295 1235 1256 1262 $n [1] 18 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] 1128.931 1147.4 1148.655 1162.4 [2,] 1181.069 1190.6 1193.345 1205.6 $out [1] 1294 1318 $group [1] 2 3 $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(1101, 1123, 1155, 1193, 1295, 1101, 1131, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/50ac11413637868.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] [1,] -25 -6 -12 -47 [2,] -1 1 -1 -27 [3,] 10 4 7 -16 [4,] 19 7 14 7 [5,] 33 9 26 41 $n [1] 18 18 18 17 $conf [,1] [,2] [,3] [,4] [1,] 2.551809 1.765543 1.413856 -29.029014 [2,] 17.448191 6.234457 12.586144 -2.970986 $out [1] -19 20 21 24 -56 $group [1] 2 2 2 2 3 $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(-25, -1, 10, 19, 33, -6, 1, 4, 7, 9, -12, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6qjpn1413637868.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,] 1143.0 1169.0 1168.0 1123.0 1114.0 1117.0 1105.0 1101.0 1101.0 1134.0 [2,] 1152.5 1179.0 1170.0 1124.0 1120.5 1124.0 1115.5 1105.5 1117.5 1137.5 [3,] 1165.5 1190.5 1172.5 1126.0 1128.0 1131.5 1127.5 1116.5 1135.5 1143.5 [4,] 1176.5 1195.0 1176.0 1129.5 1134.0 1136.0 1134.0 1125.5 1138.0 1155.5 [5,] 1184.0 1198.0 1179.0 1132.0 1139.0 1140.0 1139.0 1128.0 1139.0 1165.0 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 1141.0 1171 1167.0 1173.0 1191 1198.0 1235.0 1262.0 NA [2,] 1150.0 1175 1171.5 1176.0 1192 1208.0 1245.5 1278.0 NA [3,] 1162.5 1180 1178.5 1181.5 1193 1218.5 1257.0 1294.5 NA [4,] 1179.0 1188 1189.0 1189.0 1193 1220.5 1259.0 1306.5 NA [5,] 1192.0 1195 1197.0 1194.0 1193 1222.0 1260.0 1318.0 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1146.54 1177.86 1167.76 1121.655 1117.335 1122.02 1112.885 1100.7 1119.305 [2,] 1184.46 1203.14 1177.24 1130.345 1138.665 1140.98 1142.115 1132.3 1151.695 [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [1,] 1129.28 1139.59 1169.73 1164.675 1171.23 1192.21 1208.625 1246.335 [2,] 1157.72 1185.41 1190.27 1192.325 1191.77 1193.79 1228.375 1267.665 [,18] [,19] [1,] 1271.985 NA [2,] 1317.015 NA $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" NA Warning message: In bxp(list(stats = c(1143, 1152.5, 1165.5, 1176.5, 1184, 1169, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/78fyn1413637868.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,] 1163.833 1155.0 1155.500 [2,] 1166.583 1162.0 1157.312 [3,] 1171.722 1170.0 1160.312 [4,] 1175.972 1177.5 1164.625 [5,] 1177.833 1184.0 1167.750 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 1164.305 1157.755 1154.536 [2,] 1179.139 1182.245 1166.089 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1163.83333333333, 1166.58333333333, 1171.72222222222, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1obqc1413637868.ps tmp/1obqc1413637868.png",intern=TRUE)) character(0) > try(system("convert tmp/2psgb1413637868.ps tmp/2psgb1413637868.png",intern=TRUE)) character(0) > try(system("convert tmp/3g2aw1413637868.ps tmp/3g2aw1413637868.png",intern=TRUE)) character(0) > try(system("convert tmp/45a1r1413637868.ps tmp/45a1r1413637868.png",intern=TRUE)) character(0) > try(system("convert tmp/50ac11413637868.ps tmp/50ac11413637868.png",intern=TRUE)) character(0) > try(system("convert tmp/6qjpn1413637868.ps tmp/6qjpn1413637868.png",intern=TRUE)) character(0) > try(system("convert tmp/78fyn1413637868.ps tmp/78fyn1413637868.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.415 0.359 2.806