RenewalRewardProcess#
- class relife.stochastic_process.RenewalRewardProcess(lifetime_model, reward, discounting_rate=0.0, first_lifetime_model=None, first_reward=None)[source]#
Renewal reward process.
- Parameters:
- lifetime_modelany lifetime distribution or frozen lifetime model
A lifetime model representing the durations between events.
- rewardReward
A reward object that answers costs or conditional costs given lifetime values
- discounting_ratefloat
The discounting rate value used in the exponential discounting function
- 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
- rewardReward
A reward object for the first renewal
- 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
- rewardReward
A reward object that answers costs or conditional costs given lifetime values
- first_rewardReward
A reward object for the first renewal. If it is not given at the initialization, it is a copy of reward.
discounting_rate
The discounting rate value
nb_params
Number of parameters.
params
Parameters values.
params_names
Parameters names.
Methods
Asymptotic expected equivalent annual worth.
Asymptotic expected total reward.
Expected equivalent annual worth.
The expected total reward.
Generate lifetime data
The renewal density.
The renewal function.
Renewal data sampling.
- asymptotic_expected_equivalent_annual_worth()[source]#
Asymptotic expected equivalent annual worth.
- Returns:
- ndarray
The assymptotic expected equivalent annual worth
- asymptotic_expected_total_reward()[source]#
Asymptotic expected total reward.
The asymptotic expected total reward is:
\[z^\infty = \lim_{t\to \infty} z(t) = \dfrac{E\left[Y e^{-\delta X}\right]}{1-E\left[e^{-\delta X}\right]}\]where:
\(X\) the interarrival random variable,
\(Y\) the associated reward,
\(D\) the exponential discount factor.
If the renewal reward process is delayed, the asymptotic expected total reward is modified as:
\[z_1^\infty = E\left[Y_1 e^{-\delta X_1}\right] + z^\infty E\left[e^{-\delta X_1}\right]\]where:
\(X_1\) the interarrival random variable of the first renewal,
\(Y_1\) the associated reward of the first renewal,
- Returns:
- ndarray
The assymptotic expected total reward of the process.
- property discounting_rate#
The discounting rate value
- expected_equivalent_annual_worth(tf, nb_steps)[source]#
Expected equivalent annual worth.
Gives the equivalent annual worth of the expected total reward of the process at each point of the timeline.
The equivalent annual worth at time \(t\) is equal to the expected total reward \(z\) divided by the annuity factor \(AF(t)\).
- Parameters:
- tffloat
Time horizon. The expected equivalent annual worth will be computed up until this calendar time.
- nb_stepsint
The number of steps used to compute the expected equivalent annual worth.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline used to compute the expected equivalent annual worth and its corresponding values at each step of the timeline.
- expected_total_reward(tf, nb_steps)[source]#
The expected total reward.
The renewal equation solved to compute the expected reward is:
\[z(t) = \int_0^t E[Y | X = x] e^{-\delta x} \mathrm{d}F(x) + \int_0^t z(t-x) e^{-\delta x}\mathrm{d}F(x)\]where:
\(z\) is the expected total reward,
\(F\) is the cumulative distribution function of the underlying lifetime model,
\(X\) the interarrival random variable,
\(Y\) the associated reward,
\(D\) the exponential discount factor.
If the renewal reward process is delayed, the expected total reward is modified as:
\[z_1(t) = \int_0^t E[Y_1 | X_1 = x] e^{-\delta x} \mathrm{d}F_1(x) + \int_0^t z(t-x) e^{-\delta x} \mathrm{d}F_1(x)\]where:
\(z_1\) is the expected total reward with delay,
\(F_1\) is the cumulative distribution function of the lifetime model for the first renewal,
\(X_1\) the interarrival random variable of the first renewal,
\(Y_1\) the associated reward of the first renewal,
- Parameters:
- tffloat
Time horizon. The expected total reward will be computed up until this calendar time.
- nb_stepsint
The number of steps used to compute the expected total reward.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline used to compute the expected total reward and its corresponding values at each step of the timeline.
- generate_failure_data(size, tf, t0=0.0, seed=None)#
Generate lifetime data
This function will generate lifetime data that can be used to fit a lifetime model.
- Parameters:
- sizeint
The size of the desired sample
- tffloat
Time at the end of the observation.
- t0float, default 0
Time at the beginning of the observation.
- seedint, optional
Random seed, by default None.
- Returns:
- A dict of time, event, entry and args (covariates)
- property nb_params#
Number of parameters.
- Returns:
- int
Number of parameters.
- property params#
Parameters values.
- Returns:
- ndarray
Parameters values of the core
Notes
If parameter values are not set, they are encoded as np.nan value.
Parameters can be by manually setting`params` through its setter, fitting the core if fit exists or by specifying all parameters values when the core object is initialized.
- property 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)#
The renewal density.
- Parameters:
- tffloat
Time horizon. The renewal density will be computed up until this calendar time.
- nb_stepsint
The number of steps used to compute the renewal density.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline used to compute the renewal density and its corresponding values at each step of the timeline.
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.
- renewal_function(tf, nb_steps)#
The renewal function.
- Parameters:
- tffloat
Time horizon. The renewal function will be computed up until this calendar time.
- nb_stepsint
The number of steps used to compute the renewal function.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline used to compute the renewal function and its corresponding values at each step of the timeline.
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.
- sample(size, tf, t0=0.0, seed=None)[source]#
Renewal data sampling.
This function will sample data and encapsulate them in an object.
- Parameters:
- sizeint
The size of the desired sample
- tffloat
Time at the end of the observation.
- t0float, default 0
Time at the beginning of the observation.
- sizeint or tuple of 2 int
Size of the sample
- seedint, optional
Random seed, by default None.