Skip to main content
added 28 characters in body
Source Link
StatsStudent
  • 11.5k
  • 4
  • 44
  • 75

In my problem, p$p$, X$X$, and N$N$ are fixed and I want to know the probability. Currently, I am calculating this recursively, as for any given p$p$,X $X$,N $N$, the probability is:

function Prob(p,X,N) {
  return p*Prob(p,X-1,N-1) + (1-p)*Prob(p,X,N-1)
}

The intuition behind this is that if we were successful (first term) we have X-1$X-1$ more successes to find and N-1$N-1$ more trials. If we weren't successful (1-p)$(1-p)$, we have X$X$ more successes to find and N-1$N-1$ more trials. There are also base cases that I left out where X=0$X=0$ (probability is 1 because we've gotten all the successes) and N$N$ less than X$X$ (probability is zero because we have no more trials)
The recursion is really killing the speed of computation, so I'm looking for a closed form or approximation or just a point in the right direction.
Thanks

In my problem, p, X, and N are fixed and I want to know the probability. Currently, I am calculating this recursively, as for any given p,X,N, the probability is:

function Prob(p,X,N) {
  return p*Prob(p,X-1,N-1) + (1-p)*Prob(p,X,N-1)
}

The intuition behind this is that if we were successful (first term) we have X-1 more successes to find and N-1 more trials. If we weren't successful (1-p), we have X more successes to find and N-1 more trials. There are also base cases that I left out where X=0 (probability is 1 because we've gotten all the successes) and N less than X (probability is zero because we have no more trials)
The recursion is really killing the speed of computation, so I'm looking for a closed form or approximation or just a point in the right direction.
Thanks

In my problem, $p$, $X$, and $N$ are fixed and I want to know the probability. Currently, I am calculating this recursively, as for any given $p$, $X$, $N$, the probability is:

function Prob(p,X,N) {
  return p*Prob(p,X-1,N-1) + (1-p)*Prob(p,X,N-1)
}

The intuition behind this is that if we were successful (first term) we have $X-1$ more successes to find and $N-1$ more trials. If we weren't successful $(1-p)$, we have $X$ more successes to find and $N-1$ more trials. There are also base cases that I left out where $X=0$ (probability is 1 because we've gotten all the successes) and $N$ less than $X$ (probability is zero because we have no more trials)
The recursion is really killing the speed of computation, so I'm looking for a closed form or approximation or just a point in the right direction.
Thanks

edited title
Link

If I make N trials, each independent with p chance of success, what is the probability that X or more of them will be successful?

Source Link

If I make N trials, each independent with p chance of success, what is the probability that X of them will be successful?

In my problem, p, X, and N are fixed and I want to know the probability. Currently, I am calculating this recursively, as for any given p,X,N, the probability is:

function Prob(p,X,N) {
  return p*Prob(p,X-1,N-1) + (1-p)*Prob(p,X,N-1)
}

The intuition behind this is that if we were successful (first term) we have X-1 more successes to find and N-1 more trials. If we weren't successful (1-p), we have X more successes to find and N-1 more trials. There are also base cases that I left out where X=0 (probability is 1 because we've gotten all the successes) and N less than X (probability is zero because we have no more trials)
The recursion is really killing the speed of computation, so I'm looking for a closed form or approximation or just a point in the right direction.
Thanks