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

Would like to scan for staterror #410

Open
Tomoya-Iizawa opened this issue Jun 12, 2023 · 3 comments
Open

Would like to scan for staterror #410

Tomoya-Iizawa opened this issue Jun 12, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Tomoya-Iizawa
Copy link

Tomoya-Iizawa commented Jun 12, 2023

I would like to see the likelihood scan distribution for staterror by cabinetry.fit.scan function, but it does not work.
Does it work only for NormFactors defined in the yml file, or is there any way to check staterror?

I checked it works for the NormFactors defined in the yml file.
Also it seems that staterror parameters are added to modifier, as seeing the log
INFO - pyhf.pdf - adding modifier staterror_HighMassOSs2thh_1bjets (3 new nuisance parameters)
but it fails with error as
ValueError: parameter staterror_HighMassOSs2thh_1bjets not found in model

Could you give me some advice for this?

Tomoya

@alexander-held alexander-held added the question Further information is requested label Jun 12, 2023
@alexander-held
Copy link
Member

Hi Tomoya, the likelihood scan also works for other parameters but this specific case is a bit more tricky to set up. The modifiers staterror (as well as shapesys and shapefactor in pyhf) independently act on every bin in the channels to which they are attached. This means that in your example

INFO - pyhf.pdf - adding modifier staterror_HighMassOSs2thh_1bjets (3 new nuisance parameters)

this channel HighMassOSs2thh_1bjets has three bins and there are actually going to be three independent parameters being created. These parameters will have the respective bin attached to the end of the name, resulting in parameters called staterror_HighMassOSs2thh_1bjets[0], staterror_HighMassOSs2thh_1bjets[1], staterror_HighMassOSs2thh_1bjets[2]. This naming scheme is a convention adopted in pyhf and you can access all names of parameters for reference via model.config.par_names (for a given model) or also from the .labels property in the object returned by cabinetry.fit.fit. The names are also shown in the printed values after running this function (assuming you set a corresponding log level, for example via cabinetry.set_logging()). By using these names you can perform the scan via cabinetry.fit.scan in the same way as with other parameters.

This is all perhaps not very intuitive so I am thinking what we could do to improve this, any suggestions are welcome here. One thing that should be fairly easy to add is a function that checks for this specific case where the bin information via [i] is missing and informs the user that it is required for these specific parameters.

@Tomoya-Iizawa
Copy link
Author

Thank you for your advice, I tried staterror_HighMassOSs2thh_1bjets[i] and it works.

@alexander-held
Copy link
Member

Glad to hear it is working! I'll leave this issue open for now as a reminder to catch this particular issue with a more helpful error message in cabinetry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants