Fit dependence on scaling

The code below gives the following results for the fit.

The result on the parameter I am interested in (p0) seems to depend on the scaling of the histogram. The uncertainty is especially affected. Is there any way to eliminate this dependence? It seems the fit is not using the sum of weights information?

FCN=479.114 FROM MIGRAD STATUS=CONVERGED 127 CALLS 128 TOTAL EDM=5.83227e-06 STRATEGY= 1 ERROR MATRIX ACCURATE EXT PARAMETER STEP FIRST NO. NAME VALUE ERROR SIZE DERIVATIVE 1 p0 1.50677e+00 7.95085e-03 8.51393e-05 6.03274e-02 2 p1 7.50069e+02 3.35441e+00 3.58871e-02 -1.00807e-03 FCN=40.3398 FROM MIGRAD STATUS=CONVERGED 38 CALLS 39 TOTAL EDM=0 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 100.0 per cent EXT PARAMETER APPROXIMATE STEP FIRST NO. NAME VALUE ERROR SIZE DERIVATIVE 1 p0 1.47044e+00 9.50993e-05 2.73655e+00 3.02586e+08 2 p1 -3.70608e+07 3.18227e+02 -3.70616e+07 0.00000e+00

[code]{
TF1 dist = new TF1( “dist”, "[1](1+x^2+[0]*x)", -1, 1 );
TH1D *hist = new TH1D( “hist”, “hist”, 50, -1, 1 );

hist->Sumw2();

dist->SetParameters( 1.5, 1 );
hist->FillRandom( "dist", 50000 );

hist->Fit("dist", "LL 0");

hist->SetLineColor( kRed );

TCanvas *c1 = new TCanvas();
c1->Divide(2); 

c1->cd(1); hist->Draw();

c1->cd(2);
TH1D *dup = dynamic_cast<TH1D *>(hist->Clone("dup"));

dup->Scale( 1. / dup->Integral() );
dup->Fit("dist", "LL");
dup.Draw();

}[/code]

Minuit fails in the scaled fit (the value of the second parameter is totally wrong). It needs to be investigated.
I have tried with Minuit2 and it works fine. For using Minuit2 just add the following line before fitting:

TVirtualFitter::SetDefaultFitter("Minuit2");

Regards

Lorenzo

This still doesn’t do quite what I expect - but maybe my expectations are wrong:

[code]root [1] .x test.C
Warning in TH1::Build: Replacing existing histogram: hist (Potential memory leak).

of function calls: 108

function Value: -613065.177919
expected distance to the Minimum (edm): 4.1652682e-07
fitted parameters:

ext. || Name || type || Value || Error +/-

0 || p0 || free || 1.502156 ||0.0079677602
1 || p1 || free || 750.07651 || 3.3544417

of function calls: 249

function Value: 9.37825301044
expected distance to the Minimum (edm): 8.2006654e-12
fitted parameters:

ext. || Name || type || Value || Error +/-

0 || p0 || free || 1.5021608 || 1.7991334
1 || p1 || free || 0.015001495 || 0.01534598
[/code]

Somehow I hope that the uncertainty on the second fit parameter 0 should be the same as the uncertainty on the first fit parameter 0? i.e. 1.502156 +/- 0.0079677602 ?

This is expected, because, when doing a Poisson likelihood fit you should not scale the histograms. A scaling factor will not influence the resulting value, but it will change the resulting error, since the rule DeltaL=1 (or 0.5) is not valid anymore. You should then scale also the DeltaL value.

If you use a simple least-square fit, you will get the same error in both cases.

Lorenzo

Is it possible then to compute an accurate uncertainty for weighted events? The problem is as follows: We have MC simulations for different mass regions, with different luminosities. They are weighted to give a continuous mass spectrum. The graph we are fitting to is a distribution of theta in a given mass bin. Then we take a bin in (smeared) mass, so we have events with different weights ending up in this bin. Is there a sensible way to compute the uncertainty on this parameter (0)?

[edit] sorry, spoke in jargon. Edited for clarity.

You can estimate the error in the single bin, by using the sum of the square of all the weights ending-up in the bin and then doing a least square fit.
If you want to do a likelihood fit, I think there exist some way for handling the weights. Something is described in the Statistics books from F. James

worldscibooks.com/physics/6096.html

Lorenzo

Yes, it needs to be a likelihood fit unfortunately, since there is a nice trick to measure asymmetry without knowledge of detector acceptence.

Thanks for your help.