EquilibriumDistribution#
- final class relife.lifetime_models.EquilibriumDistribution(baseline)[source]#
Equilibrium distribution.
The equilibirum distribution is the distribution that makes the renewal process stationnary.
- Parameters:
- baselineany parametric lifetime model
Lifetime model.
References
[1]Ross, S. M. (1996). Stochastic stochastic_process. New York: Wiley.
Methods
Return a model with age replacement, left truncation, or both.
The cumulative distribution function.
The cumulative hazard function.
Return a model with additional arguments stored.
Get the parameters of this model.
The hazard function.
Inverse cumulative hazard function.
Whether fitting results are set.
Whether at least one parameter value is set.
The inverse survival function.
Lebesgue-Stieltjes integration.
The mean of the distribution.
The median.
The n-th order moment.
The mean residual life function.
The probability density function.
Plot function.
The percent point function, inverse of the CDF.
Random variate sampling.
Set the parameters of this model.
The survival function.
The variance of the distribution.
- apply_condition(*, ar=None, a0=None)#
Return a model with age replacement, left truncation, or both.
- Parameters:
- arfloat or ndarray, optional
Age replacement threshold.
- a0float or ndarray, optional
Initial age for left truncation.
- Returns:
- outParametricLifetimeModel
Conditioned lifetime model.
- property args_shape#
Shape of additional model arguments.
- cdf(time, *args)[source]#
The cumulative distribution function.
- Parameters:
- timefloat or np.ndarray
Elapsed time value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
cdf values at each given time(s).
- chf(time, *args)[source]#
The cumulative hazard function.
- Parameters:
- timefloat or np.ndarray
Elapsed time value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
chf values at each given time(s).
- freeze(*args)#
Return a model with additional arguments stored.
- get_params()#
Get the parameters of this model.
- Returns:
- out1darray of floats
Model parameters.
Notes
If parameter values are not set, they default to
np.nanvalues.
- hf(time, *args)[source]#
The hazard function.
- Parameters:
- timefloat or np.ndarray
Elapsed time value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
hf values at each given time(s).
- ichf(cumulative_hazard_rate, *args)[source]#
Inverse cumulative hazard function.
- Parameters:
- cumulative_hazard_ratefloat or np.ndarray
Cumulative hazard rate value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
ichf values at each given cumulative hazard rate(s).
- is_fitted()#
Whether fitting results are set.
- is_parametrized()#
Whether at least one parameter value is set.
- isf(probability, *args)[source]#
The inverse survival function.
- Parameters:
- probabilityfloat or np.ndarray
Probability value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
isf values at each given probability value(s).
- ls_integrate(func, a, b, *density_args, func_args=(), deg=10)#
Lebesgue-Stieltjes integration.
- Parameters:
- funcCallable
Function to integrate with respect to the lifetime distribution.
- afloat or ndarray
Lower bound of the integration.
- bfloat or ndarray
Upper bound of the integration.
- *density_args
Additional arguments required by the lifetime model.
- func_argstuple, default=()
Additional arguments required by
func.- degint, default=10
Number of sample points and weights for the quadrature.
- Returns:
- outnp.ndarray
Lebesgue-Stieltjes integration of
funcfromatob.
- mean(*args)#
The mean of the distribution.
- Parameters:
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
- median(*args)#
The median.
- Parameters:
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
- moment(n, *args)#
The n-th order moment.
- Parameters:
- nint
Order of the moment, at least 1.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
- mrl(time, *args)#
The mean residual life function.
- Parameters:
- timefloat or np.ndarray
Elapsed time value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
Function values at each given time(s).
- pdf(time, *args)[source]#
The probability density function.
- Parameters:
- timefloat or np.ndarray
Elapsed time value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
pdf values at each given time(s).
- plot(fname, time, *args, ax=None, **kwargs)#
Plot function.
- Parameters:
- fnamestr
The function name to plot. Allowed names are sf, cdf, chf, hf, pdf.
- time1d array
The timeline used for x-axis.
- *args
Any additional args required to compute the function.
- axplt.Axes, optional
An optional existing matplotlib.axes.
- **kwargs
- Extra arguments to configure the plot:
ci : bool, default is True if the model has fitting_results
alpha_ci :
any arguments allowed by matplotlib.plot
- ppf(probability, *args)#
The percent point function, inverse of the CDF.
- Parameters:
- probabilityfloat or np.ndarray
Probability value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
ppf values at each given probability value(s).
- rvs(size=None, *args, seed=None)#
Random variate sampling.
- Parameters:
- sizeint or tuple (m, n) of int
Size of the generated sample.
- *args
Any additional args.
- seedoptional int, np.random.BitGenerator, np.random.Generator, np.random.RandomState, default is None
If int or BitGenerator, seed for random number generator. If np.random.RandomState or np.random.Generator, use as given.
- Returns:
- outfloat or ndarray
Sample values.
- set_params(new_params)#
Set the parameters of this model.
- Parameters:
- new_params1d array-like of floats
Model parameters.
Notes
set_paramsdefinition expects an array-like of floats. At runtime, complex parameters might be setted temporarily to approximate fitted parameters covariance. This is contradictory to the given typing. At the moment, we don’t see a better solution and we believe that this is actually a limitation of what can be expressed in the static typesystem.
- sf(time, *args)[source]#
The survival function.
- Parameters:
- timefloat or np.ndarray
Elapsed time value(s) at which to compute the function.
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray
sf values at each given time(s).
- var(*args)#
The variance of the distribution.
- Parameters:
- *args
Any additional args.
- Returns:
- outnp.float64 or np.ndarray