getHRandCIfromCoxph: Extract Hazard Ratio and Confidence Intervals from Cox Model

View source: R/getHRandCIfromCoxph.R

getHRandCIfromCoxphR Documentation

Extract Hazard Ratio and Confidence Intervals from Cox Model

Description

Extracts hazard ratio (HR) and 95 Cox proportional hazards model.

Usage

getHRandCIfromCoxph(coxphData)

Arguments

coxphData

Fitted Cox model object from 'survival::coxph()'.

Value

Data frame with p-values, HR, and confidence intervals.

Author(s)

Dorothee Nickles

Dongqiang Zeng

Examples

library(survival)
set.seed(123)
df <- data.frame(
  TTE = rexp(200, rate = 0.1),
  Cens = rbinom(200, size = 1, prob = 0.7),
  group = sample(c("Treatment", "Control"), 200, replace = TRUE)
)
coxphData <- survival::coxph(survival::Surv(TTE, Cens) ~ group, data = df)
results <- getHRandCIfromCoxph(coxphData)
print(results)

IOBR documentation built on May 30, 2026, 5:07 p.m.