pyhf.infer.intervals.upper_limits.toms748_scan#
- pyhf.infer.intervals.upper_limits.toms748_scan(data, model, bounds_low, bounds_up, level=0.05, atol=2e-12, rtol=0.0001, from_upper_limit_fn=False, **hypotest_kwargs)[source]#
Calculate an upper limit interval
(0, poi_up)for a single Parameter of Interest (POI) using an automatic scan through POI-space, using thetoms748()algorithm.Example
>>> import numpy as np >>> import pyhf >>> pyhf.set_backend("numpy") >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> observations = [51, 48] >>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata) >>> obs_limit, exp_limits = pyhf.infer.intervals.upper_limits.toms748_scan( ... data, model, 0., 5., rtol=0.01 ... ) >>> np.isclose(obs_limit, 1.01156939) np.True_ >>> np.isclose(exp_limits, [0.5600747, 0.75702605, 1.06234693, 1.50116923, 2.05078912]) array([ True, True, True, True, True])
- Parameters:
data (
tensor) – The observed data.model (Model) – The statistical model adhering to the schema
model.json.bounds_low (
float) – Lower boundary of search interval.bounds_up (
float) – Upper boundary of search interval.level (
float) – The threshold value to evaluate the interpolated results at. Defaults to0.05.atol (
float) – Absolute tolerance. The iteration will end when the result is within absolute or relative tolerance of the true limit.rtol (
float) – Relative tolerance. For optimal performance this argument should be set to the highest acceptable relative tolerance.hypotest_kwargs (
string) – Kwargs for the calls tohypotestto configure the fits.
- Returns:
Tensor: The observed upper limit on the POI.
Tensor: The expected upper limits on the POI.
- Return type:
Tuple of Tensors
Added in version 0.7.0.