Pierre-Luc Drouin | 3 Dec 2009 23:57
Picon
Picon

[ROOT] Minuit Parabolic Errors Smaller than both Minos Errors?

Hi,

I was doing some tests to understand exactly how Minuit computes the 
parabolic errors vs the Minos errors and I observed a strange result. 
Using my test, Minuit finds parabolic errors that are smaller than both 
Minos errors for all the fit parameters:

FCN=1.10038e-14 FROM MINOS     STATUS=SUCCESSFUL    275 CALLS         
363 TOTAL
                     EDM=8.9213e-11    STRATEGY= 1      ERROR MATRIX 
ACCURATE
  EXT PARAMETER                  PARABOLIC         MINOS ERRORS       
  NO.   NAME      VALUE            ERROR      NEGATIVE      POSITIVE  
   1  x            1.23000e+02   7.26365e+00  -1.30000e+01   2.60000e+01
   2  y            5.73000e+02   4.78688e+01  -4.50000e+01   7.50000e+01
   3  z            2.50000e+01   1.53528e+00  -3.00000e+00   5.00000e+00
                               ERR DEF= 0.5

What I do for this test is to simply ask Minuit to find the maximum of a 
multivariate Gaussian function with correlated variables and 
asymmetrical widths (I simply use a different width depending if the 
variables are smaller or greater than their expected fit values). I 
would expect Minuit to find the following correlation matrix:

        1.000000000
        2.338779e-01    1.000000000
        8.988122e-01    4.169567e-01   1.000000000

but the covariance matrix it returns,
        5.276059e+01    -2.782138e+01   4.362987e+00
(Continue reading)

Lorenzo Moneta | 4 Dec 2009 14:44
Picon
Picon

Re: [ROOT] Minuit Parabolic Errors Smaller than both Minos Errors?

Hi, 

The parabolic errors are correct only if your chi2 or log-likelihood function is a parabola around the
minimum. 
I have not fully understood which function you minimize in Minuit, but it is clear, if you have an asymmetric
one, the function is not anymore a parabola.  

Minos will give you correct errors, in the asymptotic approximation. See also
http://seal.web.cern.ch/seal/documents/minuit/mnerror.pdf    or if you have it , the F. James book
(Statistical methods in experimental physics, chapter 9.3 )

  Best Regards

 Lorenzo

On Dec 3, 2009, at 11:57 PM, Pierre-Luc Drouin wrote:

> Hi,
> 
> I was doing some tests to understand exactly how Minuit computes the parabolic errors vs the Minos errors
and I observed a strange result. Using my test, Minuit finds parabolic errors that are smaller than both
Minos errors for all the fit parameters:
> 
> FCN=1.10038e-14 FROM MINOS     STATUS=SUCCESSFUL    275 CALLS         363 TOTAL
>                    EDM=8.9213e-11    STRATEGY= 1      ERROR MATRIX ACCURATE
> EXT PARAMETER                  PARABOLIC         MINOS ERRORS        NO.   NAME      VALUE            ERROR      NEGATIVE      POSITIVE    1  x            1.23000e+02   7.26365e+00 
-1.30000e+01   2.60000e+01
>  2  y            5.73000e+02   4.78688e+01  -4.50000e+01   7.50000e+01
>  3  z            2.50000e+01   1.53528e+00  -3.00000e+00   5.00000e+00
>                              ERR DEF= 0.5
(Continue reading)

Pierre-Luc Drouin | 4 Dec 2009 16:19
Picon
Picon

Re: [ROOT] Minuit Parabolic Errors Smaller than both Minos Errors?

Hi,

what I am trying to do exactly is to float some parameters x,y,z to 
minimize the following function:

1/2*[ (x-x0)^2/sx(x)^2a + (y-y0)^2/sy(y)^2 + (z-z0)^2/sz(z)^2]

where

sx(x)= sxn when x<x0
and sx(x)= sxp when y>=y0

and where sy(y) and sz(z) are defined similarly.

I would expect the parabolic errors returned by Minuit to represent 
somehow an average between the asymmetric errors returned by Minos. 
Minos returns exactly the right asymmetrical errors, i.e. sxm, sxp, sym, 
syp, szm, szp. However, sometimes the parabolic error for x can be 
smaller than both sxm and sxp. This is what I find unexpected...

Thanks

Lorenzo Moneta wrote:
> Hi, 
>  
> The parabolic errors are correct only if your chi2 or log-likelihood function is a parabola around the
minimum. 
> I have not fully understood which function you minimize in Minuit, but it is clear, if you have an
asymmetric one, the function is not anymore a parabola.  
>
(Continue reading)

Marc Escalier | 6 Dec 2009 00:42
Picon
Picon

[ROOT] root : unbinned fit 1D

Dear root experts,

would somebody know how to proceed to do a unbinned fit of a TH1 histo ?

for example, lets consider
MyTH1Histo->Fit("gaus")

==>i wish to do this fit, but with a unbinned fit

thank you

(i will thank those who know in private to prevent spamming people)

Arthur E. Snyder | 6 Dec 2009 01:02
Picon
Favicon

Re: [ROOT] root : unbinned fit 1D

Hello Marc,

An unbinned fit to a histogram makes no sense. Presumably you mean you 
want to fit the data that is used to make the histogram w/o binning it.

