ahr_from_km function

Average Hazard Estimation based on Kaplan-Meier Estimates

Average Hazard Estimation based on Kaplan-Meier Estimates

ahr_from_km(resp, trt, data, status, t_quantile = 0.99)

Arguments

  • resp: (string)

    the response variable name.

  • trt: (string)

    the treatment variable name. The treatment variable must be a factor with 2 levels where the first level is the control and the second one the treatment.

  • data: (data frame)

    the data frame with the variables.

  • status: (string)

    the status variable name in survival data.

  • t_quantile: (number)

    definition of the quantile.

Returns

The estimated average hazard ratio of the treatment (second level of trt) versus the control (first level of trt).

Details

Estimates can be unstable due to the variability of the Kaplan-Meier estimates in the tails. The t_quantile argument can address this, e.g. by setting it to 0.95, the 5% highest times will be discarded. By default, the 1% highest times are discarded.

Examples

ahr_from_km("tt_pfs", "arm", example_data, "ev_pfs") ahr_from_km("tt_pfs", "arm", example_data, "ev_pfs", t_quantile = 0.95)