Learn R Programming

visR (version 0.4.1)

get_COX_HR: Summarize Hazard Ratio from a survival object using S3 method

Description

S3 method for extracting information regarding Hazard Ratios. The function allows the survival object's formula to be updated. No default method is available at the moment.

Usage

get_COX_HR(x, ...)

# S3 method for survfit get_COX_HR(x, update_formula = NULL, ...)

Value

A tidied object of class coxph containing Hazard Ratios

Arguments

x

An object of class survfit

...

other arguments passed on to the method survival::coxph

update_formula

Template which specifies how to update the formula of the survfit object update.formula

See Also

Examples

Run this code
## treatment effect
survfit_object_trt <- visR::estimate_KM(data = adtte, strata = c("TRTP"))
visR::get_COX_HR(survfit_object_trt)

## treatment and gender effect
survfit_object_trt_sex <- visR::estimate_KM(data = adtte, strata = c("TRTP", "SEX"))
visR::get_COX_HR(survfit_object_trt_sex)

## update formula of KM estimates by treatment to include "SEX" for HR estimation
visR::get_COX_HR(survfit_object_trt, update_formula = ". ~ . + SEX")

## update formula of KM estimates by treatment to include "AGE" for
## HR estimation with ties considered via the efron method
visR::get_COX_HR(survfit_object_trt,
  update_formula = ". ~ . + survival::strata(AGE)", ties = "efron"
)

Run the code above in your browser using DataLab