# Fitting TGraphAsymErrors, difference between "W" and "EX0"

**URL:** <https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522>\
**Category:** Newbie\
**Created:** [March 22, 2020, 2:23pm UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522 "2020-03-22T14:23:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![abcd](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@abcd](https://root-forum.cern.ch/u/abcd)\
**Post date:** [March 22, 2020, 2:23pm UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/1 "2020-03-22T14:23:55Z")

</div>

Hey, I am fitting a TGraphAsymErrors graph, and I was wondering what the difference was between adding “EX0” or adding “W” to the Fit function. If I understood it correctly, “W” means that the error bars are being ignored. For “EX0” I found ’ When fitting or TGraphAsymErrors do not consider errors in the coordinate’, which also means that the errors are ignored? However, I get different results when fitting depending on which one I use. So what is the difference?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 22, 2020, 2:30pm UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/2 "2020-03-22T14:30:23Z")

</div>

@couet This is a bug in the “EX0” description. It should be:  
When fitting a [TGraphErrors](https://root.cern/doc/master/classTGraphErrors.html) or TGraphAsymErrors do not consider errors in the X coordinate

BTW. “W” ignores all errors in X and Y and sets all “weights” to 1.

---

<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:** [March 23, 2020, 9:47am UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/3 "2020-03-23T09:47:37Z")

</div>

EX0 is a [TGraph::Fit](https://root.cern/doc/master/classTGraph.html#aa978c8ee0162e661eae795f6f3a35589) option . I let @moneta give his point of view on the doc change.

---

<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:** [March 23, 2020, 9:57am UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/4 "2020-03-23T09:57:37Z")

</div>

Hi,

The option `EX0` is an option that applies for the fitting of `TGraphErrors` , `TGraphAsymmErrors` and `TGraph2Derrors`.  
It means that the errors are set to zero for all the coordinates. Coordinate error does not mean point error. Coordinates are considered the independent variables (the features of the regression problem), which are X in the 1-dim case (`TGraphErrors`) and X and Y in the 2D case (`TGraph2DErrors`) and they are not to be confused with the dependent variables (Y in 1D case and Z in the 2d case).

Now option `W` instead set all errors to 1 and basically ignore all point errors. It is like fitting a TGraph instead of a TGraphErrors

Lorenzo

---

<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:** [March 23, 2020, 9:58am UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/5 "2020-03-23T09:58:40Z")

</div>

@moneta : @Wile_E_Coyote suggested some change in the help of EX0. Should we do it ?

---

<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:** [March 23, 2020, 10:01am UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/6 "2020-03-23T10:01:32Z")

</div>

Yes, I will clarify this is the documentation

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 23, 2020, 10:05am UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/7 "2020-03-23T10:05:41Z")

</div>

Well, in my “improvement proposal”, I’ve forgotten about the `TGraph2DErrors` as it was not explicitly mentioned in the “EX0” description.

@moneta Maybe also adding relevant infos to the “W” description would be nice (basically the same clarifications as in your previous post).

---

<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:** [March 23, 2020, 10:13am UTC](https://root-forum.cern.ch/t/fitting-tgraphasymerrors-difference-between-w-and-ex0/38522/8 "2020-03-23T10:13:59Z")

</div>

Thank you for the suggestion. I agree the current explanations:  
" Set all weights to 1; ignore error bars" is not very clear.

I think something like this would be better:

“Set all errors to 1; this is equivalent to ignoring error bars”

Lorenzo
