A support one-liner

This morning I had a fun support request related to our software. The exchange took place over email but it could have fit into a couple Twitter messages. Would that all requests could be answered so succinctly.

Question:

Do you have R code to compute P(X > Y) where X ~ gamma(ax, bx) and Y ~ gamma(ay, by)?

Response:

ineq <- function(ax, bx, ay, by) pbeta(bx/(bx+by), ay, ax)

For more on the problem and the solution, see Exact calculation of inequality probabilities.

Related links:

4 thoughts on “A support one-liner

  1. sorry for being late to the party, only found your blog recently, and i’ve been enjoying it much. if it’s succinctness you’re after, you could have just answered “yes”…
    cheers,
    p

Comments are closed.