Say I have a bag of colored marbles. This bag contains 30 marbles, 2 of which are red, 3 are green and the rest are blue. I am now randomly drawing 5 marbles out of this bag, without replacement. I want to calculate the probability that I will draw at least 1 red and at least 1 green marble.
If I just wanted to calculate the probability for a single class (say 1 or more red marble), I could use the upper tail of the hypergeometric cumulative distribution function, in other words calculate 1 - the chance of not drawing a single red marble. E.g. in R
, I would run 1 - phyper(0, 2, 30 - 2, 5)
.
However, I assume the probability to draw one of both isn't simply (1 - phyper(0, 2, 30 - 2, 5)) * (1 - phyper(0, 3, 30 - 3, 5))
because they are not independent.
I believe I may need to use the multivariate hypergeometric distribution for this, but this can only give me the probability that I will draw NEITHER a red NOR a green marble. When I now calculate 1 - p
, I will get the probability to draw either at least one red marble, or at least one green marble, or both.
What is the correct way to now calculate the probability of getting both?