Fit with a linear function and get a parabole, why?

I have the following example (TestLinear.C) of simple program:
(a) given a p.d.f. parabole, generate a distribution of data
(b) fit the distribution generated in (a) with linear function

When I plot (b) I get a curve that looks like a parabole. Why ?



In your macro you are plotting the parabolic function and not the fitted one.
Also since you are using RooFit for just a simple function you have to be careful of this:

  • by using just fitTo the likelihood fit is not extended and therefore the pdf is normalized. A linear pdf normalized has only one free parameter, since the normalization is fixed. You should then use an extended
    unbinned likelihood fit if you want to have floating both parameters. You can do this by adding the relevant option in fitTo, but you need to define your pdf as extended.
    Alternatively you can do a binned Poisson fit or a chi2 fit. If you are using just ROOT you can also do
    linear least square fit for this simple problem.

Best Regards