Re: histogram subtraction and mean

From: Arthur E. Snyder <snyder_at_slac.stanford.edu>
Date: Tue, 1 Mar 2011 13:33:51 -0800


Hi Lorenzo,

I didn't encounter the second problem.

However, my feeling is that for the 1st problem the default behavior should be more reasonable, intuitive and/or there should be a warning.

when I ecountered these crazy means I asked around SLAC and nobody knew about ResetStats thing though Eric Charles had encounted the crazy mean problem too.

The name ResetStats does not even really hint at what it does. It appears highly likely average user will screw this up and I can easily see it making it into a publication ...

I did try to post at the time I had this problem but something went wrong with posting and I never got around to re-posting it ...

-Arthur

A.E. Snyder, Group ?                         \!c*p?/
SLAC Mail Stop #95                          ((.   .))
Box 4349                                        |
Stanford, Ca, USA, 94309                      '\|/`
e-mail:snyder_at_slac.stanford.edu                 o
phone:650-926-2701                              _
http://www.slac.stanford.edu/~snyder          BaBar
FAX:707-313-0250                          Collaboration
                                                 &
                                            Fermi/GLAST



On Tue, 1 Mar 2011, Lorenzo Moneta wrote:

> HI Arthur,
>
> There are two different things:
>
> 1) When calculating the statistics (mean, standard deviation, etc...) it is used, when possible, the sums calculated from the original un-binned data. If you call before ResetStats() the
> computation is done using the bin center
>
> 2) When subtracting the histogram, TH1::Add(h1,h2,c1,c2) , when c1*c2 < 0, the current computed statistics is wrong because the absolute values of c1 and c2 are used. This is independent of ResetStats. This will be fixed,
>
> Lorenzo
>
>
>
> On Mar 1, 2011, at 9:43 PM, Arthur E. Snyder wrote:
>
>> Hi Lorenzo,
>>
>> I would say that ResetStats() should be the default. While it's clear in my example that the result is wrong, if working with a more symmetric distribution (for which error is not obvious) the naive user (like me) unaware of ResetStats might end up with a rather serious mistake in his/her analysis ..
>>
>> I don't know what the best algorythm is but the default should to something reasonably .. and/or give a big fat warning ..
>>
>>
>> -Arthur
>>
>> A.E. Snyder, Group ? \!c*p?/
>> SLAC Mail Stop #95 ((. .))
>> Box 4349 |
>> Stanford, Ca, USA, 94309 '\|/`
>> e-mail:snyder_at_slac.stanford.edu o
>> phone:650-926-2701 _
>> http://www.slac.stanford.edu/~snyder BaBar
>> FAX:707-313-0250 Collaboration
>> &
>> Fermi/GLAST
>>
>>
>>
>> On Tue, 1 Mar 2011, Lorenzo Moneta wrote:
>>
>>> Hi,
>>> On Mar 1, 2011, at 6:25 PM, Holger Meyer wrote:
>>>
>>>> If you only have the binned moments, you can't go the other way. The
>>>> only possible change might be to add a function to the histogram classes
>>>> that does the work for you. Something like
>>>> TH1::SetMomentsFromBinCenters().
>>>
>>> we have such a function already, TH1::ResetStats(). By calling it, all the statistics is computed from the bin centers,
>>>
>>> Lorenzo
>>>
>
>
Received on Tue Mar 01 2011 - 22:34:05 CET

This archive was generated by hypermail 2.2.0 : Tue Mar 01 2011 - 23:50:01 CET