Skip to main content
v2026.11,858 entries · CC-BY 4.0

Binomial Distribution Parameters: What n and p Mean

The binomial distribution parameters are n and p. Learn what each means, how they set mean, variance and skew, how to estimate p, and how to report them.

Written and maintained by CASRAI Editorial Board

Last updated

A binomial distribution has two parameters: n, the number of trials, and p, the probability of success on each trial. Once n and p are fixed, the whole distribution is fixed: its mean is np, its variance is np(1 − p), and its shape follows from them. This guide explains what each parameter means, how each one changes the shape, how to estimate p from data, and how to report both in a paper.

What are the parameters of a binomial distribution?

The binomial distribution describes the number of successes X in n trials when every trial has the same success probability p. The SciPy tutorial defines a binomial variable as the sum of n independent Bernoulli random variables of parameter p. The NIST/SEMATECH e-Handbook states the same setup: n is the number of trials, p is the probability of success on a single trial, and p is fixed for all trials. The count x is the outcome, not a parameter: x can be any whole number from 0 to n.

Many sources write the distribution as X ~ B(n, p). The probability of exactly x successes is:

P(X = x) = C(n, x) · px · (1 − p)n − x, for x = 0, 1, …, n

where C(n, x) = n! / (x!(n − x)!) is the number of ways to choose which x of the n trials are the successes.

n and p: definitions and allowed values

Parameters of the binomial distribution: n

n is the number of trials. The R manual describes it as the number of trials (zero or more), passed as size. It must be a whole number, and it must be fixed and known before you collect the data. If you keep sampling until something happens, a different distribution applies (see binomial vs geometric).

Parameters of the binomial distribution: p

p is the probability of success on each trial, passed as prob in R. It is a number from 0 to 1 inclusive, and it has to be the same on every trial. Which outcome you call a “success” is your choice, but you must then use that same outcome when you set p and when you count x.

Parameter Meaning Allowed values R / SciPy / Excel name
n Number of trials 0, 1, 2, … (whole numbers) size / n / trials
p Probability of success on each trial 0 ≤ p ≤ 1 prob / p / probability_s

Setting n = 1 gives a single Bernoulli trial; the page on the Bernoulli distribution formula covers that special case, and Bernoulli vs binomial compares the two.

How n and p set the mean, variance and shape

NIST gives the mean as np and the standard deviation as √(np(1 − p)). The SciPy tutorial adds the skewness, (1 − 2p) / √(np(1 − p)). Because that numerator depends only on p, the sign of the skew is decided by p alone, and n controls how strong it is. The table applies those formulas to four parameter pairs:

n p Mean np Variance np(1 − p) SD Skewness
10 0.5 5 2.5 1.581 0 (symmetric)
10 0.2 2 1.6 1.265 0.474 (right tail)
50 0.2 10 8 2.828 0.212 (right tail, weaker)
10 0.8 8 1.6 1.265 −0.474 (left tail)

Three patterns follow directly from the formulas:

  • p below 0.5 skews right, p above 0.5 skews left, p = 0.5 is symmetric, because the sign of 1 − 2p changes at 0.5. Rows 2 and 4 are mirror images: swapping p for 1 − p flips the skewness sign and leaves the variance unchanged. See left vs right skewness for how to read that sign.
  • Raising n with p fixed moves the mean up in proportion to n (2 to 10 from rows 2 to 3) and shrinks the skewness (0.474 to 0.212).
  • For a fixed n, the variance is largest at p = 0.5, since p(1 − p) peaks there. A rate near 0 or 1 gives counts that cluster tightly.

The shape of the full probability mass function is shown on the binomial probability distribution graph page, and the mean is derived in binomial distribution expected value.

Worked example

Suppose a lab runs n = 20 independent assays, and each one succeeds with probability p = 0.3. What is the distribution of the number of successes?

  1. Parameters: n = 20, p = 0.3, so X ~ B(20, 0.3).
  2. Mean: np = 20 × 0.3 = 6.
  3. Variance: np(1 − p) = 20 × 0.3 × 0.7 = 4.2, so the SD is √4.2 = 2.049.
  4. Skewness: (1 − 0.6) / 2.049 = 0.195, a slight right skew because p < 0.5.
  5. Probability of exactly 6 successes: C(20, 6) = 38,760; 0.36 = 0.000729; 0.714 = 0.006782. Multiplying: 38,760 × 0.000729 × 0.006782 = 0.1916.

