relife.parametric.ParametricHazardFunctions

relife.parametric.ParametricHazardFunctions

class relife.parametric.ParametricHazardFunctions[source]

Bases: relife.model.HazardFunctions

Generic parametric hazard functions.

Generic class for the parametric hazard functions with a fitting method based on the maximum likelihood estimator.

Methods

chf

Cumulative hazard function.

hf

Hazard function (or hazard rate).

ichf

Inverse cumulative hazard function.

Attributes

n_params

Number of parameters.

params

Parameters of the hazard functions.

abstract property params: numpy.ndarray

Parameters of the hazard functions.

abstract property n_params: int

Number of parameters.

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),)
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),)
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),)