Hi Alexander, On Mon, 8 Jul 2002, Alexander Dietz wrote: > Hello Rooters, > > I want to understand how the fitting is done in ROOT. When I am fitting > data to a model I use the Maximum Likelihood fitting method (i.e. > 'H1FitLikelihood' in TH1.cc). > > 1. What is the mathematical background of this fitting method? Can > somebody give me the formula(s)? And uses it Gaussian or Poisson > statistics? And if yes, is it possible to change it? The comments in H1FitLikelihood say: // 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. The code is trivial. Look at the statements: icu = Int_t(cu); fsub = -fu +icu*TMath::Log(fu); fobs = hFitter->GetSumLog(icu); where cu is the bin content fu is the value of the function at the center of the bin GetSumLog is a function returning the sum of the logs from a precomputed table. > > 2. It should be possible to specify a user-defined fitting function using > 'TVirtualFitter::Fitter(myhist)->SetFCN(MyFittingFunction)'. But how must > this function made of? How must it work? What is the meaning of the > parameters in 'extern void MyFittingFunction(Int_t &npar, Double_t *gin, > Double_t &f, Double_t *u, Int_t flag);'? Yes, you can specify a user fitting model (via option "U"). See comments in TH1::Fit on how to do it. The interface SetFCN is based on the MINUIT interface. See more details at: http://wwwinfo.cern.ch/asdoc/minuit/minmain.html http://wwwinfo.cern.ch/asdoc/minuit/node14.html Rene Brun > > Thanks much in advance for helping me, > > A. Dietz > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET