I am trying to fit some data with a negative binomial distribution (NBD). This works for distributions with low values of the k parameter (k<40), but as k increases the fit breaks down with the message,

<<
Warning in TH1F::Fit: Abnormal termination of minimization.
FCN=nan FROM MIGRAD STATUS=CALL LIMIT 5010 CALLS 5011 TOTAL
EDM=nan STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 nan 1.89397e+05 nan nan
2 p1 nan 1.13240e+01 nan nan
3 p2 nan 4.50000e+01 nan nan

If I go to the limit and use a Poisson fit, it works out fine. Are there any suggestions to get this fit to work properly over a larger range?

Thanks.

Here is the fit I’m defining:

TF1 fit1 = new TF1(“fit1”,"[0](TMath::Gamma(x+[1])/(TMath::Gamma(x+1)TMath::Gamma([1])))(TMath::Power(([2]/[1]),x))*(TMath::Power((1+([2]/[1])),-x-[1]))");

fit1->SetParameter(0,1.);// normalization constant
fit1->SetParameter(1,100); // k parameter
fit1->SetParameter(2,500.); // mean multiplicity

I have attached a sample of some data that I have been trying to fit, along with a small macro that reproduces what I have been seeing.

Thanks,

Terry[/quote]

Let me add, in the macro the first part demonstrates that the fit works for the low multiplicity distributions (lower k values), but in the second part breaks down at higher values.