compute_errors#
- zfit.result.compute_errors(result, params, *, cl=None, rtol=None, method=None, covariance_method=None, sigma=None)[source]#
Compute asymmetric errors of parameters by profiling the loss function in the fit result.
This method finds the value for a given parameter where the loss function is
cl
away: for example for a cl of 68.3%, this is one (multiplied by the errordef). The other parameters are also minimized and not fixed. This method is comparably computationally intensive and, if possible,hesse
should be used. However, sincehesse
does not capture asymmetric or non-parabolic shaped profiles well, this method is preferable.- Parameters:
result (
FitResult
) – fit result to be used to compute the uncertainties.params (
list
[ZfitIndependentParameter
]) – The parameters to calculate the error. If None, use all parameters.sigma (
float
|None
) – Number of sigmas to calculate the error. Alternative tocl
.cl (
float
|None
) – Confidence Level of the parameter to be determined. Defaults to 68.3%. Alternative tosigma
.rtol (
float
|None
) – relative tol between the computed and the exact rootsmethod (
str
|None
) – type of solver,method
argument ofscipy.optimize.root()
. Defaults to “hybr”.covariance_method (
str
|Callable
|None
) – The method to use to calculate the correlation matrix, will be forwarded directly toFitResult.covariance()
. Valid choices are by default {‘minuit_hesse’, ‘hesse_np’} (or any other method defined in the result) or a Callable.
- Returns:
- A
dict
containing as keys the parameter and as value adict
which contains two keys ‘lower’ and ‘upper’, holding the calculated errors. Example: result[par1][‘upper’] -> the asymmetric upper error of ‘par1’
out: a fit result is returned when a new minimum is found during the loss scan
- A
- Return type:
out