pyhf.infer.intervals.upper_limits.upper_limit#
- pyhf.infer.intervals.upper_limits.upper_limit(data, model, scan=None, level=0.05, return_results=False, **hypotest_kwargs)[source]#
Calculate an upper limit interval
(0, poi_up)
for a single Parameter of Interest (POI) using root-finding or a linear scan through POI-space.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) >>> scan = np.linspace(0, 5, 21) >>> obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upper_limits.upper_limit( ... data, model, scan, return_results=True ... ) >>> obs_limit array(1.01764089) >>> exp_limits [array(0.59576921), array(0.76169166), array(1.08504773), array(1.50170482), array(2.06654952)]
- Parameters:
data (
tensor
) – The observed data.model (Model) – The statistical model adhering to the schema
model.json
.scan (
iterable
orNone
) – Iterable of POI values orNone
to usetoms748_scan
.level (
float
) – The threshold value to evaluate the interpolated results at.return_results (
bool
) – Whether to return the per-point results.
- Returns:
Tensor: The observed upper limit on the POI.
Tensor: The expected upper limits on the POI.
Tuple of Tensors: The given
scan
along with thehypotest
results at each test POI. Only returned whenreturn_results
isTrue
.
- Return type:
Tuple of Tensors
Added in version 0.7.0.