truncated.T

Module: truncated.T

Inheritance diagram for selectinf.truncated.T:

digraph inheritance448b38a16d { rankdir=LR; size="8.0, 12.0"; "truncated.T.truncated_T" [URL="#selectinf.truncated.T.truncated_T",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top"]; "truncated.base.truncated" -> "truncated.T.truncated_T" [arrowsize=0.5,style="setlinewidth(0.5)"]; "truncated.base.truncated" [URL="selectinf.truncated.base.html#selectinf.truncated.base.truncated",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A distribution, truncated to a union of intervals"]; }

truncated_T

class selectinf.truncated.T.truncated_T(intervals, df)[source]

Bases: selectinf.truncated.base.truncated

__init__(intervals, df)[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

dps = 20
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 )

selectinf.truncated.T.sf_T(df)[source]