survcomp (version 1.22.0)

hazard.ratio: Function to estimate the hazard ratio through Cox regression

Description

Function to compute the hazard ratio for a risk prediction.

Usage

hazard.ratio(x, surv.time, surv.event, weights, strat, alpha = 0.05, method.test = c("logrank", "likelihood.ratio", "wald"), na.rm = FALSE, ...)

Arguments

x
a vector of risk predictions.
surv.time
a vector of event times.
surv.event
a vector of event occurrence indicators.
weights
weight of each sample.
strat
stratification indicator.
alpha
apha level to compute confidence interval.
method.test
Statistical test to use in order to compute the p-values related to a D. index, see summary.coxph for more details.
na.rm
TRUE if missing values should be removed.
...
additional parameters to be passed to the coxph function.

Value

hazard.ratio
hazard ratio estimate.
coef
coefficient (beta) estimated in the cox regression model.
se
standard error of the coefficient (beta) estimate.
lower
lower bound for the confidence interval.
upper
upper bound for the confidence interval.
p.value
p-value computed using the likelihood ratio test whether the hazard ratio is different from 1.
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).

Details

The hazard ratio is computed using the Cox model.

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

Run this code
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)
weight <- runif(100, min=0, max=1)
hazard.ratio(x=age, surv.time=stime, surv.event=sevent, weights=weight,
  strat=strat)

Run the code above in your browser using DataLab