So the most typical outcome is about 6 successes, and that exact count occurs about 19% of the time. For more probability calculations see the binomial probability calculator guide.

Estimating p from data

In most studies n is set by the design and p is unknown. When n is known, the natural estimate of p is the observed proportion, p̂ = x / n. Suppose 18 of n = 60 samples show the outcome of interest:

  1. p̂ = 18 / 60 = 0.30.
  2. The variance of x is np(1 − p), so the variance of x / n is p(1 − p) / n. Replacing p with p̂ gives the standard error SE = √(0.30 × 0.70 / 60) = √0.0035 = 0.059.

The standard error follows from the variance formula above. For an interval around p̂, see confidence interval for a proportion.

Assumptions and common mistakes

  • Fixed n. The number of trials must be set in advance. Counting successes until you reach a stopping rule is not binomial sampling.
  • Constant p. NIST states that p is fixed for all trials. If the success probability differs between units (different patients, batches or sites), a single p does not describe the data. When p itself varies, see the beta-binomial distribution.
  • Independent trials. The SciPy definition is a sum of independent Bernoulli variables. Repeated measures on the same unit are not independent trials.
  • Mixing up the count and the parameter. x (successes observed) varies from sample to sample; n and p describe the process.
  • Invalid inputs. The R manual says a non-integer size returns NaN and a non-integer x gives density 0 with a warning. Microsoft documents that Excel’s BINOM.DIST truncates number_s and trials to integers and returns #NUM! when number_s is below 0 or above trials.

How to report it (APA example)

State the model, the parameters, and how each was set or estimated. An example of how to word it:

The number of successful assays was modeled as binomial, X ~ B(n = 60, p). The estimated success probability was p̂ = 0.30 (SE = 0.059), based on 18 successes in 60 trials.

Say whether n was fixed by design, and say how independence was ensured. Follow the numeric and symbol formatting rules of the style guide your journal requires.

How to calculate it in Excel, R or Python

Each snippet reproduces the worked example (n = 20, p = 0.3, x = 6).

Excel

=BINOM.DIST(6, 20, 0.3, FALSE)   returns 0.1916  (P(X = 6))
=BINOM.DIST(6, 20, 0.3, TRUE)    returns 0.6080  (P(X <= 6))
=20*0.3                          returns 6       (mean)
=18/60                           returns 0.30    (p-hat)

Microsoft’s syntax is BINOM.DIST(number_s, trials, probability_s, cumulative): trials is n and probability_s is p.

R

dbinom(6, size = 20, prob = 0.3)   # 0.1916
pbinom(6, size = 20, prob = 0.3)   # 0.6080
18 / 60                            # p-hat

Python

from scipy.stats import binom
binom.pmf(6, 20, 0.3)    # 0.1916
binom.cdf(6, 20, 0.3)    # 0.6080
binom.mean(20, 0.3), binom.var(20, 0.3)   # 6.0, 4.2

FAQ

What are the two parameters of a binomial distribution?

n, the number of trials, and p, the probability of success on each trial. Both are needed to specify the distribution.

Are the mean and variance parameters of the binomial?

No. They are derived from the parameters: mean = np and variance = np(1 − p). Both are functions of n and p.

Can n be a decimal?

No. n counts trials, so it is a whole number. R returns NaN for a non-integer size, and Excel truncates it to an integer.

Can p be 0 or 1?

Yes, the allowed range is 0 ≤ p ≤ 1. At the endpoints every trial has the same outcome, so the variance np(1 − p) is 0.

What is a binomial distribution with n = 1?

It is a Bernoulli distribution: a single trial with success probability p. A binomial variable is the sum of n such independent trials. See median of the binomial distribution for another property controlled by n and p.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Binomial Distribution Parameters: What n and p Mean

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.