Replies: 1 comment 2 replies
-
@yasaman-h This is covered in the Introduction to HistFactory Models section of the pyhf User Guide, but the observations are a required argument, so to get what you'd like, you would need to just set the To do this programatically you would do something like the following, given the example you linked import pyhf
pyhf.set_backend("numpy")
model = pyhf.simplemodels.uncorrelated_background(
signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0]
)
bkg_pars = model.config.suggested_init()
bkg_pars[model.config.poi_index] = 0 # set the poi value to 0
bkg_only_obs = model.expected_actualdata(bkg_pars)
data = bkg_only_obs.tolist() + model.config.auxdata
test_mu = 1.0
CLs_obs, CLs_exp = pyhf.infer.hypotest(
test_mu, data, model, test_stat="qtilde", return_expected=True
)
print(f"Observed: {CLs_obs:.8f}, Expected: {CLs_exp:.8f}")
# Observed: 0.06600882, Expected: 0.06600882 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear experts,
Thanks to the pyhf team for providing this package!
In the first example provided here:
https://pyhf.readthedocs.io/en/v0.7.6/#:~:text=pyhf%20tutorial.-,Hello%20World,-%EF%83%81
is there a method to determine the expected CLs (CLs_exp) only based on the signal and background, without requiring the data?
Beta Was this translation helpful? Give feedback.
All reactions