Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastlikelihood fitting and inconsistent Chi square value #233

Open
Md-Isha-Ali opened this issue Aug 17, 2023 · 1 comment
Open

Fastlikelihood fitting and inconsistent Chi square value #233

Md-Isha-Ali opened this issue Aug 17, 2023 · 1 comment

Comments

@Md-Isha-Ali
Copy link

Md-Isha-Ali commented Aug 17, 2023

Dear Experts,

Theoretically chi square cannot have negative value . But When I tried to minimize the chi square function defined as -2*log_likelihood_function , I got negative value.
I have used the available code in the website which I am writing below for better understanding . I am confused why chi square is negative ?
------------------------------------------------------------------------code---------------------------------------------------
FL = FastLikelihood(name='My fast likelihood',
observables=['BR(B->Xsgamma)', 'BR(Bs->mumu)', 'BR(B0->mumu)'],
include_measurements=['AS combination Bs->mumu 2021', 'B->Xgamma WA 2017'])

FL.make_measurement(N=1000, threads=8, force=True)

from wilson import Wilson

par = flavio.parameters.default_parameters.get_central_all()

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

print(FLL([0.0023,0.48]))

from flavio.math.optimize import minimize

def chi2(x):
return -2*FLL(x)

chi2_min = minimize(chi2,[0,0])
chi2_min

Results:
message: Optimization terminated successfully.
success: True
status: 0
fun: -105.37189937874699
x: [ 2.361e-03 4.813e-01]
nit: 7
jac: [-9.537e-07 -2.861e-06]
hess_inv: [[ 1.544e-04 -3.627e-05]
[-3.627e-05 2.791e-02]]
nfev: 33
njev: 11


Also likelihood is a multiplication of probability density function where each density function integral value can be maximum 1 . So any likelihood function would have value in range [0,1] and hence log_likelihood have values [-infinity,0] . I have no clue what is happening .
The 'fun' value is chi2_min value and to mention at minimum FLL value is 52 which is inconsistent with my theoretical understanding

Please guide me regarding this .

regards,
Md Ali

@Md-Isha-Ali Md-Isha-Ali changed the title Fastlikelihood fitting and incosistent Chi square value Fastlikelihood fitting and inconsistent Chi square value Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Md-Isha-Ali and others