AsymptoticTestStatDistribution#
- class pyhf.infer.calculators.AsymptoticTestStatDistribution(shift, cutoff=-inf)[source]#
Bases:
object
The distribution the test statistic in the asymptotic case.
Note: These distributions are in
space. In the ROOT implementation the same sigma is assumed for both hypotheses and -values etc are computed in that space. This assumption is necessarily valid, but we keep this for compatibility reasons.In the
space, the test statistic (i.e. ) is normally distributed with unit variance and its mean at the , where is the true poi value of the hypothesis.- __init__(shift, cutoff=-inf)[source]#
Asymptotic test statistic distribution.
- Parameters:
shift (
float
) – The displacement of the test statistic distribution.- Returns:
The asymptotic distribution of test statistic.
- Return type:
Methods
- cdf(value)[source]#
Compute the value of the cumulative distribution function for a given value of the test statistic.
Example
>>> import pyhf >>> pyhf.set_backend("numpy") >>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0) >>> bkg_dist.cdf(0.0) 0.5
- Parameters:
value (
float
) – The test statistic value.- Returns:
The integrated probability to observe a test statistic less than or equal to the observed
value
.- Return type:
Float
- expected_value(nsigma)[source]#
Return the expected value of the test statistic.
Example
>>> import pyhf >>> pyhf.set_backend("numpy") >>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0) >>> n_sigma = pyhf.tensorlib.astensor([-2, -1, 0, 1, 2]) >>> bkg_dist.expected_value(n_sigma) array([-2., -1., 0., 1., 2.])
- Parameters:
nsigma (
int
ortensor
) – The number of standard deviations.- Returns:
The expected value of the test statistic.
- Return type:
Float
- pvalue(value)[source]#
The
-value for a given value of the test statistic corresponding to signal strength and Asimov strength as defined in Equations (59) and (57) of [1007.1727]with Equation (29)
given the observed test statistics
and .Example
>>> import pyhf >>> pyhf.set_backend("numpy") >>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0) >>> bkg_dist.pvalue(0.0) array(0.5)
- Parameters:
value (
float
) – The test statistic value.- Returns:
The integrated probability to observe a value at least as large as the observed one.
- Return type:
Tensor