Hi Michael, Hmm, looking at your output I think I might understand what's going on. I am a little surprised that minos didn't find good values for the errors, but only a little. If you look at the function values that FCN is returning, it's really taking Minuit about 9-10 calls to locate the minimum. However, your chi^2 function has a discontinunity near the minimum, on a really small scale. You see lots of returned values of about 100.0286 or about 100.0296. You could learn more by also printing out the free parameter values on each call, presumably on the same line. Then you could copy and paste the data near the minimum into a file and plot the chi^2 with some simple plotter like gnuplot against the various different fit parameters. On a fine scale you'll see the discontinuity, presumably in alpha_q. This throws off Minuit's derivative calculation. Speaking of which, I tend to disagree with Eddy's proscription of giving Minuit derivatives. Yes, in theory that's a very nice thing to do, but if you have to compute it yourself through finite differences, then you're better off leaving it to Minuit. I have never given Minuit derivatives before because I've never encountered a case where it's practical. I can think of two ways to address your problem. One is to find the source of the discontinuity (a roundoff of some sort) and repair it. It's likely to be some element in your chi^2 that is not computed with much accuracy. Yes, Minuit does everything in double precision. For example, I've had some problems using Cernlib's PROB function, which is only accurate to 10^-6 I think, and therefore has problems when I'm out in the tails. To alieviate this somewhat, I've cooked up my own asymptotic form that works better in the tails and gives a smoother chi^2 or likelihood. There are probably better options here as well, but the gist of this is to make sure your chi^2 is computed accurately at each step. The other solution is more to the point -- telling Minuit not to worry about these small-scale details. Your fit errors don't need to be accurate to more than a couple percent anyway, I guess, so Minuit doesn't need to worry about these .1% fluctuations. A difference in chi^2 of 1 is, of course, what defines a 1-sigma errorbar. Now, I've had varying success with the "SET EPS" command in Minuit, but supposedly that's what you use to tell Minuit what your accuracy is. How do you do this from TMinuit? I'm not sure, but it looks like mnexcm() is what you need. The command would be "SET EPS", and the first argument should be your chi^2 precision, presumably .001 or .01. See also: http://wwwasdoc.web.cern.ch/wwwasdoc/WWW/minuit/minmain/chapter2_8.html#SECTION0081000000000000000 In addition to this, you will also want to try and give minuit accurate initial error estimates. Minuit is very forgiving in this respect, but if it's a few orders of magnitude off and your chi^2 function has small-scale irregularities, it may have problems finding the minimum. But in your example case it's finding the minimum very fast, so I don't think this is the problem here. Hope this helps! - Topher Cawlfield Michael Groys wrote: > Hi, > Thank you a lot for your responses. > (I attached at the of the mail output of the minimization) > > Rene: > I'm not using fit method of histogram but rather I created > another class that derives from TMinuit and implements > Eval() method. Actually I calculate chi2 for a set of data > points (it is function of 3 variables). My theoretical function > is also precompiled. So it is a lot of staff. > > Eddy: > You are right - I didn't provide expressions for the derivatives. > But I checked and found that FLAG argument that I get from TMinuit is > always 4. So as I understood that means that I don't have to calculate > derivative by myself. Actually my function is such that calculation of > the derivative can be done only by calculating difference between > values > of function in 2 points so I can't get any increase in efficiency. > I tried, as you proposed to fit one variable at a time. I found that > for > some variables it goes well, but there are also variables that when I > fit over them I get message that minuit hasn't converged. > When I take a look into the dependence of my function over this > variable > I saw nice parabola. So I don't understand why minuit can't converge. > > Topher: > I get acceptable values of parameters that provide me good fit: > chi2/d.o.f. ~ 1. > I tried TMinuit::mnmnos() but it also produces strange results for > the case, when minuit hadn't converged > > Thanks again, > Michael > > By the way do you know whether minuit calculations are performed in > double > or float? > > Outputs from minuit: > I plot chi2 value (for 106 data points) at each call to FCN > Fit over one parameter: > ********** > ** 49 **MIGRAD 0 > ********** > FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4. > chi2 = 116.8452121 > START MIGRAD MINIMIZATION. STRATEGY 1. CONVERGENCE WHEN EDM > .LT.1.00e-004 > chi2 = 112.8304752 > chi2 = 121.4137524 > chi2 = 116.4152386 > chi2 = 117.2808747 > FCN=116.845 FROM MIGRAD STATUS=INITIATE 4 CALLS 1027 > TOTAL > EDM= unknown STRATEGY= 1 NO ERROR MATRIX > EXT PARAMETER CURRENT GUESS STEP FIRST > NO. NAME VALUE ERROR SIZE DERIVATIVE > 1 alpha_P 1.13789e+000 fixed > 2 A_q 1.18733e-001 fixed > 3 alpha_q 4.00000e-001 3.00000e-001 2.72826e-001 -1.58643e+003 > 4 beta_q 2.52095e-001 fixed > 5 A_g 5.04505e+000 fixed > 6 B_g 0.00000e+000 fixed > 7 C_g 0.00000e+000 fixed > 8 alpha_g 2.60796e-001 fixed > 9 beta_g 5.06243e+000 fixed > chi2 = 100.047337 > chi2 = 100.0459711 > chi2 = 100.0487562 > chi2 = 100.0296461 > chi2 = 100.0296242 > chi2 = 100.0285205 > chi2 = 100.0296377 > chi2 = 100.0296565 > chi2 = 100.0296242 > chi2 = 100.0285206 > chi2 = 100.0309483 > chi2 = 100.0288064 > chi2 = 100.0287682 > chi2 = 100.0288466 > chi2 = 100.0286392 > chi2 = 100.0290218 > chi2 = 100.0286732 > chi2 = 100.0296244 > chi2 = 100.0286282 > chi2 = 100.0296242 > chi2 = 100.0284769 > chi2 = 100.0296242 > chi2 = 100.0296367 > chi2 = 100.0296519 > chi2 = 100.0296617 > chi2 = 100.0296285 > chi2 = 100.0285707 > chi2 = 100.0296605 > chi2 = 100.0284915 > chi2 = 100.0284742 > chi2 = 100.0284797 > chi2 = 100.0296242 > chi2 = 100.028472 > chi2 = 100.0296463 > chi2 = 100.0285018 > chi2 = 100.0296632 > chi2 = 100.0284773 > chi2 = 100.0284709 > chi2 = 100.0284731 > chi2 = 100.0296242 > chi2 = 100.0296638 > chi2 = 100.0284717 > chi2 = 100.0296578 > chi2 = 100.0284834 > chi2 = 100.0284696 > chi2 = 100.028474 > chi2 = 100.029649 > chi2 = 100.0284964 > chi2 = 100.0284719 > MIGRAD FAILS TO FIND IMPROVEMENT > chi2 = 100.0284717 > chi2 = 100.029649 > chi2 = 100.0284964 > chi2 = 100.0284687 > chi2 = 100.0284749 > chi2 = 100.0284711 > chi2 = 100.0284724 > COVARIANCE MATRIX CALCULATED SUCCESSFULLY > FCN=100.028 FROM HESSE STATUS=OK 7 CALLS 1083 > TOTAL > EDM=2.0178e-007 STRATEGY= 1 ERROR MATRIX > ACCURA > EXT PARAMETER STEP FIRST > NO. NAME VALUE ERROR SIZE DERIVATIVE > 1 alpha_P 1.13789e+000 fixed > 2 A_q 1.18733e-001 fixed > 3 alpha_q 4.26089e-001 4.36058e-004 8.66270e-006 -2.54241e+000 > 4 beta_q 2.52095e-001 fixed > 5 A_g 5.04505e+000 fixed > 6 B_g 0.00000e+000 fixed > 7 C_g 0.00000e+000 fixed > 8 alpha_g 2.60796e-001 fixed > 9 beta_g 5.06243e+000 fixed > chi2 = 100.0284713 > chi2 = 100.0284697 > chi2 = 100.0296622 > chi2 = 100.0296641 > chi2 = 100.0284688 > chi2 = 100.0296641 > chi2 = 100.0284683 > chi2 = 100.0296641 > chi2 = 100.028468 > chi2 = 100.0296642 > chi2 = 100.0296603 > chi2 = 100.0284724 > chi2 = 100.0296633 > chi2 = 100.0284691 > chi2 = 100.0284717 > chi2 = 100.0284699 > chi2 = 100.0284689 > chi2 = 100.0284685 > chi2 = 100.0284683 > MIGRAD FAILS TO FIND IMPROVEMENT > MIGRAD TERMINATED WITHOUT CONVERGENCE. > FCN=100.028 FROM MIGRAD STATUS=FAILED 79 CALLS 1102 > TOTAL > EDM=0.0596531 STRATEGY= 1 ERROR MATRIX > UNCERTAINTY > 0 per cent > EXT PARAMETER APPROXIMATE STEP FIRST > NO. NAME VALUE ERROR SIZE DERIVATIVE > 1 alpha_P 1.13789e+000 fixed > 2 A_q 1.18733e-001 fixed > 3 alpha_q 4.26090e-001 5.70152e-005 0.00000e+000 1.38237e+003 > 4 beta_q 2.52095e-001 fixed > 5 A_g 5.04505e+000 fixed > 6 B_g 0.00000e+000 fixed > 7 C_g 0.00000e+000 fixed > 8 alpha_g 2.60796e-001 fixed > 9 beta_g 5.06243e+000 fixed > EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 1 ERR DEF=1 > 3.251e-009 > ERR MATRIX APPROXIMATE > > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET