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.


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


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:

Inequality Calculator software
Blog posts on random inequalities

Tagged with:
Posted in Statistics
4 comments on “A support one-liner
  1. Arsenalist says:

    This just blew my mind. Where on earth do you work?

  2. John says:

    I work at M. D. Anderson Cancer Center.

  3. Tim H. says:

    Mathematica 8′s native support for computing probabilities is amazing.

  4. bioguy says:

    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”…