SpeysideHEP / spey

Smooth inference for reinterpretation studies
https://spey.readthedocs.io
MIT License
7 stars 1 forks source link

The minima of the Asimov negloglikelihood is not centralised at `poi_test = 0` #4

Closed jackaraz closed 1 year ago

jackaraz commented 1 year ago

System Settings

Describe the bug

In the simplified likelihood backend, the minima of the $-\log\mathcal{L}$ distribution is not centralised at $\hat\mu=0$.

To Reproduce

import madstats, json

with open("cms_sus_19_006_T6_MQ3_1400.0_M2_600.0.txt", "r") as f:
    data = json.load(f)

current_sl_model = madstats.get_multi_region_statistical_model(
        signal= data["signal"], observed=data["observed"], nb=data["background"], covariance=data["cov_matrix"],delta_sys=0., xsection=0.000386175999, analysis="cms_sus_19_006"
)

muhatA_sl, minnllA_sl = current_sl_model.maximize_likelihood(return_nll=True, allow_negative_signal=True, isAsimov=True)
muhat_sl, minnll_sl = current_sl_model.maximize_likelihood(return_nll=True, allow_negative_signal=True, isAsimov=False)
print(muhatA_sl) # 0.3740630890807138

poi_test = np.linspace(current_sl_model.backend.model.minimum_poi_test, 5, 10)
nllA_sl = [current_sl_model.likelihood(poi_test=m, return_nll=True, isAsimov=True) for m in poi_test]
nll_sl = [current_sl_model.likelihood(poi_test=m, return_nll=True) for m in poi_test]

Screenshot 2023-01-29 at 10 03 46 am

cms_sus_19_006_T6_MQ3_1400.0_M2_600.0.txt

Expected behaviour

I was expecting $\hat\mu_A \simeq 0$.

Additional information

@APMDSLHC could you confirm this on your side as well? Thanks!

jackaraz commented 1 year ago

This has been resolved with the latest updates.