An example of Poisson PDF implementation for Spey. This plug-in implements the following likelihood distribution:
where
These files are designed to be implemented as a plug-in for the spey interface and can be used as a template. Please see Spey's documentation for details on implementing different features.
This plug-in can be installed from GitHub with pip
python -m pip install --upgrade "git+https://github.com/SpeysideHEP/example-plugin"
or from the locally cloned repository
python -m pip install --upgrade .
Once this plug in is installed, the model can be used through Spey as follows
stat_wrapper = spey.get_backend('example.poisson')
stat_model = stat_wrapper(
signal_yields= np.array([12,15]),
background_yields = np.array([50.,48.]),
data=np.array([36,33])
)
Notice that the name of the accessor 'example.poisson'
is the same as in setup.py
and the class' name
attribute. The exclusion limit can be computed via the following command:
print(stat_model.exclusion_confidence_level())
# [0.9999807105228611]
Thats it! Have fun!