spey.hypothesis_testing.test_statistics.compute_teststatistics

spey.hypothesis_testing.test_statistics.compute_teststatistics#

spey.hypothesis_testing.test_statistics.compute_teststatistics(mu: float, maximum_likelihood: Tuple[float, float], logpdf: Callable[[float], float], maximum_asimov_likelihood: Tuple[float, float], asimov_logpdf: Callable[[float], float], teststat: str) Tuple[float, float, float][source]#

Compute test statistics

Parameters:
  • mu (float) – parameter of interest, \(\mu\).

  • maximum_likelihood (Tuple[float, float]) – (\(\hat\mu\) and \(\arg\min\log\mathcal{L}\))

  • logpdf (Callable[[float], float]) – function to compute \(\log\mathcal{L}\) with fixed \(\mu\).

  • maximum_asimov_likelihood (Tuple[float, float]) – (\(\hat\mu_A\) and \(\arg\min\log\mathcal{L}_A\))

  • asimov_logpdf (Callable[[float], float]) – function to compute \(\log\mathcal{L}_A\) with fixed \(\mu\).

  • teststat (Text) –

    test statistic.

    • '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:

\(\sqrt{q_\mu}\), \(\sqrt{q_{\mu,A}}\) and \(\Delta(\sqrt{q_\mu}, \sqrt{q_{\mu,A}})\)

Return type:

Tuple[float, float, float]