truncated.chi¶
Module: truncated.chi
¶
Inheritance diagram for selectinf.truncated.chi
:
This module implements the class truncated_chi2 which performs (conditional) UMPU tests for Gaussians restricted to a set of intervals.
Classes¶
truncated_chi
¶
-
class
selectinf.truncated.chi.
truncated_chi
(I, k, scale=1.0)[source]¶ Bases:
selectinf.truncated.base.truncated
>>> from selectinf.constraints.intervals import intervals >>> I = intervals.intersection(intervals((-1, 6)), ... intervals(( 0, 7)), ... ~intervals((1, 4))) >>> distr = truncated_chi(I, 3, 2.) >>> print(abs(distr.cdf(distr.quantile(0.9)) - 0.9) < 0.01) True
-
__init__
(I, k, scale=1.0)[source]¶ Create a new object for a truncated_chi distribution
- Parameters
I : intervals
The intervals the distribution is truncated to
k : int
Number of degree of freedom of the distribution
scale : float
The distribution is sim scale * chi_k
-
cdf
(z)¶ 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
-
pdf
(z)¶ Compute the probability distribution funtion of the truncated distribution
- Parameters
z : float
- Returns
p : float
p(z) such that E[f(X)] = int f(z)p(z)dz
-
quantile
(q, tol=1e-06)¶
-
rvs
(size=1)¶ 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)¶ 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 )
-
truncated_chi2
¶
-
class
selectinf.truncated.chi.
truncated_chi2
(I, k, scale=1.0)[source]¶ Bases:
selectinf.truncated.base.truncated
>>> from selectinf.constraints.intervals import intervals >>> I = intervals.intersection(intervals((-1, 6)), ... intervals(( 0, 7)), ... ~intervals((1, 4))) >>> distr = truncated_chi2(I, 3, 2.) >>> print(abs(distr.cdf(distr.quantile(0.9)) - 0.9) < 0.01) True
-
__init__
(I, k, scale=1.0)[source]¶ Create a new object for a truncated_chi distribution
- Parameters
I : intervals
The intervals the distribution is truncated to
k : int
Number of degree of freedom of the distribution
scale : float
The distribution is sim scale * chi_k
-
cdf
(z)¶ 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
-
pdf
(z)¶ Compute the probability distribution funtion of the truncated distribution
- Parameters
z : float
- Returns
p : float
p(z) such that E[f(X)] = int f(z)p(z)dz
-
quantile
(q, tol=1e-06)¶
-
rvs
(size=1)¶ 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)¶ 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 )
-