Re: [ROOT] How to access Log-Likelihood-value?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jul 04 2000 - 16:51:05 MEST


Hi Tilmann,

Look at the short example below:
amin is 2*(log likelihood) (see function H1FitLikelihood in class TH1)

chi2 is the sum of squares of residuals after the fit. Should be the chisquare
if the chisquare method had been used.

Rene Brun


void lhood()
{
   TH1F *h = new TH1F("h","h",100,-4,4);
   h->FillRandom("gaus",100);
   h->Fit("gaus","l");
      
   TVirtualFitter *fitter = TVirtualFitter::Fitter(h);
   Double_t amin,edm,errdef;
   Int_t nvpar,nparx;
   fitter->GetStats(amin,edm,errdef,nvpar,nparx);
   Double_t chi2 = h->GetFunction("gaus")->GetChisquare();
   printf("amin=%g, chi2=%g\n", amin, chi2);
}


Tilmann Colberg wrote:
> 
> Hi,
> 
> having used the least square fit method TH1::fit() one can access the
> chi2 afterwards with TF1::GetChisquare(). Is there any way of getting the
> value for the Log Likelihood if I use the binned likelihood fit with the
> option "L"?
> 
> If I get the likelihood value with TF1::GetChisquare() for the "L"-case
> as well, is the value I am accessing the logL or the 2logL or even
> something else?
> 
> Thanks in advance,
> 
> Til



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET