hazard.ratio {survcomp} | R Documentation |
Function to compute the hazard ratio for a risk prediction.
hazard.ratio(x, surv.time, surv.event, weights, strat, alpha = 0.05, method.test = c("logrank", "likelihood.ratio", "wald"), na.rm = FALSE, ...)
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 |
|
... |
additional parameters to be passed to the |
The hazard ratio is computed using the Cox model.
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 |
|
data |
list of data used to compute the hazard ratio ( |
Benjamin Haibe-Kains
Cox, D. R. (1972) "Regression Models and Life Tables", Journal of the Royal Statistical Society Series B, 34, pages 187–220.
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)