hazard.ratio {survcomp}R Documentation

Function to compute the D index

Description

Function to compute the hazard ratio for a risk prediction.

Usage

hazard.ratio(x, surv.time, surv.event, weights, strat, alpha = 0.05, na.rm = FALSE, ...)

Arguments

x a vector of risk predictions.
surv.time a vector of event times.
surv.event a vector of event occurence indicators.
weights weight of each sample.
strat stratification indicator.
alpha apha level to compute confidence interval.
na.rm TRUE if missing values should be removed.
... additional parameters to be passed to the coxph function.

Details

The hazard ratio is computed using the Cox model.

Value

hazard.ratio hazard ratio estimate.
se standard error of the estimate.
lower lower bound for the confidence interval.
upper upper bound for the confidence interval.
p.value p-value for the statistical test if the estimate if different from 0.5.
n number of samples used for the estimation.
coxm coxph.object fitted on the survival data and x (see below).
data list of data used to compute the hazard ratio (x, surv.time and surv.event).

Author(s)

Benjamin Haibe-Kains

References

Cox, D. R. (1972) "Regression Models and Life Tables", Journal of the Royal Statistical Society Series B, 34, pages 187–220.

See Also

coxph, coxph.object

Examples

set.seed(12345)
age <- rnorm(100, 50, 10)
stime <- rexp(100)
cens   <- runif(100,.5,2)
sevent  <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
strat <- sample(1:3, 100, replace=TRUE)
hazard.ratio(x=age, surv.time=stime, surv.event=sevent, strat=strat)

[Package survcomp version 1.0 Index]