Uncertainty in fixed parameters/constants

30 views

Anouk Volker

Feb 6, 2024, 11:17:01 AMFeb 6
to lmfit-py
Dear all,

I was wondering if there is a way to take the uncertainty in parameters that are not to be optimized into account? Say for example that you are fitting experimental data with a function that has some parameters that are to be fitted, but also a constant (for example the light power used). This constant should not be optimized during the fitting but was measured previously. The value for this constant therefore has some error. Is there a way to incorporate this uncertainty in the fitting?

I was considering performing the fit for a range of values within the uncertainty of the constant ( say power = 50 +/- 2, taking values from 48 to 52) to see the effect on the result of the fit, but this seems like a rather inefficient and not very quantifiable method.

Kind regards,
Anouk

Matt Newville

Feb 8, 2024, 3:43:02 PMFeb 8
Hi Anouk,

As we almost always suggest, it would be helpful to have a script that
shows more details of what you are doing.

We do not have an easy, general-purpose approach to including
uncertainties for a non-fitted parameter.

But, I think it may be possible to do this, at least in some cases.
That is, one might follow the approach discussed for including
uncertainties in the independent data, x, at
where one sets the uncertainty (or a portion of the uncertainty) in
the result to be
fixedpar_uncertainty * df / dfixedpar

Where 'fixedpar' is the fixed parameter. Unlike for an independent
variable x, a numerical derivative for a Parameter would not be
possible (the parameter has one value). But if you can figure out an
analytic derivative df/dfixedpar, then one might be able to use that
as the uncertainty used to weigh the fit.

--Matt
> --
> You received this message because you are subscribed to the Google Groups "lmfit-py" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lmfit-py+u...@googlegroups.com.