Hoeffding Inequality Calculator

Analyze bounded variables with flexible concentration settings. Compute tail bounds, thresholds, confidence, and required samples. See formulas, tables, charts, exports, and interpretation guidance instantly.

Calculator inputs

Use the tail-bound mode for direct probabilities. Use inverse modes for planning sample size or deviation thresholds.

Statistics

Notes

Inverse modes use the sample-mean form with identical bounds.

The reported probability is an upper bound, not the exact tail probability.

Plotly chart

The chart updates after calculation. It visualizes how Hoeffding’s bound changes with deviation or sample size.

Formula used

For independent bounded variables Xi ∈ [ai, bi], define:

S = Σ (bi - ai

Sum form

P( ΣXi - E[ΣXi] ≥ u ) ≤ exp( -2u² / S )

P( |ΣXi - E[ΣXi]| ≥ u ) ≤ 2 exp( -2u² / S )

Sample mean form

P( X̄ - E[X̄] ≥ t ) ≤ exp( -2n²t² / S )

P( |X̄ - E[X̄]| ≥ t ) ≤ 2 exp( -2n²t² / S )

Identical bounds [a, b]

S = n(b - a)²

P( X̄ - E[X̄] ≥ t ) ≤ exp( -2nt² / (b - a)² )

n ≥ ((b - a)² ln(c / δ)) / (2t²), where c = 1 for one-sided and c = 2 for two-sided bounds.

How to use this calculator

  1. Choose whether you want a tail bound, a required sample size, or a deviation threshold.
  2. Select the quantity. Use sample mean for averages and sum for totals.
  3. Choose one-sided or two-sided analysis depending on your risk question.
  4. Enter either common bounds [a, b] or the total squared range sum Σ(bi - ai)².
  5. Provide the deviation, or enter a target upper probability for inverse planning.
  6. Press calculate to see the result table, plot, and download options.

Example data table

Scenario n a b Deviation One-Sided Bound Two-Sided Bound
Quality score average 25 0 1 0.10 0.6065 1.0000
Customer rating average 50 0 1 0.18 0.0392 0.0783
Bounded error average 120 -1 1 0.20 0.0907 0.1814

These examples show conservative upper bounds. They are useful when exact distribution details are unavailable.

Frequently asked questions

1. What does Hoeffding’s inequality measure?

It gives an upper bound on the chance that a bounded independent sum or average differs from its expected value by at least a chosen amount. It is conservative and distribution-free within the bounded setting.

2. When should I use the sample mean option?

Use the sample mean option when your question is about an average, such as mean rating, mean accuracy, or average cost. It scales the bound with sample size in the familiar concentration form.

3. What is the difference between one-sided and two-sided bounds?

A one-sided bound controls only upward or downward deviation, depending on interpretation. A two-sided bound controls absolute deviation in either direction, so it is usually larger and more conservative.

4. Why can the two-sided bound equal 1?

The inequality provides an upper bound, not an exact probability. For small samples or tiny deviations, the computed upper bound may exceed 1, so the calculator caps it at 1 because probabilities cannot be larger.

5. What does Σ(bi - ai)² represent?

It is the sum of squared widths of each variable’s allowed range. This quantity drives the concentration strength. Larger total range spread weakens the bound, while tighter bounds strengthen it.

6. Why are inverse modes limited to identical bounds?

The closed-form sample size and deviation formulas become straightforward when every variable shares the same bounds. With arbitrary ranges, the total squared range depends on the full variable structure and is not determined by n alone.

7. Does this calculator return exact tail probabilities?

No. It returns guaranteed upper bounds derived from Hoeffding’s inequality. The true probability may be much smaller, especially when the underlying distribution has lighter tails than the worst-case bounded scenario.

8. Can I use negative lower bounds?

Yes. The inequality only needs valid lower and upper bounds for each variable. Negative lower limits work normally as long as the upper bound is greater than the lower bound.

Related Calculators

kl divergence calculatorsquared loss calculatorexpected risk calculatorleave one out errorgrowth function calculatorconfidence bound calculatorhinge loss calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.