Re: Fitting TGraphErrors

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Sun, 28 Jun 2009 19:13:08 +0200


You are generating x values that may be negative !!! then you evaluate an illegal function x**y with eg x=-1.11 and y=1.2 Fix your function or the x range.

Rene Brun

OKUMURA, Akira wrote:
> Hello Lorenzo,
>
> I got a similar problem again when I fit a TGraphErrors with a
> function "x**[0]". Would you check the attached macro, please? Most of
> the code is the same as the previous one I sent in February.
>
> Chi^2 often becomes "inf", but not always. Please run the macro
> repeatedly if you get a proper result.
>
> I am using the SVN HEAD on Leopard.
>
> Regards,
>
> OKUMURA, Akira oxon_at_ceres.phys.s.u-tokyo.ac.jp
> Department of Physics, The University of Tokyo
> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
> TEL/FAX +81 3-5841-4173/4059
> Skype : okumura.akira
>
> On 2009/02/25, at 1:36, Lorenzo Moneta wrote:
>
>> Hi,
>>
>> using option "F" in your particular case showed a problem. Thank you
>> for your example.
>> This is now fixed in the trunk version and your macro works fine.
>> What stated in the doc is correct, with the linear fitter error in X
>> are not taken into account when fitting a TGraphErrors
>>
>> Best Regards
>>
>> Lorenzo
>> On Feb 24, 2009, at 1:25 PM, OKUMURA, Akira wrote:
>>
>>> Hello Rene,
>>>
>>> Did you mention this?
>>> =======
>>> Note, that the linear fitter doesn't take into account the errors in
>>> x. If errors in x are important, go through minuit (use option "F"
>>> for polynomial fitting).
>>> =======
>>>
>>> I tried "F" option, but the result becomes chi^2/ndf = 0/0
>>>
>>> Regards,
>>>
>>> OKUMURA, Akira oxon_at_ceres.phys.s.u-tokyo.ac.jp
>>> Department of Physics, The University of Tokyo
>>> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
>>> TEL/FAX +81 3-5841-4173/4059
>>> Skype : okumura.akira
>>>
>>> On 2009/02/24, at 21:03, Rene Brun wrote:
>>>
>>>> see comments in the doc of TGraph::Fit
>>>> http://root.cern.ch/root/html/TGraph.html#TGraph:Fit
>>>>
>>>> Rene Brun
>>>>
>>>> OKUMURA, Akira wrote:
>>>>> Hello ROOTers,
>>>>>
>>>>> I attache an example of TGraphErrors::Fit. The left plot returns
>>>>> reasonable chi^2/ndf, but the right side doesn't. The result
>>>>> depends on the variable "kScale" in the macro.
>>>>>
>>>>> The fitting results from the left and the right plots should be
>>>>> the same value mathematically.
>>>>>
>>>>> Am I doing something incorrect?
>>>>>
>>>>> 5.22.00 + Mac OS X 10.5.6
>>>>>
>>>>> Regards,
>>>>>
>>>>> OKUMURA, Akira oxon_at_ceres.phys.s.u-tokyo.ac.jp
>>>>> Department of Physics, The University of Tokyo
>>>>> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
>>>>> TEL/FAX +81 3-5841-4173/4059
>>>>> Skype : okumura.akira
>>>>
>>>
>>
Received on Sun Jun 28 2009 - 19:13:43 CEST

This archive was generated by hypermail 2.2.0 : Mon Jun 29 2009 - 05:50:04 CEST