# Distribution of number of Bernoulli trials to a given number of successes

Suppose you have a series of n trials, where the probability of success in each trial is p. The distribution of the number of successful trials follows a Binomial distribution with parameters (n, p). The mean is given by np whereas the variance is np(1-p). So far so good: this is pretty mundane Stats 101 stuff.

But suppose now that I only knew about the successful trials, and had no knowledge of the total number n of trials, which is the variable I am interested in estimating. For example, I knew I had 100 successful trials, where each trial had a 0.1 chance of success. Is there a known probability distribution that describes the probable outcomes for n, the total number of trials? Estimating the mean is easy: if m is the number of successes, then it's just m/p. But what about variance and other measures?

What if each success had a different (but known) chance of success? Suppose I had the following records:

• success1 (with p=0.1)
• success2 (with p=0.1)
• success3 (with p=0.2)

Again, a good estimation of the total number of trials can be obtained by simply summing 1/p for each successful trial. In this case that number is 10+10+5=25. But what about variance and other measures?

-

Look at the Negative binomial distribution. The usual way of stating the negative binomial is the number of failures before you see x successes, but if you add the number of failures and the number of success then you get the total n which you are asking about.

The negative binomial does assume that the last observed value (when you stopped) is a success, this may match with what you want. But if you only know the number of success and not if there were any more failures after the last success then you will need to expand this.

If the negative binomial does not answer the question then you may want to try a Baysian approach, choose a prior for n, hold the others constant (or give them priors as well) and apply Bayes theorem.

-

I don't have enough reputation to comment, so I will ask my question through here (sorry if that's poor practice or whatever). I just want to clarify the question a bit.

Suppose that $X|N \sim bin(N,\, p),$ and the $N$ is some unknown (descrete) distribution. Find the distribution of $N$.

It sounds like that is what you're asking, correct? If so, I'm not certain there is a specific distribution for $N,$ simply because we can rephrase the above question by making $N$ two different descrete distributions (for example Poisson and Binomial). I could be overlooking something or making a mistake in my logic, however, which is why I wanted to comment and not post a proposed solution :-/ .

Edit

You can still find useful information about $N$, however, such as its MLE and the like.

-
You should be looking for a likelihood of $N$ not a probability. That's why there is no PDF. One should be able to easily calculate $L(N|m,p) = P(m|N,p)$. – Mimshot Dec 6 '12 at 17:19
@Mimshot On the contrary, the question specifically asks for a probability. I think R S is correct here (+1): unless we know (or assume) much more about the process that produced the observations, we cannot deduce much about $N$. For instance, we might have conducted a sequence of independent trials until observing $100$ successes. Or, we might have flipped a coin beforehand to determine whether $N=1000$ or $N=1001$ and conducted exactly $N$ trials. Both possibilities are quite consistent with observing $100$ successes, but lead to very different distributions of $N$. – whuber Dec 26 '12 at 17:45