Binomial probability of exactly r patients with an event

Gives the probability that exactly r of n patients at risk have the event within the period. C(n, r) is the binomial coefficient, n! divided by r! (n minus r)!, the number of ways of choosing which r of the n patients have the event; Excel returns it with COMBIN. A single patient, the case n = 1, is a Bernoulli trial.

Signature

P_r = C(n, r) * p^r * (1 - p)^(n - r)
Inputs
InputsDefinitionUnit
nNumber of patients at risk, each followed for the whole periodpatients
rNumber of patients who have the event, a whole number from 0 up to npatients
pProbability that any one patient has the event within the period, the same for every patientprobability
Output
P_rProbability that exactly r of the n patients have the event within the periodprobability

Function

Binomial distribution of an event count among patients at risk

Gives the probability that exactly r of n patients have an event within a fixed period when each patient has the same probability p of the event and outcomes are independent. Read as a function of p for an observed count, the same expression is the binomial likelihood, proportional to p^r (1 minus p)^(n minus r), which peaks at the observed proportion r/n. The formulae below give the probability function, the chance of a zero count, the mean and variance of the count, the estimated probability with its standard error, the Wald and Wilson intervals and the logit model for binomial data in NICE DSU evidence synthesis. The conjugate beta update of a binomial probability is set out on the Beta Distribution page (HE-FM-BETA-002), and the general Wald interval for any estimate on the Asymptotic Normality page (HE-FM-AN-001).

Computational function

  • Computational function: exact binomial probability, cumulative probability and percentiles of an event count

    Takes the inputs a model or a study summary usually holds, the number of patients, the event probability, a count and two percentile levels, and returns the exact probability of the count, the cumulative probability of at most that count and two percentiles of the count. The cumulative probability sums the probability function HE-FM-BINOM-001 over every count up to r, and each percentile is found by searching for the smallest count whose cumulative probability reaches the level, because the binomial percent point function has no closed form. The inputs therefore differ from the formula's variables: the levels a_lo and a_hi are extra, and the outputs include percentiles that the formula cannot give.

    Inputs and outputs: n: Number of patients, a whole number above zero; required. Unit: patients.; p: Event probability per patient over the period; required, above zero and below one for the percentiles. Unit: probability.; r: Count of interest, a whole number from 0 up to n; required for P_r and F_r. Unit: patients.; a_lo, a_hi: Cumulative probability levels for the percentiles; optional, default 0.025 and 0.975. Unit: probability.; P_r: Probability of exactly r events. Unit: probability.; F_r: Probability of at most r events. Unit: probability.; q_lo, q_hi: Smallest counts whose cumulative probability reaches a_lo and a_hi. Unit: patients.

    Assumption: The binomial conditions hold: a fixed number of patients followed for the whole period, the same probability for each and independent outcomes. The percentiles describe chance variation in the count at a fixed p, not uncertainty about p, which is described by a beta distribution.

    Worked example (Six adverse events among 40 patients): At a probability of 0.15, exactly 6 events has a probability of about 0.1742 and at most 6 events about 0.6067. n = 40; p = 0.15; r = 6; P_r = 0.1742; F_r = 0.6067

    Worked example (Percentiles of a simulated count for 1,000 patients): With the probability held at 0.15, the 2.5% and 97.5% points of the count are 128 and 172 events around a mean of 150, the article's step 5. The probability of exactly 150 events, about 0.0353, and of at most 150, about 0.5218, are computed here for illustration and are not figures from the article. n = 1000; p = 0.15; r = 150; a_lo = 0.025; a_hi = 0.975; P_r = 0.0353; F_r = 0.5218; q_lo = 128; q_hi = 172

    Worked example (Zero count at a probability of 0.02): For 40 patients the probability of no events is about 0.4457, and the cumulative probability at zero equals it. n = 40; p = 0.02; r = 0; P_r = 0.4457; F_r = 0.4457

    Excel: =BINOM.DIST(Events,Patients,Prob,FALSE) returns P_r and =BINOM.DIST(Events,Patients,Prob,TRUE) returns F_r. =BINOM.INV(Patients,Prob,0.025) and =BINOM.INV(Patients,Prob,0.975) return the percentiles, each the smallest count whose cumulative probability is at least the level.

    R: binom_summary <- function(n, p, r, a_lo = 0.025, a_hi = 0.975) c(P_r = dbinom(r, n, p), F_r = pbinom(r, n, p), q_lo = qbinom(a_lo, n, p), q_hi = qbinom(a_hi, n, p)) Base R; qbinom uses the same smallest-count definition as BINOM.INV.

    Python: def binom_summary(n, p, r, a_lo=0.025, a_hi=0.975): return dict(P_r=stats.binom.pmf(r, n, p), F_r=stats.binom.cdf(r, n, p), q_lo=stats.binom.ppf(a_lo, n, p), q_hi=stats.binom.ppf(a_hi, n, p)) Needs from scipy import stats; stats.binom.ppf returns the smallest count whose cumulative probability is at least the level.

    Test (Lower percentile is the first count to reach its level): The cumulative probability at q_lo reaches 0.025 and the cumulative probability one count below does not. Expected result: TRUE. Excel check: =AND(BINOM.DIST(BINOM.INV(Patients,Prob,0.025),Patients,Prob,TRUE)>=0.025,BINOM.DIST(BINOM.INV(Patients,Prob,0.025)-1,Patients,Prob,TRUE)<0.025)

    Test (Exact probability is the step in the cumulative probability): For a count of 1 or more, P_r equals F_r minus the cumulative probability at r minus 1. Expected result: TRUE. Excel check: =ABS(BINOM.DIST(Events,Patients,Prob,FALSE)-(BINOM.DIST(Events,Patients,Prob,TRUE)-BINOM.DIST(Events-1,Patients,Prob,TRUE)))<1E-12

    Common error (Percentiles of a simulated count read as uncertainty about p): The range of 128 to 172 events per 1,000 patients is stochastic noise at a fixed probability of 0.15 and shrinks, relative to the mean, as more patients are simulated. Uncertainty in the probability from the 40-patient study is far wider, about 72 to 292 events per 1,000 from Beta(7, 35).

    Source: NIST/SEMATECH. e-Handbook of Statistical Methods. Section 1.3.6.6.18, Binomial Distribution. National Institute of Standards and Technology; accessed 2 October 2026. Probability mass and cumulative distribution functions, and the note that the percent point function has no closed form and is computed numerically. Microsoft. BINOM.INV function. Microsoft Support; accessed 2 October 2026, which returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.

    P_r = C(n, r) * p^r * (1 - p)^(n - r); F_r = sum_(j=0)^r [C(n, j) * p^j * (1 - p)^(n - j)]; q_lo = min(x : F_x >= a_lo); q_hi = min(x : F_x >= a_hi)

