spey.hypothesis_testing.asymptotic_calculator.compute_asymptotic_confidence_level

spey.hypothesis_testing.asymptotic_calculator.compute_asymptotic_confidence_level#

spey.hypothesis_testing.asymptotic_calculator.compute_asymptotic_confidence_level(sqrt_qmuA: float, delta_test_statistic: float, test_stat: str = 'qtilde') Tuple[List[float], List[float]][source]#

Compute p values i.e. \(p_{s+b}\), \(p_b\) and \(p_s\)

\[\begin{split}p_{s+b}&=& \int_{-\infty}^{-\sqrt{q_{\mu,A}} - \Delta q_\mu} \mathcal{N}(x| 0, 1) dx \\ p_{b}&=& \int_{-\infty}^{-\Delta q_\mu} \mathcal{N}(x| 0, 1) dx \\ p_{s} &=& p_{s+b}/ p_{b}\end{split}\]

where \(q_\mu\) stands for the test statistic and A stands for Assimov.

\[\begin{split}\Delta q_\mu = \begin{cases} \sqrt{q_{\mu}} - \sqrt{q_{\mu,A}}, & \text{if}\ \sqrt{q_{\mu}} \leq \sqrt{q_{\mu,A}} \\ \frac{\sqrt{q_{\mu}} - \sqrt{q_{\mu,A}}}{2\ \sqrt{q_{\mu,A}}}, & \text{otherwise} \end{cases}\end{split}\]

Note that the CDF has a cutoff at \(-\sqrt{q_{\mu,A}}\), hence if \(p_{s\ {\rm or}\ s+b} < -\sqrt{q_{\mu,A}}\) p-value will not be computed.

See also

eq. 66 of [arXiv:1007.1727]

Parameters:
  • sqrt_qmuA (float) – test statistic for Asimov data \(\sqrt{q_{\mu,A}}\).

  • delta_test_statistic (float) – \(\Delta q_\mu\)

  • 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]]