Skip to main content
1-Visitor
May 12, 2014
Solved

How to calculate the error of fitted parameters

  • May 12, 2014
  • 17 replies
  • 6289 views

Hi,

I am using genfit() to fit my experimental data to one function with 3 free parameters. Mathcad could give the best fit parameters very fast.

But how to calculate the error of these fitted parameters.

Thanks a lot.

Best answer by RichardJ

You are fitting the sum of two functions that only differ slightly in their shape, and your data has no sharp or distinguishing features that forces the fit to a well defined, unique, solution. Based on considerable experience, your fit is probably ill conditioned, and the estimated errors in your parameters are not reliable, but the errors may indeed be large. The real errors might even be worse than the estimates.

You eliminated the last point in the calculations of the residuals, but not in the fit itself. You can't do that, because the last point affects the fit. I would dump the last point altogether.

17 replies

Werner_E
25-Diamond I
May 12, 2014

Lookup and evaluate the built-in varaible ERR or calculate the residual sum of squares yourself.

Werner_E
25-Diamond I
May 12, 2014

As usual Richard is right.

ERR will be available if you determine the fit yourself using a solve block with minerr() but not if you use genfit().

19-Tanzanite
May 13, 2014

That's not really the issue. What Jiao wants is the estimated errors in the parameters, not the error in the fit. Unfortunately, a reliable estimate of the errors in the parameters of a non-linear least squares fit is hard to obtain. In my experience (and many years ago I spent a lot of time going through the exercise of trying to get reliable estimates), so much so that I don't bother even trying any more.

19-Tanzanite
May 12, 2014

If you are using Mathcad 15 look in the Data Analysis Extension Pack, "Quality of fit". Be aware that in some cases the error estimates can be very poor ones (it depends on how well conditioned your fitting problem is).

1-Visitor
May 12, 2014

Hi Werner and Richard,

Thanks for your quick and nice advice. I have modified my program and figured out the error of the fitted parameters based on the instruction in Data Analysis Extension Pack (which is named as CI in my program). The fitting is very good, however, the error seems to be too big here, which is much larger than my expectation based on their physical meaning. I just start to use Mathcad and not sure about the programming.

Here, I attached my program, could you please help me to check it.

Many thanks.

RichardJ19-TanzaniteAnswer
19-Tanzanite
May 13, 2014

You are fitting the sum of two functions that only differ slightly in their shape, and your data has no sharp or distinguishing features that forces the fit to a well defined, unique, solution. Based on considerable experience, your fit is probably ill conditioned, and the estimated errors in your parameters are not reliable, but the errors may indeed be large. The real errors might even be worse than the estimates.

You eliminated the last point in the calculations of the residuals, but not in the fit itself. You can't do that, because the last point affects the fit. I would dump the last point altogether.