Implementations

  • Excel

    Binomial probability of an exact count in one cell

    With named cells Events, Patients and Prob, BINOM.DIST with FALSE as its last argument returns the probability of exactly that count. The second formula writes out the same calculation with COMBIN.

    =BINOM.DIST(Events,Patients,Prob,FALSE); =COMBIN(Patients,Events)*Prob^Events*(1-Prob)^(Patients-Events)

Assumptions

  • Fixed number of patients followed for the whole binomial period

    Every one of the n patients is followed for the whole period, so the denominator is fixed. With incomplete follow-up or censoring, a simple count out of n is biased and survival analysis is the usual route.

  • Same event probability and independent outcomes for a binomial count

    Every patient has the same probability p and outcomes are independent between patients. Patients clustered within centres tend to resemble each other, which inflates the variance of the count beyond n p (1 minus p).

  • One event per patient in a binomial count

    Each patient either has the event or does not. Repeated events such as admissions are counts over person-time, which suit the Poisson distribution or, when overdispersed, the negative binomial.

Worked examples

  • Six serious adverse events among 40 patients at a probability of 0.15

    In the article's illustrative study, the chance of exactly 6 events among 40 patients when the true probability is 0.15 is about 0.174. The binomial coefficient C(40, 6) is 3,838,380, and Excel BINOM.DIST(6, 40, 0.15, FALSE) returns the same probability.

    n = 40; r = 6; p = 0.15; P_r = 0.1742
  • Single patient as a Bernoulli trial in the binomial function

    With one patient the binomial reduces to a Bernoulli trial: the probability that the patient has the event is p itself, 0.15 here.

    n = 1; r = 1; p = 0.15; P_r = 0.15

Common errors

  • Cumulative instead of exact binomial probability in BINOM.DIST

    Setting the last argument of BINOM.DIST to TRUE returns the probability of at most r events. For 6 events among 40 patients at a probability of 0.15 that is about 0.607, not the 0.174 for exactly 6.

Sources

  • NIST handbook entry for the binomial probability mass function

    NIST/SEMATECH. e-Handbook of Statistical Methods. Section 1.3.6.6.18, Binomial Distribution. National Institute of Standards and Technology; accessed 2 October 2026. Gives the probability mass function with the binomial coefficient n! divided by x! (n minus x)!, for x successes in n trials with p fixed for all trials.

    View source →

  • Binomial distribution in the Bayesian Data Analysis appendix

    Gelman A, Carlin JB, Stern HS, Dunson DB, Vehtari A, Rubin DB. Bayesian Data Analysis. 3rd edition. Boca Raton: Chapman & Hall/CRC; 2013. Appendix A, Table A.2 and the Binomial entry, which give the probability function with mean np and variance np(1 minus p) for the number of successes in n independent Bernoulli trials with a common probability.

    View source →

  • Excel BINOM.DIST for exact and cumulative binomial probabilities

    Microsoft. BINOM.DIST function. Microsoft Support; accessed 2 October 2026. Returns the probability of exactly the given number of successes when the cumulative argument is FALSE and of at most that number when it is TRUE, for a fixed number of independent trials with a constant probability.

    View source →

Canonical Identity

Stable URI · Machine-readable · Resolvable · CC BY 4.0