relife.renewal_process.RenewalProcess
relife.renewal_process.RenewalProcess¶
- class relife.renewal_process.RenewalProcess(model: relife.model.LifetimeModel, model1: Optional[relife.model.LifetimeModel] = None)[source]¶
Bases:
object
Renewal process.
Creates a renewal process.
- Parameters
model (LifetimeModel) – A lifetime model representing the durations between events.
model1 (LifetimeModel, optional) – A lifetime model for the first renewal (delayed renewal process), by default None.
Methods
The renewal density.
The renewal function.
Renewal data sampling.
- renewal_function(t: numpy.ndarray, model_args: Tuple[numpy.ndarray, ...] = (), model1_args: Tuple[numpy.ndarray, ...] = ()) numpy.ndarray [source]¶
The renewal function.
- Parameters
t (1D array) – Timeline.
model_args (Tuple[ndarray,...], optional) – Extra arguments required by the underlying lifetime model, by default ().
model1_args (Tuple[ndarray,...], optional) – Extra arguments required by the lifetime model of the first renewal, by default ().
- Returns
The renewal function evaluated at each point of the timeline.
- Return type
ndarray
Notes
The expected total number of renewals 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.
References
- 1
Rausand, M., Barros, A., & Hoyland, A. (2020). System Reliability Theory: Models, Statistical Methods, and Applications. John Wiley & Sons.
- renewal_density(t: numpy.ndarray, model_args: Tuple[numpy.ndarray, ...] = (), model1_args: Tuple[numpy.ndarray, ...] = ()) numpy.ndarray [source]¶
The renewal density.
- Parameters
t (1D array) – Timeline.
model_args (Tuple[ndarray,...], optional) – Extra arguments required by the underlying lifetime model, by default ().
model1_args (Tuple[ndarray,...], optional) – Extra arguments required by the lifetime model of the first renewal, by default ().
- Returns
Renewal density evaluated at each point of the timeline.
- Return type
ndarray
- Raises
NotImplementedError – If the lifetime model is not absolutely continuous.
Notes
The renewal density is 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.
References
- 1
Rausand, M., Barros, A., & Hoyland, A. (2020). System Reliability Theory: Models, Statistical Methods, and Applications. John Wiley & Sons.
- sample(T: float, model_args: Tuple[numpy.ndarray, ...] = (), model1_args: Tuple[numpy.ndarray, ...] = (), n_samples: int = 1, random_state: Optional[int] = None) relife.data.RenewalData [source]¶
Renewal data sampling.
- Parameters
T (float) – Time at the end of the observation.
model_args (Tuple[ndarray,...], optional) – Extra arguments required by the underlying lifetime model, by default ().
model1_args (Tuple[ndarray,...], optional) – Extra arguments required by the lifetime model of the first renewal, by default ().
n_samples (int, optional) – Number of samples, by default 1.
random_state (int, optional) – Random seed, by default None.
- Returns
Samples of replacement times and durations.
- Return type