flav-io / flavio

A Python package for flavour physics phenomenology in the Standard model and beyond
http://flav-io.github.io/
MIT License
71 stars 62 forks source link

Method to count SM discrepancy in terms of sigmas #134

Closed dlanci closed 3 years ago

dlanci commented 3 years ago

Dear Mantainer(s),

I am new to the flav.io package and I'm currently performing fast likelihood fits of WC. As far as I understand, the WCs that one calls by:

from wilson import Wilson par = flavio.parameters.default_parameters.get_central_all()

def FLL(x): Re_C9, Re_C10 = x w = Wilson({'C9_bsmumu': Re_C9, 'C10_bsmumu': Re_C10}, scale=4.8, eft='WET', basis='flavio') return FL.log_likelihood(par, w)

are the NP ones, is it correct? After having performed the fit and drawn the fpl.likelihood_contour_data plot, Is there a predefined method to extract the #of sigmas the best fit point is away from the [0,0] in the Re_C9NP and Re_C10NP space?

Thanks in advance, Davide

peterstangl commented 3 years ago

@dlanci, it is correct that the WCs are the NP ones.

In order to get a pull in units of sigma, you can use the function flavio.statistics.functions.pull (see the API documentation), which takes a chi^2 difference and the number of degrees of freedom. The chi^2 difference is simply -2 times the log-likelihood difference. So you just have to compute the log-likelihood at the SM point [0,0] and at the best-fit point, convert the difference into a chi^2 difference and then plug it into the pull function.

dlanci commented 3 years ago

Thank you very much for the prompt answer! Davide

dlanci commented 3 years ago

So I guess something of the kind:

flavio.statistics.functions.pull(-2*(FLL(fitdot)-FLL(sm)), 1)

peterstangl commented 3 years ago

Yes, just that your likelihood function depends on two parameters, so dof should be 2.

dlanci commented 3 years ago

Got it. I was getting zero because the first arg of pull was < 0 with dof = 2. Solved.

Thank you so so much. Davide

peterstangl commented 3 years ago

You are welcome! Since this is solved, I'll close the issue.