truncated.base¶
Module: truncated.base
¶
Inheritance diagram for selectinf.truncated.base
:
This module implements the class truncated_gaussian which performs (conditional) UMPU tests for Gaussians restricted to a set of intervals.
truncated
¶
-
class
selectinf.truncated.base.
truncated
(intervals)[source]¶ Bases:
object
A distribution, truncated to a union of intervals
HOW TO MAKE A SUBCLASS : You have to implement :
- __init__(self, args*)It has to call the method from the base class
Since the method is abstract, you can’t have an instance of the subclass if the method __init__ is not implemented
_cdf_notTruncated(self, a, b, dps) :
- With these two methods, you can use
-> cdf -> sf
You should implement :
- _pdf_notTruncated(self, z, dps)it allows you to use
-> pdf -> plt_pdf (if you also have _quantile_notTruncated)
- _quantile_notTruncated(self, q, tol)it allows you to use
-> quantile -> rvs -> plt_cdf -> plt_pdf (if you also have _pdf_notTruncated)
-
abstract
__init__
(intervals)[source]¶ Create a new truncated distribution object This method is abstract : it has to be overriden
- Parameters
intervals : [(float, float)]
The intervals the distribution is truncated to
-
rvs
(size=1)[source]¶ Sample a random variable from the truncated disribution
- Parameters
size : int
Number of samples. Default : 1
- Returns
X : np.array
array of sample
-
sf
(z)[source]¶ Compute the survival function of the truncated distribution
- Parameters
z : float
Minimum bound of the interval
- Returns
sf : float
The survival function of the truncated distribution sf(z) = P( X > z | X is in intervals )
-
cdf
(z)[source]¶ Compute the survival function of the truncated distribution
- Parameters
z : float
Minimum bound of the interval
- Returns
cdf : float
function The cumulative distribution function of the truncated distribution cdf(z) = P( X < z | X is in intervals )
WARNING : This method only use the sf method
more precise