Your Equation

Library / Probability distributions / PRD-48

Probability distributions

Batch variation: exact successes

Probability of exactly x successes in a batch of n trials when the success probability itself varies from batch to batch following a beta distribution with shapes a and b.

Ref
PRD-48
Rev
v1
Field
Probability distributions
Result
P

With batch-to-batch variation in the success probability, the count in a batch of n follows the beta-binomial distribution. Conditional on a common probability p the trials are independent, and across batches p follows Beta(a, b). The count is more spread out than a plain binomial with the same mean. Use log-forms for large counts.

Probability of exactly x successes in a batch of n trials when the success probability itself varies from batch to batch following a beta distribution with shapes a and b.

Calculator

Solve for
140
0.210
0.210
040
  • Mean probability, a/(a + b)0.4
  • Expected successes, na/(a + b)4
  • Plain binomial probability at the same mean p0.2508

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Probability of exactly x successes () current value 0.1399
nTrials per batch nKey driver
00.148
xSuccesses x
0
bShape b
0.01570.141
aShape a
0.02180.143
  • The chance of exactly 4 successes in a batch of 10 is 14 %.
  • A plain binomial with the same mean probability would give 25.1 %; the beta-binomial puts more weight on extreme batches.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing ()Local stepChange in result
n Trials per batch n1 to 40 00.1480.148+1 −5.71 %
x Successes x0 to 40 00.13990.1399+1 −10 %
b Shape b0.2 to 10 0.015720.14140.1257+10%+0.971 %
a Shape a0.2 to 10 0.021810.14330.1215+10%+1.74 %

Sweep of Successes x

Successes xProbability of exactly x successes
00.06593
50.1259
100.01099
150
200
250
300
350
400

Sweep one variable

Probability of exactly x successes ()Hover, touch, or use the arrow keys on the chart
00.050.10.15 010203040 Successes x now 0.1399

Variables and how each one contributes

P

Probability of exactly x successes

Result ·

What the equation gives you. Everything else feeds it.

n

Trials per batch n

· typical 1 to 40

The number of trials in a batch (a whole number, at least 1). More trials per batch raise the mean count and the variance. Raising it by 1 (to 11) moves the result by −5.71 %, from 0.1399 to 0.1319.

a

Shape a

· typical 0.2 to 10

The first shape of the beta distribution of batch probabilities (a plain number). Raises the average success probability and narrows its spread. Raising it by 10 % (to 2.2) moves the result by +1.74 %, from 0.1399 to 0.1423.

b

Shape b

· typical 0.2 to 10

The second shape of the beta distribution of batch probabilities (a plain number). Lowers the average success probability and narrows its spread. Raising it by 10 % (to 3.3) moves the result by +0.971 %, from 0.1399 to 0.1412.

x

Successes x

· typical 0 to 40

The number of successes in a batch (a whole number from 0 to n). Moves the count at which the probability is read. Raising it by 1 (to 5) moves the result by −10 %, from 0.1399 to 0.1259.

Worked example with the values above

  1. Ways to choose which trials succeed: C(10, 4) = 210.
  2. Beta ratio: B(x + a, n − x + b)/B(a, b) = B(6, 9)/B(2, 3).
  3. P = 0.13986.

Assumptions and limits

  • Within a batch the trials are independent with a common probability p; across batches p follows a beta distribution with shapes a, b > 0.
  • n and x are whole numbers, and 0 ≤ x ≤ n.

Common mistakes

  • Using a plain binomial when batches differ in quality: it understates the variance and the chance of extreme batches.
  • Treating a and b as probabilities: they are shape parameters, and a/(a + b) is the mean probability.
  • Using the formula for x outside 0 to n: the probability is zero there.

Statistics and uncertainty

The inputs are parameters, usually fitted to data, and their estimation error carries into the result. The probability or density is a smooth function of the parameters, so the sweep chart shows how sensitive it is: where the curve is steep, a small error in a parameter makes a large difference. The formula treats the parameters as exact, so it gives no confidence interval on its own.

Where it is used

  • Defect counts in batches of parts when batch quality varies.
  • Test pass counts across lots, and any count with more spread than a binomial.

Maths you need

  • Binomial distribution: successes in independent trials
  • Beta distribution: a model for a probability that varies

Related formulas

Practise this formula