RenewalProcess#
- class relife.stochastic_processes.RenewalProcess(lifetime_model, first_lifetime_model=None)[source]#
Renewal process.
- Parameters:
- lifetime_modelany lifetime distribution or frozen lifetime model
A lifetime model representing the durations between events.
- first_lifetime_modelany lifetime distribution or frozen lifetime model, optional
A lifetime model for the first renewal (delayed renewal process). It is None by default
- Attributes:
- lifetime_modelany lifetime distribution or frozen lifetime model
A lifetime model representing the durations between events.
- first_lifetime_modelany lifetime distribution or frozen lifetime model, optional
A lifetime model for the first renewal (delayed renewal process). It is None by default
- nb_params
- params
- params_names
Methods
Generate lifetime data
Get the parameters of this model.
Parameters names.
The renewal density.
The renewal function.
Renewal data sampling.
Set the parameters of this model.
- generate_failure_data(nb_samples, time_window, a0=None, ar=None, seed=None)[source]#
Generate lifetime data
This function will generate lifetime data that can be used to fit a lifetime model.
- Parameters:
- nb_samplesint
The size of the desired sample
- time_windowtuple of two floats
Time window in which data are sampled
- seedint, optional
Random seed, by default None.
- Returns:
- A dict of time, event, entry and args (covariates)
- get_params()#
Get the parameters of this model.
- Returns:
- out1darray of number
Model parameters.
Notes
If parameter values are not set, they default to np.nan values.
- get_params_names()#
Parameters names.
- Returns:
- list of str
Parameters names
Notes
Parameters values can be requested (a.k.a. get) by their name at instance level.
- renewal_density(tf, nb_steps)[source]#
The renewal density.
The renewal density corresponds to the derivative of the renewal function with respect to time. It is computed by solving the renewal equation:
\[\mu(t) = f_1(t) + \int_0^t \mu(t-x) \mathrm{d}F(x)\]where:
\(\mu\) is the renewal function.
\(F\) is the cumulative distribution function of the underlying lifetime model.
\(f_1\) is the probability density function of the underlying lifetime model for the fist renewal in the case of a delayed renewal process.
- Parameters:
- tffloat
The final time.
- nb_stepsint
The number of steps used to discretized the time.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline and the computed values.
References
[1]Rausand, M., Barros, A., & Hoyland, A. (2020). System Reliability Theory: Models, Statistical Methods, and Applications. John Wiley & Sons.
- renewal_function(tf, nb_steps)[source]#
The renewal function.
The renewal function gives the expected total number of renewals. It is computed by solving the renewal equation:
\[m(t) = F_1(t) + \int_0^t m(t-x) \mathrm{d}F(x)\]where:
\(m\) is the renewal function.
\(F\) is the cumulative distribution function of the underlying lifetime model.
\(F_1\) is the cumulative distribution function of the underlying lifetime model for the fist renewal in the case of a delayed renewal process.
- Parameters:
- tffloat
The final time.
- nb_stepsint
The number of steps used to discretized the time.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline and the computed values.
References
[1]Rausand, M., Barros, A., & Hoyland, A. (2020). System Reliability Theory: Models, Statistical Methods, and Applications. John Wiley & Sons.
- sample(nb_samples, time_window, a0=None, ar=None, seed=None)[source]#
Renewal data sampling.
This function will sample data and encapsulate them in an object.
- Parameters:
- nb_samplesint
The size of the desired sample
- time_windowtuple of two floats
Time window in which data are sampled
- seedint, optional
Random seed, by default None.
- set_params(new_params)#
Set the parameters of this model.
- Parameters:
- new_paramsarray-like of floats
Model parameters.
Notes
set_params definition 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 be expressed in the static typesystem.