JelleAalbers / blueice

Build Likelihoods Using Efficient Interpolations and monte-Carlo generated Events
BSD 3-Clause "New" or "Revised" License
9 stars 9 forks source link

explicit unconditioned bf and -2llhr instead of just -llhr #39

Open plt109 opened 1 year ago

plt109 commented 1 year ago

Changes and motivation The changes in this pull request and their associated motivations are:

  1. Explicitly computes the loglikelihood value at the unconditioned bestfit instead of just taking the max loglikelihood available in the scan range of the target parameter the user requested. In this way, even if the unconditioned bestfit is not within the scan range set by the user, the loglikelihood ratio will not be wrong.
  2. Plots the -2 log likelihood ratio instead of the -log likelihood ratio so that it is easier to see if the resulting limit(s) is/are cutting at the anticipated values. Wilks' theorem said that under certain asymptotic and regularity conditions, the -2log likelihood ratio follows the chi2 distribution of the appropriate number of degrees of freedom. Perhaps it is just convention but usually the critical value is for the -2 log likelihood ratio test statistic instead of the - log likelihood ratio test statistic and it would be easier for the user to overlay the profiled loglikelihood ratio and the critical value as a function of the target parameter if the y-axis is -2 loglikelihood ratio instead. m2llhr

Testing The unit test that involves plot_likelihood_ratio was commented out because 'For now just test that it doesn't crash -- image comparison tests are tricky...'. To ensure that there are no breaking changes, the plot in the tutorial notebook was reproduced (but with -2 log likelihood ratio instead): image The first plot in this PR was also plotted using plot_likelihood_ratio from this commit.