Skip to contents

Pulls one coefficient out of an ordinary Cox fit and exponentiates it, returning one tidy forest row. Used for the conventional analyses (M1–M5), each of which reports the hazard ratio of a single treatment term.

Usage

hr_term(fit, exposure, method)

Arguments

fit

A survival::coxph() fit.

exposure

Name of the coefficient to report (e.g. "drug1" or "drug2").

method

A label for this row (appears on the forest plot).

Value

A one-row tibble with columns method, hr, lo, hi.

See also

hr_msm() for the marginal always-vs-never contrast.

Examples

dat <- simulate_hr_agent(n = 2000)
fit <- survival::coxph(survival::Surv(t_start, t_stop, death) ~ drug1, data = dat)
hr_term(fit, "drug1", "Crude (baseline dose)")
#> # A tibble: 1 × 4
#>   method                   hr    lo    hi
#>   <chr>                 <dbl> <dbl> <dbl>
#> 1 Crude (baseline dose) 0.546 0.369 0.808