Calculating cumulative hypergeometric distribution <p>Suppose I have 100 marbles, and 8 of them are red. I draw 30 marbles, and I want to know what's the probability that at least five of the marbles are red. I am currently using <a href="http://stattrek.com/online-calculator/hypergeometric.aspx" rel="nofollow">http://stattrek.com/online-calculator/hypergeometric.aspx</a> and I entered 100, 8, 30, and 5 for population size, number of success, sample size, and number of success in sample, respectively. So the probability I'm interested in is Cumulative Probability: $P(X \geq 5)$ which = 0.050 in this case. My question is, how do I calculate this in R?</p> <p>I tried</p> <pre><code>&gt; 1-phyper(5, 8, 92, 30, lower.tail = TRUE) [1] 0.008503108 </code></pre> <p>But this is very different from the previous answer.</p>