Acceptance Sampling & Hypergeometric Calculator

Check a finite inspection lot with one random sample drawn without replacement. Set the maximum defective units a sample can contain, compare two possible lot defect levels, and find the tested sample size range that meets both risk limits.

Finite-lot inspection plan

Compare acceptance sampling risks

The entered sample meets both risk limits.
Edit the lot, sample and risk limits

Count defective units. A unit with more than one defect still counts once. Enter two possible defective counts and the risk limit for each.

Current inspection plan
Lot scenarios and risk limits

Producer risk

3.838384%

Rejecting a lot with 2 defective units.

Meets 5% limit

Consumer risk

4.984803%

Accepting a lot with 20 defective units.

Meets 10% limit

Sample sizes meeting both limits

Samples 17 to 22

Acceptance count stays at 1. Checked sample sizes 1 through 100.

Lot acceptance curve

At sample size 20, each plotted point checks a whole number of defective units in the lot.

Acceptance probability versus the lot's defective countAt 2 defective units the lot acceptance chance is 96.161616%. At 20 it is 4.984803%. The inspected count 20 has acceptance chance 4.984803%.100%0%0100Defective units in lot
  • Lower-defect lot
  • Higher-defect lot
  • Inspected value

4.984803% probability of acceptance with 20 defective units.

Sample sizes allowed by each risk limit

Each band shows the integer sample sizes allowed at the current acceptance count. The dashed line marks the entered sample.

Allowed sample sizes under the producer and consumer limitsProducer · qualifying sample sizes 1 through 22. Consumer · qualifying sample sizes 17 through 100. Both · qualifying sample sizes 17 through 22.ProducerConsumerBoth1100Units in sample

Producer maximum 22. Consumer minimum 17.

Review exact risks and export CSV
Risk at the entered size and around the qualifying boundaries
SampleProducer riskConsumer riskLimits met
10%100%Producer
162.424242%11.864202%Producer
172.747475%9.633702%Both
183.090909%7.777752%Both
203.838384%4.984803%Both
214.242424%3.957566%Both
224.666667%3.124724%Both
235.111111%2.453569%Consumer
100100%0%Consumer

The plan assumes random draws without replacement and correct unit classification. Use your actual inspection procedure and risk requirements.

How to use this calculator

  1. Enter the lot size, current sample size and maximum number of defective units allowed in the sample.
  2. Enter two possible whole defective counts for this lot and the producer and consumer risk limits.
  3. Compare the risks at your entered sample and review the sample size window at the same acceptance number.
  4. Inspect any integer defective count on the lot acceptance curve.
  5. Export exact probabilities and the witness sample sizes around each risk threshold.

The Formula

The mathematical logic powering this calculation is:

For a lot of N units with D defective units, draw n units uniformly at random without replacement. Let X be the number of defective units in the sample. The probability of exactly x is C(D,x) × C(N − D,n − x) / C(N,n), where C counts combinations. A sample qualifies when X is at most the chosen acceptance count c. Add the exact probabilities from the smallest possible X through c to obtain the lot's acceptance chance. Impossible count terms contribute zero.

Specify a lower defective count D₁ and a higher count D₂. Producer risk is one minus the chance of accepting the lot at D₁. Consumer risk is the chance of accepting the lot at D₂. The two limits compare these conditional probabilities. A defective unit counts once even when it has more than one flaw.

Hold the lot, c and both defect counts fixed as sample size varies. In a random ordering of the same lot, sampling more units can only preserve or increase the number of defectives found. Acceptance probability therefore cannot increase with sample size. This gives a maximum size for which producer risk is at most its limit and a minimum size for which consumer risk is at most its limit. Their overlap contains every qualifying sample size considered. Equality passes. The calculator finds these endpoints using exact probabilities and binary search.

The operating characteristic curve plots sampled integer defect counts and includes both scenario points. The inspector recalculates any chosen count exactly. The connected line is a visual guide between whole-count probabilities. The CSV records exact curve and inspection probabilities plus sample sizes at and around each risk boundary.

Lot size can be 2–5,000 units. Sample size is from 1 through the smaller of the lot size and 500, and c is a whole number from zero through the entered sample size. The search uses sample sizes from max(1,c) through that cap. Risk limits are 0–100% with up to six fractional places. The worksheet tests a single-sample rule at two assumed lot counts. It does not establish the actual defect rate, select a mandated inspection standard, account for classification error, or evaluate a multistage plan.

Worked Example

If you input:

  • Inspection rule: 100-unit lot. Sample 20. Accept up to one defective unit.
  • Defective counts: 2 in the lower-defect lot and 20 in the higher-defect lot.
  • Limits: 5% producer risk and 10% consumer risk.

Result:

The current 20-unit sample meets both limits. With the same acceptance cutoff, sample sizes 17 through 22 also satisfy both limits.

Frequently Asked Questions

Why is this hypergeometric rather than binomial?

Each unit sampled leaves the finite lot, so the remaining mix of good and defective units changes. The hypergeometric distribution uses the exact counts and without-replacement probability.

Why does larger sample size affect the two risks in opposite directions?

At a fixed acceptance count, adding more inspected units gives more opportunities to find defectives. That reduces acceptance at both lot counts, which increases producer risk and decreases consumer risk.

What if no sample size meets both limits?

The two constraints have no overlapping sample sizes within the supported search window at the entered acceptance number. Check the individual endpoints in the chart.

What does a consumer risk of 10% mean?

At the entered higher defective count, one in ten random samples would accept such a lot under the modeled rule. It describes that scenario's acceptance rate.

What happens if every unit in a small lot is sampled?

The outcome for an assumed defective count is exact. It has acceptance probability one when the count is at or below the cutoff and zero otherwise.

Does this determine my lot's actual number of defective units?

The defective counts are test scenarios you supply. The results describe how the inspection rule would behave for those counts.

Similar Calculators