Statistics & data
Error Bar Graph & Maximum Minimum Gradient Calculator
Paste measurements with absolute uncertainties. Compare the ordinary least-squares line with the full range of lines that intersect every uncertainty rectangle.
Your measurements
Start with the example, or enter your own values. Use a dot for decimals and e for scientific notation.
Calculated locally. No account or uploads.
Result & working
ExampleThe calculator is loading. You can read the worked example below.
Step-by-step working
The formula
y = mx + c
|yᵢ − (mxᵢ + c)| ≤ Δyᵢ + |m|Δxᵢ
Δm = (m_max − m_min)/2; Δc = (c_max − c_min)/2
| Symbol | Meaning |
|---|---|
| Δx, Δy | Absolute measurement uncertainty; each bar extends this far on either side. |
| m, c | Gradient and vertical intercept. |
| Bounds | Extrema over all straight lines intersecting every rectangular uncertainty region. |
When to use this calculator
Use this to practise drawing acceptable lines and checking every uncertainty bar. With x uncertainty, a line may intersect the rectangle away from its centre. This tool uses rectangular bounds, not a probability ellipse.
Maximum/minimum gradients are found by intersecting linear constraints separately for positive and negative slopes. Intercept bounds are optimized separately: the lines with extreme slope do not necessarily have extreme intercept. The midpoint and half-range summarize bounds; an off-centre best fit is better reported with asymmetric limits.
No acceptable line means these bars and a straight-line model are mutually inconsistent under this criterion. Do not automatically delete points or enlarge bars. If horizontal bars overlap too much, slope bounds can be unbounded; the tool reports this explicitly.
Worked example
The calculator opens with these example values. All steps below are available even with JavaScript disabled.
- Fit the central values with ordinary least squares: Sxy/Sxx = 9.9/5 = 1.98.
- c = ȳ − mx̄ = 5.05 − (1.98) × 2.5 = 0.1.
- For every point require |y − (mx+c)| ≤ Δy + |m|Δx. Solve all constraints together, considering positive and negative gradients separately.
- All-rectangle gradient bounds: 1.809211 to 2.128378. Δm = (2.128378 − (1.809211))/2 = 0.1595839.
- Optimize intercept separately over all feasible lines: c_min = -0.2709459, c_max = 0.5269737; Δc = 0.3989598.
- Half-range relative to the magnitude of the OLS gradient: 0.1595839 / |1.98| × 100 = 8.059794%. This does not imply that the OLS line is acceptable.
Y = 1.98 X + 0.1
Common mistakes
- Uncertainty bars are not automatically standard deviations. State their meaning.
- A least-squares line need not intersect every bar.
- Do not force a fit through the origin without a physical reason.
- Automatic bounds help you check a graph; practise constructing the lines by eye for assessment.