Maximum likelihood estimate of a binomial probability and its standard error

The binomial likelihood, proportional to p^r (1 minus p)^(n minus r), peaks at the observed proportion r/n, the maximum likelihood estimate. Its standard error is estimated by putting p_hat in place of p in the sampling variance p (1 minus p)/n, so larger studies give more precise estimates.

Signature

p_hat = r / n; SE_p = sqrt(p_hat * (1 - p_hat) / n)
Inputs
InputsDefinitionUnit
rNumber of patients in the study who had the eventpatients
nNumber of patients in the study, each followed for the whole periodpatients
Output
p_hatObserved proportion of patients with the event, the maximum likelihood estimate of pprobability
SE_pEstimated standard error of p_hatprobability

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).

Try this function

Implementations

  • Excel

    Binomial proportion and its standard error in two cells

    With named cells Events and Patients, the first formula returns the estimate into a cell named PHat and the second its standard error.

    =Events/Patients; =SQRT(PHat*(1-PHat)/Patients)

Assumptions

  • Binomial sampling behind an observed proportion

    The count arises from a fixed number of patients followed for the whole period, with a common probability and independent outcomes. With incomplete follow-up or censoring, r/n is a biased estimate and survival analysis is the usual route.

  • Plug-in standard error unreliable with few binomial events

    The standard error uses p_hat itself, so it is zero when r is 0 or n and imprecise with small counts. With few events the Wilson interval, HE-FM-BINOM-006, or a beta distribution describes uncertainty better.

Worked examples

  • Estimated probability and standard error for 6 events among 40 patients

    The estimate is 6/40 = 0.15 and the standard error about 0.0565, as in the article's steps 1 and 2.

    r = 6; n = 40; p_hat = 0.15; SE_p = 0.0565
  • Zero standard error for no events among 40 patients

    With no events the estimate is 0 and the plug-in standard error is also 0, although the data are consistent with an annual probability of up to about 9%.

    r = 0; n = 40; p_hat = 0; SE_p = 0

Common errors

  • Model cohort size used in a binomial standard error

    The standard error depends on the study's n, not on the number of patients simulated in the model. Using 1,000 instead of 40 for 6 events among 40 patients gives about 0.0113 instead of 0.0565, a fivefold understatement.

Sources

  • NIST maximum likelihood estimator of the binomial probability

    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. Parameter estimation: the maximum likelihood estimator of p for fixed n is x/n.

    View source →

Canonical Identity