sparsesurv.baseline_hazard_estimation module

Summary

Functions:

aft_baseline_hazard_estimator

Accelerated Failure Time baseline hazard estimator function.

baseline_hazard_estimator_eh

Extended Hazards baseline hazard estimator function.

breslow_estimator_breslow

Breslow approximation of the hazard function with breslow tie-correction.

breslow_estimator_efron

Breslow approximation of the hazard function with efron tie-correction.

get_cumulative_hazard_function_aft

Computes cumulative hazard for the accelerated failure time model.

get_cumulative_hazard_function_eh

Computes cumulative hazard for the extended hazards model.

Reference

breslow_estimator_breslow(time, event, eta)[source]

Breslow approximation of the hazard function with breslow tie-correction.

Parameters:
  • time (npt.NDArray[np.float64]) – Event times.

  • event (npt.NDArray[np.float64]) – Event states.

  • eta (npt.NDArray[np.float64]) – Linear predictor of the samples.

Returns:

Tuple of unique and sorted time points, and the corresponding cumulative hazard at that point as arrays.

Return type:

Tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]

breslow_estimator_efron(time, event, eta)[source]

Breslow approximation of the hazard function with efron tie-correction.

Parameters:
  • time (npt.NDArray[np.float64]) – Event times.

  • event (npt.NDArray[np.float64]) – Event states.

  • eta (npt.NDArray[np.float64]) – Linear predictor of the samples.

Returns:

Tuple of unique and sorted time points, and the corresponding cumulative hazard at that point as arrays.

Return type:

Tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]

aft_baseline_hazard_estimator(time, time_train, event_train, eta_train)[source]

Accelerated Failure Time baseline hazard estimator function.

Parameters:
  • time (npt.NDArray[np.float64]) – Event times.

  • time_train (npt.NDArray[np.float64]) – Event times of training samples.

  • event_train (npt.NDArray[np.float64]) – Event states of training samples.

  • eta_train (npt.NDArray[np.float64]) – Linear predictor of training samples.

Returns:

Baseline hazard value.

Return type:

float

get_cumulative_hazard_function_aft(time_query, eta_query, time_train, event_train, eta_train)[source]

Computes cumulative hazard for the accelerated failure time model.

Parameters:
  • npt.NDArray[np.float64] (eta_train) – Times at which cumulative hazard function estimation is desired.

  • npt.NDArray[np.float64] – Linear predictor of query samples.

  • npt.NDArray[np.float64] – Event times of training samples.

  • npt.NDArray[np.float64] – Event states of training samples.

  • npt.NDArray[np.float64] – Linear predictor of training samples.

Returns:

Cumulative hazard at each unique and sorted time step.

Return type:

pd.DataFrame

baseline_hazard_estimator_eh(time, time_train, event_train, eta_train)[source]

Extended Hazards baseline hazard estimator function.

Parameters:
  • time (npt.NDArray[np.float64]) – Event times.

  • time_train (npt.NDArray[np.float64]) – Event times of training samples.

  • event_train (npt.NDArray[np.float64]) – Event states of training samples.

  • eta_train (npt.NDArray[np.float64]) – Linear predictor of training samples.

Returns:

Baseline hazard value.

Return type:

float

get_cumulative_hazard_function_eh(time_query, eta_query, time_train, event_train, eta_train)[source]

Computes cumulative hazard for the extended hazards model.

Parameters:
  • npt.NDArray[np.float64] (eta_train) – Times at which cumulative hazard function estimation is desired.

  • npt.NDArray[np.float64] – Linear predictor of query samples.

  • npt.NDArray[np.float64] – Event times of training samples.

  • npt.NDArray[np.float64] – Event states of training samples.

  • npt.NDArray[np.float64] – Linear predictor of training samples.

Returns:

Cumulative hazard at each unique and sorted time step.

Return type:

pd.DataFrame