relife.model.HazardFunctions

relife.model.HazardFunctions

class relife.model.HazardFunctions[source]

Bases: abc.ABC

Generic hazard functions.

Abstract class for the definition of a hazard functions: hazard rate, cumulative hazard function, and inverse cumulative hazard function.

Methods

chf

Cumulative hazard function.

hf

Hazard function (or hazard rate).

ichf

Inverse cumulative hazard function.

abstract hf(t: numpy.ndarray, *args: numpy.ndarray) numpy.ndarray[source]

Hazard function (or hazard rate).

The hazard function is the derivative of the cumulative hazard function.

Parameters
  • t (float or 1D array) – Elapsed time.

  • *args (float or 2D array, optional) – Extra arguments required by the hazard function.

Returns

Hazard rate at t.

Return type

float or 1D array

Notes

If args are of type ndarray, the arrays should be broadcastable with shape[-1]=1.

The shape of the result will be:

np.broadcast_shapes(*(np.shape(arg) for arg in args))[:-1] + (np.size(t),)
abstract chf(t: numpy.ndarray, *args: numpy.ndarray) numpy.ndarray[source]

Cumulative hazard function.

The cumulative hazard function is the integral of the hazard function.

Parameters
  • t (float or 1D array) – Elapsed time.

  • *args (float or 2D array, optional) – Extra arguments required by the hazard function.

Returns

Cumulative hazard function at t.

Return type

float or ndarray

Notes

If args are of type ndarray, the arrays should be broadcastable with shape[-1]=1.

The shape of the result will be:

np.broadcast_shapes(*(np.shape(arg) for arg in args))[:-1] + (np.size(t),)
abstract ichf(v: numpy.ndarray, *args: numpy.ndarray) numpy.ndarray[source]

Inverse cumulative hazard function.

Parameters
  • v (float or 1D array) – Cumulative hazard rate

  • *args (float or 2D array, optional) – Extra arguments required by the hazard function.

Return type

float or ndarray

Notes

If args are of type ndarray, the arrays should be broadcastable with shape[-1]=1.

The shape of the result will be:

np.broadcast_shapes(*(np.shape(arg) for arg in args))[:-1] + (np.size(t),)