I have several sampled points $(x_i, y_i)$ with mutually independent error on the y coordinate $\sigma_{y_i}$. For simplicity, I'm assuming no error in the x coordinates ($\sigma_{x_i} \ll \sigma_{y_i}$)
I'm attempting to find a model this set of points, and propagate the error (along with any appropriate error from the fit, if applicable) to the model. Is there a simple way to do this? I'm completely unaware about how to normally propagate errors in Mathematica, so I've been doing it by hand using the standard formula for independent errors (where $f(x_1, x_2,... x_i)$):
$$\sigma_f = \sqrt{\sum_{i}{\left(\frac{\partial f}{\partial x_i} \sigma_{x_i}\right)}^2}$$
And while I could re-implement FindFit
using the mathematical definition of a least squares fit, (ie, take the gradient of the residuals and solve the system,) then figure out how to throw that into the above formula, I think surely there must be a better way.
If it helps, specifically, the model I'm attempting to fit is $A \cos{\pi x / a}$ (with a constraint on $a$ to avoid a Nyquist issue, of course.) I'd like to obtain $a$, $A$, $\sigma_a$, and $\sigma_A$.
NonlinearModelFit
will give you lots more information thanFindFit
and might provide a more appropriate standard error for whatever function of the estimated parameters that is of interest. Your formula above ignores any covariance among the $x$ values (which I assume are the coefficient estimators). You might want to give more details as to what you need. $\endgroup$