[R] number of required trials

Boks, M.P.M. M.P.M.Boks at umcutrecht.nl
Sun Oct 19 22:51:43 CEST 2008


Dear Experts,

Probably trivial, but I am struggling to get what I want:

I need to know how the number of required trials to get a certain number of successes.

By example:

How many trials do I need to have 98% probability of 50 successes, when the a priory probability is 0.1 per trial.

The Negative binomial function may do the job (not sure):

NegBinomial {stats}
The Negative Binomial Distribution
Description
Density, distribution function, quantile function and random generation for the negative binomial distribution with parameters size and prob. 
Usage
dnbinom(x, size, prob, mu, log = FALSE)
pnbinom(q, size, prob, mu, lower.tail = TRUE, log.p = FALSE)
qnbinom(p, size, prob, mu, lower.tail = TRUE, log.p = FALSE)
rnbinom(n, size, prob, mu)

I tried finding out how to do this by using examples, but I am at a loss. Any help would be much appreciated!

Marco



More information about the R-help mailing list