# TRatioPlot error

**URL:** <https://root-forum.cern.ch/t/tratioplot-error/47618>\
**Category:** Newbie\
**Created:** [November 10, 2021, 11:20pm UTC](https://root-forum.cern.ch/t/tratioplot-error/47618 "2021-11-10T23:20:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@paulan](https://root-forum.cern.ch/u/paulan)\
**Post date:** [November 10, 2021, 11:20pm UTC](https://root-forum.cern.ch/t/tratioplot-error/47618/1 "2021-11-10T23:20:06Z")

</div>

* * *

Hi everyone,

I need to plot the difference between my data in histogram and the fitting curve. My fit function is a sum of gaussian and landau functions defined over two separate ranges. I am using TRatioPlot but I get the following error: “Cannot compute confidence intervals with an invalide fit result”. Can anyone help me out with it?  
I am attaching my result.  
Also, it looks like the gaussian and the landau fits individually converge but for the total fit I get the warning “Abnormal termination of minimization”. Are they any way related?  
[ratioploterror.pdf](https://root-forum.cern.ch/uploads/short-url/An2CSuda6h7K6WTKFu4mv2EoYdw.pdf) (22.2 KB)

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [November 11, 2021, 9:24am UTC](https://root-forum.cern.ch/t/tratioplot-error/47618/2 "2021-11-11T09:24:57Z")

</div>

This error message comes from `hist/hist/src/TBackCompFitter.cxx`. It does not seem to be related to TRatioPlot. May be @moneta has an idea.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [November 11, 2021, 11:26am UTC](https://root-forum.cern.ch/t/tratioplot-error/47618/3 "2021-11-11T11:26:30Z")

</div>

Hi,  
If your fit is invalid, because you have an abnormal termination of the minimisation, which can be caused by large error in computing your function or bad initial starting values, you cannot compute any confidence intervals, since the resulting error and covariance matrix are not valid and correct

Best regards

Lorenzo

---

<div class="post-metadata">

**Author:** ![paulan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@paulan](https://root-forum.cern.ch/u/paulan)\
**Post date:** [November 11, 2021, 12:02pm UTC](https://root-forum.cern.ch/t/tratioplot-error/47618/4 "2021-11-11T12:02:49Z")

</div>

Hi Lorenzo, is there a way to fix the fit? I just used the gaussian and landau fits in different subranges and added them as given under “Fitting Multiple Sub Ranges” in [Chapter: FittingHistograms](https://root.cern.ch/root/htmldoc/guides/users-guide/FittingHistograms.html#result-of-the-fit).

---

<div class="post-metadata">

**Author:** ![paulan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@paulan](https://root-forum.cern.ch/u/paulan)\
**Post date:** [November 11, 2021, 12:20pm UTC](https://root-forum.cern.ch/t/tratioplot-error/47618/5 "2021-11-11T12:20:19Z")

</div>

Hi all,  
I have solved the error by setting the initial values myself so now the fit converges and I don’t get any error. Thank you!
