Skip to contents

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

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

Value

A tidied object of class coxph containing Hazard Ratios

Examples

## treatment effect
survfit_object_trt <- visR::estimate_KM(data = adtte, strata = c("TRTP"))
visR::get_COX_HR(survfit_object_trt)
#> tidyme S3 default method (broom::tidy) used.
#>                       term estimate std.error statistic      p.value
#> 1 TRTPXanomeline High Dose 1.614618 0.2332605  6.921953 4.454580e-12
#> 2  TRTPXanomeline Low Dose 1.422555 0.2295098  6.198232 5.710099e-10

## 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)
#> tidyme S3 default method (broom::tidy) used.
#>                       term  estimate std.error statistic      p.value
#> 1 TRTPXanomeline High Dose 1.6159986 0.2339757  6.906695 4.960732e-12
#> 2  TRTPXanomeline Low Dose 1.4755033 0.2317331  6.367252 1.924446e-10
#> 3                     SEXM 0.3745729 0.1651854  2.267591 2.335412e-02

## update formula of KM estimates by treatment to include "SEX" for HR estimation
visR::get_COX_HR(survfit_object_trt, update_formula = ". ~ . + SEX")
#> tidyme S3 default method (broom::tidy) used.
#>                       term  estimate std.error statistic      p.value
#> 1 TRTPXanomeline High Dose 1.6159986 0.2339757  6.906695 4.960732e-12
#> 2  TRTPXanomeline Low Dose 1.4755033 0.2317331  6.367252 1.924446e-10
#> 3                     SEXM 0.3745729 0.1651854  2.267591 2.335412e-02

## 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"
)
#> Warning: Loglik converged before variable  3,7,18,36,37 ; coefficient may be infinite. 
#> tidyme S3 default method (broom::tidy) used.
#>                           term    estimate    std.error     statistic
#> 1     TRTPXanomeline High Dose   1.5676387 2.555278e-01  6.1349054151
#> 2      TRTPXanomeline Low Dose   1.3216405 2.530283e-01  5.2232906436
#> 3  survival::strata(AGE)AGE=52 -18.1640265 5.298844e+03 -0.0034279227
#> 4  survival::strata(AGE)AGE=54  -0.2090228 1.415797e+00 -0.1476361992
#> 5  survival::strata(AGE)AGE=56  -1.6206873 1.097690e+00 -1.4764526121
#> 6  survival::strata(AGE)AGE=57  -1.1398148 1.166518e+00 -0.9771082854
#> 7  survival::strata(AGE)AGE=59 -18.1578569 3.767502e+03 -0.0048196009
#> 8  survival::strata(AGE)AGE=60  -1.3242727 1.241054e+00 -1.0670547450
#> 9  survival::strata(AGE)AGE=61  -1.4515246 1.133242e+00 -1.2808598926
#> 10 survival::strata(AGE)AGE=62  -1.4077265 1.428274e+00 -0.9856138035
#> 11 survival::strata(AGE)AGE=63  -1.7199741 1.245995e+00 -1.3804019425
#> 12 survival::strata(AGE)AGE=64  -1.4654615 1.256398e+00 -1.1663993068
#> 13 survival::strata(AGE)AGE=65  -1.8714042 1.236610e+00 -1.5133340637
#> 14 survival::strata(AGE)AGE=66  -0.7392248 1.443026e+00 -0.5122740113
#> 15 survival::strata(AGE)AGE=67  -1.7065320 1.132933e+00 -1.5062959259
#> 16 survival::strata(AGE)AGE=68  -1.5389556 1.104752e+00 -1.3930331338
#> 17 survival::strata(AGE)AGE=69  -1.1214615 1.136235e+00 -0.9869979981
#> 18 survival::strata(AGE)AGE=70 -18.2495027 2.607234e+03 -0.0069995634
#> 19 survival::strata(AGE)AGE=71  -1.3835479 1.085266e+00 -1.2748469333
#> 20 survival::strata(AGE)AGE=72  -1.5861528 1.109620e+00 -1.4294562988
#> 21 survival::strata(AGE)AGE=73  -1.3311583 1.078529e+00 -1.2342349648
#> 22 survival::strata(AGE)AGE=74  -1.8664225 1.086626e+00 -1.7176312590
#> 23 survival::strata(AGE)AGE=75  -1.0701874 1.094268e+00 -0.9779939016
#> 24 survival::strata(AGE)AGE=76  -1.5673346 1.094736e+00 -1.4317009758
#> 25 survival::strata(AGE)AGE=77  -1.6854602 1.064611e+00 -1.5831705057
#> 26 survival::strata(AGE)AGE=78  -1.3770729 1.070742e+00 -1.2860927604
#> 27 survival::strata(AGE)AGE=79  -1.4209295 1.057330e+00 -1.3438841443
#> 28 survival::strata(AGE)AGE=80  -1.0569092 1.073982e+00 -0.9841035589
#> 29 survival::strata(AGE)AGE=81  -2.4638433 1.083968e+00 -2.2729862787
#> 30 survival::strata(AGE)AGE=82  -1.9384962 1.095070e+00 -1.7702034739
#> 31 survival::strata(AGE)AGE=83  -0.9201888 1.089830e+00 -0.8443416072
#> 32 survival::strata(AGE)AGE=84  -1.4853330 1.059185e+00 -1.4023361544
#> 33 survival::strata(AGE)AGE=85  -1.5477944 1.140473e+00 -1.3571508894
#> 34 survival::strata(AGE)AGE=86  -2.2322079 1.172337e+00 -1.9040670529
#> 35 survival::strata(AGE)AGE=87  -2.6816908 1.423263e+00 -1.8841844010
#> 36 survival::strata(AGE)AGE=88 -18.7682740 2.704813e+03 -0.0069388434
#> 37 survival::strata(AGE)AGE=89 -18.1983764 1.889752e+04 -0.0009630034
#>         p.value
#> 1  8.520988e-10
#> 2  1.757712e-07
#> 3  9.972649e-01
#> 4  8.826299e-01
#> 5  1.398224e-01
#> 6  3.285155e-01
#> 7  9.961545e-01
#> 8  2.859471e-01
#> 9  2.002429e-01
#> 10 3.243227e-01
#> 11 1.674629e-01
#> 12 2.434530e-01
#> 13 1.301948e-01
#> 14 6.084593e-01
#> 15 1.319912e-01
#> 16 1.636098e-01
#> 17 3.236436e-01
#> 18 9.944152e-01
#> 19 2.023634e-01
#> 20 1.528731e-01
#> 21 2.171154e-01
#> 22 8.586389e-02
#> 23 3.280773e-01
#> 24 1.522294e-01
#> 25 1.133826e-01
#> 26 1.984107e-01
#> 27 1.789859e-01
#> 28 3.250646e-01
#> 29 2.302701e-02
#> 30 7.669325e-02
#> 31 3.984785e-01
#> 32 1.608149e-01
#> 33 1.747333e-01
#> 34 5.690145e-02
#> 35 5.954004e-02
#> 36 9.944636e-01
#> 37 9.992316e-01