spey.backends.default_pdf.UncorrelatedBackground

spey.backends.default_pdf.UncorrelatedBackground#

class spey.backends.default_pdf.UncorrelatedBackground(signal_yields: List[float], background_yields: List[float], data: List[int], absolute_uncertainties: List[float], signal_uncertainty_configuration: Dict[str, Any] | None = None)[source]#

Interface for uncorrelated background uncertainties. This simple backend is designed to handle single or multi-bin statistical models with uncorrelated uncertainties. Inputs has to be given as list of NumPy array where each input should include same number of regions. It assumes absolute uncertainties on the background sample e.g. for a background sample yield reported as \(3.1\pm0.5\) the background yield is 3.1 and the absolute uncertainty is 0.5. It forms a combination of normal and poisson distributions to from the input data where the log-probability is computed as sum of all normal and poisson distributions.

Parameters:
  • signal_yields (List[float]) – signal yields

  • background_yields (List[float]) – background yields

  • data (List[int]) – observations

  • absolute_uncertainties (List[float]) – absolute uncertainties on the background

  • signal_uncertainty_configuration (Dict[Text, Any]], default None) –

    Configuration input for signal uncertainties

    • absolute_uncertainties (List[float]): Absolute uncertainties for the signal

    • absolute_uncertainty_envelops (List[Tuple[float, float]]): upper and lower

      uncertainty envelops

    • correlation_matrix (List[List[float]]): Correlation matrix

    • third_moments (List[float]): diagonal elemetns of the third moment

Note

Each input should have the same dimensionality, i.e. if data has three regions, signal_yields, background_yields and absolute_uncertainties inputs should have three regions as well.

Example:

>>> import spey
>>> stat_wrapper = spey.get_backend('default_pdf.uncorrelated_background')

>>> data = [1, 3]
>>> signal = [0.5, 2.0]
>>> background = [2.0, 2.8]
>>> background_unc = [1.1, 0.8]

>>> stat_model = stat_wrapper(
...     signal, background, data, background_unc, analysis="multi-bin", xsection=0.123
... )
>>> print("1-CLs : %.3f" % tuple(stat_model.exclusion_confidence_level()))
__init__(signal_yields: List[float], background_yields: List[float], data: List[int], absolute_uncertainties: List[float], signal_uncertainty_configuration: Dict[str, Any] | None = None)[source]#

Methods

__init__(signal_yields, background_yields, ...)

asimov_negative_loglikelihood([poi_test, ...])

Compute negative log-likelihood at fixed \(\mu\) for Asimov data.

combine(other, **kwargs)

A routine to combine to statistical models.

config([allow_negative_signal, poi_upper_bound])

Model configuration.

expected_data(pars[, include_auxiliary])

Compute the expected value of the statistical model

get_hessian_logpdf_func([expected, data])

Currently Hessian of \(\log\mathcal{L}(\mu, \theta)\) is only used to compute variance on \(\mu\).

get_logpdf_func([expected, data])

Generate function to compute \(\log\mathcal{L}(\mu, \theta)\) where \(\mu\) is the parameter of interest and \(\theta\) are nuisance parameters.

get_objective_function([expected, data, do_grad])

Objective function i.e. twice negative log-likelihood, \(-2\log\mathcal{L}(\mu, \theta)\).

get_sampler(pars)

Retreives the function to sample from.

minimize_asimov_negative_loglikelihood([...])

A backend specific method to minimize negative log-likelihood for Asimov data.

minimize_negative_loglikelihood([expected, ...])

A backend specific method to minimize negative log-likelihood.

negative_loglikelihood([poi_test, expected])

Backend specific method to compute negative log-likelihood for a parameter of interest \(\mu\).

Attributes

constraints

Constraints to be used during optimisation process

signal_uncertainty_configuration

author

Author of the backend

constraint_model

retreive constraint model distribution

is_alive

Returns True if at least one bin has non-zero signal yield.

main_model

retreive the main model distribution

name

Name of the backend

spey_requires

Spey version required for the backend

version

Version of the backend