# A Simpler Way to Calculate Error Bars

How to calculate nice error bars?

I remember from undergrad years, one of the biggest sources of confusion was how to compute error bars for experimental data points. I recall my professor in the chemical engineering lab one day showed us the equation for propagation of uncertainty, but we never had the foggiest idea of how it was derived, what justified the use of the equation, or what the assumptions were behind the equation. I don’t fully understand the statistical arguments behind the POU formula. Furthermore, the POU formula is complicated and unwieldy to use for large equations, and I haven’t the foggiest idea how to apply it to an implicit equation.

An alternate method of computing error bounds on a function is to recast the problem as two optimization problems. Suppose we have a function $f=f(x,y)$, with uncertainties $u_x$ and $u_y$ What then is the uncertainty in $f$, $u_f$?
The way to find $u_f$, is to first attempt to maximize f subject to the uncertainty bounds on x and y. Then once that problem is compete, then attempt to minimize $f$ subject to the same constraints. This yields quantities $f_{max}$ and $f_{min}$. Call the nominal value of $f$, $f_0$. Then the upper bound on error is $f_{max} - f_0$, and the lower bound on error is $f_0 - f_{min}$.
In MATLAB, this problem is easily solved using the Optimization Toolbox with fmincon(). The objective function is $f$, and the upper and lower bounds on $x$ and $y$ form the vectors of upper and lower bounds on the decision variables.