CLsHypo¶
-
class
hep_spt.
CLsHypo
(pf)[source]¶ Bases:
object
Represent an hypothesis to be used in the CLs method. The class is built from a given probability function.
- Parameters
pf (scipy.stats.rv_frozen) – probability density/mass function.
- Variables
func – probability density/mass function representing the hypothesis.
See also
Methods Summary
__call__
(v)Calculate the global probability for the given input value(s).
median
()Calculate the median of the distribution associated to this hypothesis.
percentil
(prob)Calculate the percentil associated to the given probability.
Methods Documentation
-
__call__
(v)[source]¶ Calculate the global probability for the given input value(s). If the arguments of the probability function are arrays, then it is assumed that “v” is either an array of length equal to the number of values per argument, or that it is an array of arrays following the latter structure. If “v” does not match any of the previous requirements, then the global probability is calculated assuming this value for all the sub-functions. Assuming “pmf” as “poisson.pmf”:
>>> import numpy as np >>> from scipy.stats import poisson >>> ha = cls_hypo(poisson, 4) >>> ha(4) # Same as pmf(4, 4) 0.19536681481316454 >>> hb = cls_hypo(poisson, np.array([4, 8])) >>> hb([4, 8]) # Same as pmf(4, 4)*pmf(4, 8) 0.02727057613800409 >>> hb([[4, 8], [6, 10]]) # Same as [pmf(4, 4)*pmf(8, 8), pmf(6, 4)*pmf(10, 8)] >>> hb(4) # Same as pmf(4, 4)*pmf(4, 4) 0.011185197244103258
- Parameters
v (numpy.ndarray) – input value(s).
- Returns
Global probability.
- Return type
-
median
()[source]¶ Calculate the median of the distribution associated to this hypothesis. This is equivalent to call CLsHypo.percentil(0.5).
- Returns
Median of the distribution.
- Return type