6
$\begingroup$

I'm uncertain whether I should be able to intuit the answer to my question from a question that has already been asked but I can't, so I am asking the question anyway. Thus, I am looking for a clear easy to understand answer. A recent newspaper article reported that on average couples were able to conceive a child after 104 reproductive acts. Assuming indpendant binomial trials, that means for each act there was a 1/104 probability of success. I can do a quick simulation to show myself what the quantiles for this distribution look like, e.g. in R:

NSIM <- 10000
trialsuntilsuccess <- function(N=10000,Pr=1/104)
{
    return(min(seq(1:N)[rbinom(N,1,Pr)==1]))
}
res <- rep(NA,NSIM)
for (i in 1:NSIM)
{
    res[i] <- trialsuntilsuccess()
    if (i %% 10  == 0) {cat(i,"\r"); flush.console()}
}
quantile(res,c(.025,.975))

But it seems like there should be some simple equation or approximation that could be applied, perhaps a probit or poisson? Any advice on how to get the quantiles without running a simulation? Bonus points for providing a way to do the relevant calculations in R.

$\endgroup$

1 Answer 1

3
$\begingroup$

If I understand your question correctly you want to compute the quantiles for the "No of failures before the first success" given that $p=\frac{1}{104}$.

The distribution you should be looking at is the negative binomial distribution. The wiki discusses the negative binomial as:

In probability theory and statistics, the negative binomial distribution is a discrete probability distribution of the number of successes in a sequence of Bernoulli trials before a specified (non-random) number r of failures occurs.

Just invert the interpretation of success and failures with a setting of r=1 would accomplish what you want. The distribution with r=1 is also called the geometric distribution.

You could then use the discrete distribution to compute the quantiles.

PS: I do not know R.

$\endgroup$
1
  • $\begingroup$ Using the information that what I was looking for was the negative binomial distribution I was able to find the correct function in R: qnbinom(c(.025,.975),1,1/104) - Thanks a bunch! $\endgroup$ Aug 16, 2010 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.