I'm not sure if ROOT has a native unbinned fitter; you could use RooFit or 
you could write your own using minuit via TMinuit.

A likelihood fit to a finely binned histogram is more or less equivalent 
to an unbinned fit and ROOT does do that.

-Art S.

A.E. Snyder, Group EC                        \!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:650-926-2657                          Collaboration

On Sun, 6 Dec 2009, Marc Escalier wrote:

> Dear root experts,
>
> would somebody know how to proceed to do a unbinned fit of a TH1 histo ?
>
> for example, lets consider
> MyTH1Histo->Fit("gaus")
(Continue reading)

Elemer Nagy | 6 Dec 2009 01:49
Picon
Picon

Re: [ROOT] root : unbinned fit 1D


Hi Marc,

assuming that each of the N data points  x_i is independent: 
construct a likelihood L as a product of Gaussians from the datapoints and 
apply MINUIT to determine the Gaussian central value, c and (if needed) 
its sigma, s. It is more easy if you take the logarithm of the likelihood, 
in this case you deal with the sum of data:

- log L = Sum_i [(x_i-c)/s]**2/2 + N ln s

Even w/o MINUIT you can solve the fit equations:

     dL/dc = dL/ds = 0

which gives you (of course):

     c ~ c_f = 1/N Sum_i x_i
and 
     s ~ s_f = 1/N Sum_i (x_i - c_f)**2

Elemer

On Sun, 6 Dec 2009, Marc Escalier wrote:

Dear root experts,

would somebody know how to proceed to do a unbinned fit of a TH1 histo ?

for example, lets consider
(Continue reading)

Elemer Nagy | 6 Dec 2009 01:53
Picon
Picon

Re: [ROOT] root : unbinned fit 1D


There was a typo:

         s**2 ~ s_f**2 = 1/N Sum_i (x_i - c_f)**2

Elemer

On Sun, 6 Dec 2009, Elemer Nagy wrote:

Hi Marc,

assuming that each of the N data points  x_i is independent: 
construct a likelihood L as a product of Gaussians from the datapoints and 
apply MINUIT to determine the Gaussian central value, c and (if needed) 
its sigma, s. It is more easy if you take the logarithm of the likelihood, 
in this case you deal with the sum of data:

- log L = Sum_i [(x_i-c)/s]**2/2 + N ln s

Even w/o MINUIT you can solve the fit equations:

     dL/dc = dL/ds = 0

which gives you (of course):

     c ~ c_f = 1/N Sum_i x_i
and 
     s ~ s_f = 1/N Sum_i (x_i - c_f)**2

Elemer
(Continue reading)

Arthur E. Snyder | 6 Dec 2009 06:08
Picon
Favicon

Re: [ROOT] root : unbinned fit 1D

Marc,

Elemer's precription assumes you're fitting to a Gaussian PDF (probability 
density function) which is what I guess you wanted from the 
fit-to-histogram snipet you gave. Likeihood fits whether binned or 
unbinned are more general than that ... but Elemer's note shows what 
Gaussian unbinned likelihood would look like.

If I remember the syntax (maybe you should look it up) to do
a _binned_ likelihood fit you just need to do

h->Fit("gaus","L")

If the bins are small compared to the width of your Gaussian this should 
be just as good as an unbinned fit and essentially no work. There's 
nothing magic about unbinned fit that makes it better than binned unless 
the bins are too big.

-Art S.

A.E. Snyder, Group EC                        \!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:650-926-2657                          Collaboration

On Sun, 6 Dec 2009, Elemer Nagy wrote:
(Continue reading)

Lorenzo Moneta | 7 Dec 2009 08:29
Picon
Picon

Re: [ROOT] root : unbinned fit 1D

Hi, 
On Dec 6, 2009, at 1:02 AM, Arthur E. Snyder wrote:

> Hello Marc,
> 
> An unbinned fit to a histogram makes no sense. Presumably you mean you want to fit the data that is used to
make the histogram w/o binning it.
> 
> I'm not sure if ROOT has a native unbinned fitter; you could use RooFit or you could write your own using
minuit via TMinuit.

you can do an unbinned fit in ROOT  on a TTree. See TTree::UnbinnedFit 
(http://root.cern.ch/root/htmldoc/TTree.html#TTree:UnbinnedFit )

Lorenzo

> 
> A likelihood fit to a finely binned histogram is more or less equivalent to an unbinned fit and ROOT does do that.
> 
> -Art S.
> 
> A.E. Snyder, Group EC                        \!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:650-926-2657                          Collaboration
> 
(Continue reading)

Akira OKUMURA | 9 Dec 2009 06:07
Picon
Favicon

[ROOT] for loop from a shell script

Hello ROOTers,

Could anyone tell me how to execute this shell script properly? On my  
Mac, the root.exe process keeps running and occupy ~100% CPU load.

==============
#!/bin/bash

root -l <<EOF
for(int i=0; i<10; i++){
printf("%d\n", i);
}
.q
EOF
==============

[oxon <at> kusu ~]$ ./tmp.sh
end with '}', ' <at> ':abort > end with '}', ' <at> ':abort > 0
1
2
3
4
5
6
7
8
9 <= ROOT stops here

I know that the following change does work.

(Continue reading)


Gmane