spey.hypothesis_testing.toy_calculator.compute_toy_confidence_level

spey.hypothesis_testing.toy_calculator.compute_toy_confidence_level#

spey.hypothesis_testing.toy_calculator.compute_toy_confidence_level(signal_like_test_statistic: List[float], background_like_test_statistic: List[float], test_statistic: float, test_stat: str = 'qtilde') Tuple[List[float], List[float]][source]#

Compute confidence limits i.e. \(CL_{s+b}\), \(CL_b\) and \(CL_s\)

Parameters:
  • signal_like_test_statistic (List[float]) – signal like test statistic values

  • background_like_test_statistic (List[float]) – background like test statistic values

  • test_statistic (float) – value for parameter of interest

  • test_stat (Text, default "qtilde") –

    test statistics.

    • 'qtilde': (default) performs the calculation using the alternative test statistic, \(\tilde{q}_{\mu}\), see eq. (62) of [arXiv:1007.1727] (qmu_tilde()).

      Warning

      Note that this assumes that \(\hat\mu\geq0\), hence allow_negative_signal assumed to be False. If this function has been executed by user, spey assumes that this is taken care of throughout the external code consistently. Whilst computing p-values or upper limit on \(\mu\) through spey this is taken care of automatically in the backend.

    • 'q': performs the calculation using the test statistic \(q_{\mu}\), see eq. (54) of [arXiv:1007.1727] (qmu()).

    • 'q0': performs the calculation using the discovery test statistic, see eq. (47) of [arXiv:1007.1727] \(q_{0}\) (q0()).

Returns:

returns p-values and expected p-values.

Return type:

Tuple[List[float], List[float]]