Likelihood fit of y(x)

Hi,
I am sorry for my question. Is it possible to make a Likelihood fit of the variables y vs x when the y axis does not represent counts?
Thanks a lot!

Hi,

If you know the probability distributions of observing a y giving x, P(y|x) then it is possible.
Like in case of counts we have for each observation y , we assume that y is Poisson( y | f(x,p) ), where
f(x,p) is a model function given the expected counts for a given x and some parameters p that needs to be estimated by the fit

Lorenzo

Hi Lorenzo,
Many thanks for your reply.

Does that implies to perform a 2D likelihood fit, where the fit function is the pdf of x and y ( f(x,y|p) )?

In my problem I have a TGraphErrors of the cross-section “y” vs phi “x” where the fit function is y_model = f(x).

  1. I tried using Binned Fitter::LikelihoodFit but I get the parameter errors to be extremely large, even if using SetErrorDef(0.5).
  2. Is it correct to do the likelihood fit by minimizing the Baker-Cousins sum for every x point using TMinuit, something like:
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t par[], Int_t iflag){
    Double_t nll = 0.0;
    for (int i=0; i<no_of_points; i++){
      /* some code to get y_model(x[i]) and y[i] for each point and the fitting parameters*/
       nll = nll + y_model(x[i]) - y[i] + y[i]*TMath::Log(y[i]/y_model(x[i]));
    }
 f = 2*nll;
 }

Can I do any of this even if I don’t have a PDF? I just have one value of the cross-section for each phi.
Many thanks for the clarifications,
Lily

Hi,

If y represents counts you can use the Baker-Cousins methods to perform a likelihood fit. distribution of observing y is a Poisson distribution.If you have weighted counts you can use a weighted likelihood fit . These two cases are implemented in ROOT if you do TH1::Fit with option L or 'LW` (weighted case).
If you have a TGraph you can early convert in an histogram if needed.

You can also use Fitter::LikelihoodFit (it is used anyway by TH1::Fit). If the error are very large, maybe it is because you have a weighted fit ?

But if y does not represent counts, you need to know its distribution. In the majority of case you can do a least square (chi-square) fit, which is also a maximum likelihood fit if the distribution of y is assumed to be normal. Your case, a cross-section value for each phi, looks to me a case for a chi-square fit.
So you can just use TGraphErrors::Fit

Lorenzo

Hi,

Thanks for your replies, they have been very helpful. Could I just ask if you could point me out an example of a 1d Likelihood fit of Y vs X where Y does not represent counts if you know its distribution? I can just find likelihood fits to PDFs.

Best regards,

Lily

Hi,
As I said every chi-square fit, as those in TGraphErrors::Fit with option “EX0” (no error in X) is a likelihood 1d fit where the Pdf in each point is a normal distribution Gauss( y, f(x), sigma(y) ), where y is the observed y value, f(x) is the expected value given by the model function f(x) and sigma(y) is the error in y.

Lorenzo

Hi,
Yes, thanks a lot, but I would like it to assume that the Pdf in each point is a Poisson distribution instead.
Thanks,
Lily