Created
September 1, 2013 06:33
-
-
Save woodrow/6402706 to your computer and use it in GitHub Desktop.
merged CDF in R Looks like: http://cl.ly/image/3h0V1p3D2q1u/mb_latencies.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match_latencies = c( | |
7.47978949546814, 6.318617582321167, 6.1188719272613525, 7.745437145233154, | |
..., | |
2.361427068710327, 3.1125471591949463) | |
nomatch_latencies = c( | |
1.8395578861236572, 1.9002978801727295, 2.7614076137542725, 4.611708402633667, | |
..., | |
2.752995729446411, 5.312501907348633) | |
timeout_latencies = c( | |
8.370409965515137, 7.526724576950073, 7.343521356582642, 7.33183479309082, | |
..., | |
7.394188404083252, 8.591819047927856, 7.346822023391724, 7.67337441444397) | |
all_latencies = c(match_latencies, nomatch_latencies, timeout_latencies) | |
match_ecdf = ecdf(all_latencies) | |
nomatch_ecdf = ecdf(all_latencies) | |
timeout_ecdf = ecdf(all_latencies) | |
evalq({y = y * (x %in% match_latencies)}, environment(match_ecdf)) | |
evalq({match_y <<- y}, environment(match_ecdf)) | |
evalq({match_x <<- x}, environment(match_ecdf)) | |
evalq({y = y * (x %in% nomatch_latencies)}, environment(nomatch_ecdf)) | |
evalq({nomatch_y <<- y}, environment(nomatch_ecdf)) | |
evalq({nomatch_x <<- x}, environment(nomatch_ecdf)) | |
evalq({y = y * (x %in% timeout_latencies)}, environment(timeout_ecdf)) | |
evalq({timeout_y <<- y}, environment(timeout_ecdf)) | |
evalq({timeout_x <<- x}, environment(timeout_ecdf)) | |
evalq({y = y - (1 * (y == 0))}, environment(match_ecdf)) | |
evalq({y = y - (1 * (y == 0))}, environment(nomatch_ecdf)) | |
evalq({y = y - (1 * (y == 0))}, environment(timeout_ecdf)) | |
lims=c(min(all_latencies), max(all_latencies)) | |
lims=c(0,10) | |
png(file='mb_latencies.png', width=800, height=800, units='px', bg='white',) | |
lwd=0 | |
cex=0.5 | |
pch=3 | |
par(mfcol=c(2,1)) | |
par(mar=c(3,4,1,1)) | |
plot(match_ecdf, xlim=lims, ylim=c(0,1), col='black', | |
do.points=T, lwd=lwd, cex.points=cex, pch=pch, | |
main='CDF of all response latencies') | |
par(new=T) | |
plot(nomatch_ecdf, xlim=lims, ylim=c(0,1), col='green', | |
do.points=T, lwd=lwd, cex.points=cex, pch=pch, | |
xaxt='n', yaxt='n', main='', xlab='', ylab='') | |
par(new=T) | |
plot(timeout_ecdf, xlim=lims, ylim=c(0,1), col='red', | |
do.points=T, lwd=lwd, cex.points=cex, pch=pch, | |
xaxt='n', yaxt='n', main='', xlab='', ylab='') | |
par(new=T) | |
abline(v=7) | |
par(new=F) | |
legend('bottomright', c('no match', 'match', 'timeout'), | |
col=c('green', 'black', 'red'), pch=c(3,3,3), inset=0.02) | |
par(mar=c(3,4,1,1)) | |
plot(ecdf(match_latencies), xlim=lims, col='black', | |
do.points=T, lwd=lwd, cex.points=cex, pch=pch, | |
main='CDF of response latencies for each outcome') | |
par(new=T) | |
plot(ecdf(nomatch_latencies), xlim=lims, col='green', | |
do.points=T, lwd=lwd, cex.points=cex, pch=pch, | |
xaxt='n', yaxt='n', main='', xlab='', ylab='') | |
par(new=T) | |
plot(ecdf(timeout_latencies), xlim=lims, col='red', | |
do.points=T, lwd=lwd, cex.points=cex, pch=pch, | |
xaxt='n', yaxt='n', main='', xlab='', ylab='') | |
par(new=T) | |
abline(v=7) | |
par(new=F) | |
legend('bottomright', c('no match', 'match', 'timeout'), | |
col=c('green', 'black', 'red'), pch=c(3,3,3), inset=0.02) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment