Xunivcoxph: Univariate cox proprtional hazards model

View source: R/utils_coxph.R

XunivcoxphR Documentation

Univariate cox proprtional hazards model

Description

Concatenates hazard ratios and confidence limits for every covariate in a Cox model.

Usage

Xunivcoxph(mod, digits = 3)

Arguments

mod

model fit object, returned from either coxph or coxphf.

digits

number of digits to round

Value

Hazard ratio and 95/% confidence interval

Author(s)

Aline Talhouk, Derek Chiu

Examples

library(survival)
library(coxphf)
# One predictor
test1 <- list(
  time = c(4, 3, 1, 1, 2, 2, 3),
  status = c(1, 1, 1, 0, 1, 1, 0),
  x = c(0, 2, 1, 1, 1, 0, 0),
  sex = c(0, 0, 0, 0, 1, 1, 1)
)
mod <- coxph(Surv(time, status) ~ x + strata(sex), test1)
Xunivcoxph(mod)

# Multiple predictors
bladder1 <- bladder[bladder$enum < 5, ]
mod <- coxph(Surv(stop, event) ~ (rx + size + number) * strata(enum) +
cluster(id), bladder1)
Xunivcoxph(mod, digits = 2)

# Firth's correction
test2 <- data.frame(list(
  start = c(1, 2, 5, 2, 1, 7, 3, 4, 8, 8),
  stop = c(2, 3, 6, 7, 8, 9, 9, 9, 14, 17),
  event = c(1, 1, 1, 1, 1, 1, 1, 0, 0, 0),
  x    = c(1, 0, 0, 1, 0, 1, 1, 1, 0, 0)
))
mod <- coxphf(formula = Surv(start, stop, event) ~ x, pl = FALSE,
data = test2)
Xunivcoxph(mod)

TalhoukLab/biostatUtil documentation built on April 14, 2025, 4:15 a.m.