relaxed.infer package#

Calculate expected CLs values with hypothesis tests.

relaxed.infer.hypotest(test_poi: float, data: Array, model: PyTree, init_pars: dict[str, ArrayLike], bounds: dict[str, ArrayLike] | None = None, poi_name: str = 'mu', return_mle_pars: bool = False, test_stat: str = 'qmu', expected_pars: dict[str, ArrayLike] | None = None, cls_method: bool = True) tuple[Array, Array] | Array#

Calculate expected CLs/p-values via hypothesis tests.

Parameters:
  • test_poi (float) – The value of the test parameter to use for the hypothesis test.

  • data (Array) – The data to use for the hypothesis test.

  • model (PyTree) – The model to use for the hypothesis test. Has a logpdf method with signature logpdf(pars: dict[str, ArrayLike], data: Array) -> Array.

  • init_pars (dict[str, ArrayLike]) – The initial parameters to use for fits within the hypothesis test.

  • bounds (dict[str, ArrayLike] | None) – (optional) The bounds to use on parameters for fits within the hypothesis test.

  • poi_name (str) – The name of the parameter(s) of interest.

  • return_mle_pars (bool) – Whether to return the MLE parameters.

  • test_stat (str) – The test statistic type to use for the hypothesis test. Default is qmu.

  • expected_pars (dict[str, ArrayLike] | None) – The MLE parameters from a previous fit, to use as the expected parameters.

  • cls_method (bool) – Whether to use the CLs method for the hypothesis test. Default is True (if qmu test)

Returns:

  • Array – The expected CLs/p-value.

  • or tuple[Array, Array] – The expected CLs/p-value and the MLE parameters. Only returned if return_mle_pars is True.