coxphOut: Nice output from Cox regression object

View source: R/utils_coxph.R

coxphOutR Documentation

Nice output from Cox regression object

Description

Nicely formatted output from a Cox regression object, either coxph or coxphf.

Usage

coxphOut(object, coefnames = NULL, conf.level = 0.95, digits = 2)

Arguments

object

a model fit object returned from coxph or coxphf

coefnames

a vector of labels for the coefficient names returned by the fit. NULL by default, uses original coefficient names.

conf.level

confidence level for hazard ratio. Defaults to 95%.

digits

number of digits to round to

Details

For objects of class coxphf, the calculation of the number of events used in the fit is slightly different.

Value

A matrix with a row for each coefficient, and a column for each of the following elements

n

the number of observations used in the fit.

events

the number of events used in the fit.

coef

log hazard ratio

se

standard error of coef

Z-Score

Wald test statistic

P-value

p-value for Z-Score

HR

hazard ratio

Lower CI Limit

Defaults to ⁠2.5 \%⁠

Upper CI Limit

Defaults to ⁠97.5 \%⁠

Author(s)

Aline Talhouk, Derek Chiu

Examples

library(survival)
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))

# Stratified
mod1 <- coxph(Surv(time, status) ~ x + strata(sex), test1)
coxphOut(mod1)

# Not stratified
mod2 <- coxph(Surv(time, status) ~ x + sex, test1)
coxphOut(mod2, coefnames = c("x", "gender"))

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