Re: [ROOT] Pchi2 values

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Dec 20 2001 - 16:11:11 MET


Hi Agnes,

Agnes Lundborg wrote:
> 
> Hi
> 
> I am reading through the manuals and looking through the website. I find
> it very hard to find information about how the value determined by
> GetProb after a fit is defined. Is it the probability to get a value
> more extreme for chi2 if the model is correct, or is it the inverse?

If you proceed logically, this information should be straightforward to find.

TF1::GetProb is an inline function in TF1.h with the following definition:

   Double_t GetProb() const {return TMath::Prob(fChisquare,fNpfits-fNpar);} 

and if you look at TMath::Prob, it says:

Double_t TMath::Prob(Double_t chi2,Int_t ndf)
{
   // Computation of the probability for a certain Chi-squared (chi2)
   // and number of degrees of freedom (ndf).
   //
   // Calculations are based on the incomplete gamma function P(a,x),
   // where a=ndf/2 and x=chi2/2.
   //
   // P(a,x) represents the probability that the observed Chi-squared
   // for a correct model should be less than the value chi2.
   //
   // The returned probability corresponds to 1-P(a,x),
   // which denotes the probability that an observed Chi-squared exceeds
   // the value chi2 by chance, even for a correct model.

> 
> How are the fits being done? In one roottalk emails I found a line
> saying that the maximum likelihood was used for all fits. But that
> minimum chi2 assumed gaussian distribution and maximum likelihood
> assumed poissonian. Is there some explanation of this somewhere? Is the
> code to be found somewhere?

You have the choice when fitting between the normal "chisqaure method" (default)
and the loglikelihood (select it with option "L")
The chisqrae method is via the function H1FitChisquare.
The loglikelihood method via the function:
//______________________________________________________________________________
void H1FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t
flag)
{
//*-*-*-*-*-*Minimization function for H1s using a Likelihood method*-*-*-*-*-*
//*-*        =======================================================
//     Basically, it forms the likelihood by determining the Poisson
//     probability that given a number of entries in a particular bin,
//     the fit would predict it's value.  This is then done for each bin,
//     and the sum of the logs is taken as the likelihood.

> What is the GetProb value if the fit has been max likelihood?

In case of a likelihood fit, the function TH1::Fit computes 
an "Equivalent Chisquare" by computing the sum of the square of residuals
using the parameters computed by the likelihood method.

> 
> How are the errors estimated?

TH1::Fit uses the class TMinuit.
See: http://root.cern.ch/root/htmldoc/TMinuit.html

look at section: Interpretation of Parameter Errors:

> 
> If the histogram is to sparse, what happens? Is it possible to rebin
> parts of the histogram? What fitting method should be used then?

The likelihood method is interesting in case of low statistics. Rebinning
will not help.

> 
> Merry Christmas.

Merry Christmas to you too

Rene Brun

> Agnes



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:13 MET