Plug-ins#
Keyword |
Summary |
---|---|
|
Combination of Poisson and Gaussian PDF, assuming uncorrelated bins. |
|
Combination of Poisson and Gaussian PDF, with correlated bins. |
|
Simplified likelihood, extended with third moments of the background. |
|
Simplified likelihood, extended with asymmetric uncertainties. |
|
|
|
|
|
|
|
External plug-in uses |
|
External plug-in constructs |
|
See doc. converts full |
Spey seamlessly integrates with diverse packages that offer specific statistical model prescriptions. Its primary objective is to centralise these prescriptions within a unified interface, facilitating the combination of different likelihood sources. This section will overview the currently available plugins accessible through the Spey interface. The string-based accessors to the available plugins can be seen using the following command:
>>> spey.AvailableBackends()
>>> # ['default_pdf.correlated_background',
>>> # 'default_pdf.effective_sigma',
>>> # 'default_pdf.third_moment_expansion',
>>> # 'default_pdf.uncorrelated_background']
where once installed without any plug-ins AvailableBackends()
function
only shows the default PDFs. In the following section, we will summarise their usability.
Once we know the accessor of the plug-in, it can be called using get_backend()
function e.g.
>>> pdf_wrapper = spey.get_backend('default_pdf.uncorrelated_background')
this will automatically create a wrapper around the likelihood prescription and allow spey to use it properly. We will demonstrate the usage for each of the default plugins below.
Note
Documentation of each plug-in has been included within the pdf_wrapper
documentation.
Hence, if one types pdf_wrapper?
in the ipython command line or a jupyter notebook, it is
possible to access the extended documentation for both the wrapper and the backend in use.
Attention
get_backend()
function is a wrapper between the PDF prescription and spey
package.
Once initialised, all PDF prescriptions are defined with StatisticalModel
class
which provides a backend agnostic interface, i.e. all PDF prescriptions will have the same functionality.
Default Plug-ins#
All default plug-ins are defined using the following main likelihood structure
The first term represents the primary model, and the second represents the constraint model.
'default_pdf.third_moment_expansion'
#
This plug-in implements the third-moment expansion presented in [3], which expands the the main model using the diagonal elements of the third moments
where \(\bar{n}_b^i,\ B_i,\ S_i\) and \(\rho\) are defined as
iterating over the same example, this PDF can be accessed as follows
1>>> pdf_wrapper = spey.get_backend("default_pdf.third_moment_expansion")
2>>> statistical_model = pdf_wrapper(
3... signal_yields=[12.0, 15.0],
4... background_yields=[50.0,48.0],
5... data=[36, 33],
6... covariance_matrix=[[144.0,13.0], [25.0, 256.0]],
7... third_moment=[0.5, 0.8],
8... analysis="example",
9... xsection=0.123,
10... )
and the exclusion limit, as before, can be computed as follows
>>> statistical_model.exclusion_confidence_level()
>>> # [0.9614329616396733]
As can be seen from the result, slight skewness generated by the third moment presented in the function reduced the exclusion limit.
Arguments:
signal_yields
: keyword for signal yields. It can take one or more values as a list or NumPy array.
background_yields
: keyword for background-only expectations. It can take one or more values as a list or NumPy array.
data
: keyword for observations. It can take one or more values as a list or NumPy array.
covariance_matrix
: Covariance matrix which captures the correlations and absolute uncertainty values of the background hypothesis. For absolute uncertainty \(\sigma_b\); \(\sigma_b = \sqrt{{\rm diag}(\Sigma)}\). The covariance matrix should be a square matrix and both dimensions should match the number ofbackground_yields
given as input.
third_moment
: Diagonal elements of the third moments. These can be computed usingcompute_third_moments()
function; however this function computes third moments using Bifurcated Gaussian, which may not be suitable for every case.
analysis
(optional): Unique identifier for the analysis.
xsection
(optional): Cross-section value for the signal hypothesis. Units determined by the user.
'default_pdf.effective_sigma'
#
The skewness of the PDF distribution can also be captured by building an effective variance from the upper (\(\sigma^+\)) and lower (\(\sigma^-\)) uncertainty envelops as a the function of nuisance parameters,
This method has been proposed in [4] for Gaussian models which can be generalised for the Poisson distribution by modifying \(\lambda_i(\mu, \theta)\) as follows
iterating over the same example, this PDF can be utilised as follows;
1>>> pdf_wrapper = spey.get_backend("default_pdf.effective_sigma")
2>>> statistical_model = pdf_wrapper(
3... signal_yields=[12.0, 15.0],
4... background_yields=[50.0,48.0],
5... data=[36, 33],
6... correlation_matrix=[[1., 0.06770833], [0.13020833, 1.]],
7... absolute_uncertainty_envelops=[(10., 15.), (13., 18.)],
8... analysis="example",
9... xsection=0.123,
10... )
where absolute_uncertainty_envelops
refers to each bin’s upper and lower uncertainty envelopes.
Once again, the exclusion limit can be computed as
>>> statistical_model.exclusion_confidence_level()
>>> # [0.8567802529243093]
Arguments:
signal_yields
: keyword for signal yields. It can take one or more values as a list or NumPy array.
background_yields
: keyword for background-only expectations. It can take one or more values as a list or NumPy array.
data
: keyword for observations. It can take one or more values as a list or NumPy array.
correlation_matrix
: The correlation matrix should be a square matrix, and both dimensions should match the number ofbackground_yields
given as input. If only the covariance matrix is available, one can usecovariance_to_correlation()
function to convert the covariance matrix to a correlation matrix.
absolute_uncertainty_envelops
: This is a list of upper and lower uncertainty envelops where the first element of each input should be the upper uncertainty, and the second element should be the lower uncertainty envelop, e.g., for background given as \({n_b}_{-\sigma^-}^{+\sigma^+}\) the input should be [(\(|\sigma^+|\), \(|\sigma^-|\))].
analysis
(optional): Unique identifier for the analysis.
xsection
(optional): Cross-section value for the signal hypothesis. Units determined by the user.
'default_pdf.poisson'
#
Simple Poisson implementation without uncertainties which can be described as follows;
It can take any number of yields.
1>>> pdf_wrapper = spey.get_backend("default_pdf.poisson")
2>>> statistical_model = pdf_wrapper(
3... signal_yields=[12.0, 15.0],
4... background_yields=[50.0,48.0],
5... data=[36, 33],
6... analysis="example",
7... xsection=0.123,
8... )
Arguments:
signal_yields
: keyword for signal yields. It can take one or more values as a list or NumPy array.
background_yields
: keyword for background-only expectations. It can take one or more values as a list or NumPy array.
data
: keyword for observations. It can take one or more values as a list or NumPy array.
analysis
(optional): Unique identifier for the analysis.
xsection
(optional): Cross-section value for the signal hypothesis. Units determined by the user.
'default_pdf.normal'
#
Simple Normal distribution implementation;
It can take any number of yields.
1>>> pdf_wrapper = spey.get_backend("default_pdf.normal")
2>>> statistical_model = pdf_wrapper(
3... signal_yields=[12.0, 15.0],
4... background_yields=[50.0,48.0],
5... data=[36, 33],
6... absolute_uncertainties=[20.0, 10.0],
7... analysis="example",
8... xsection=0.123,
9... )
Arguments:
signal_yields
: keyword for signal yields. It can take one or more values as a list or NumPy array.
background_yields
: keyword for background-only expectations. It can take one or more values as a list or NumPy array.
data
: keyword for observations. It can take one or more values as a list or NumPy array.
absolute_uncertainties
: absolute uncertainties on the background
analysis
(optional): Unique identifier for the analysis.
xsection
(optional): Cross-section value for the signal hypothesis. Units determined by the user.
'default_pdf.multivariate_normal'
#
Simple Normal distribution implementation;
It can take any number of yields.
1>>> pdf_wrapper = spey.get_backend("default_pdf.multivariate_normal")
2>>> statistical_model = pdf_wrapper(
3... signal_yields=[12.0, 15.0],
4... background_yields=[50.0,48.0],
5... data=[36, 33],
6... covariance_matrix=[[144.0,13.0], [25.0, 256.0]],
7... analysis="example",
8... xsection=0.123,
9... )
Arguments:
signal_yields
: keyword for signal yields. It can take one or more values as a list or NumPy array.
background_yields
: keyword for background-only expectations. It can take one or more values as a list or NumPy array.
data
: keyword for observations. It can take one or more values as a list or NumPy array.
covariance_matrix
: covariance matrix (square matrix)
analysis
(optional): Unique identifier for the analysis.
xsection
(optional): Cross-section value for the signal hypothesis. Units determined by the user.
External Plug-ins#
Useful links:
spey-fastprof
: TBA [6].