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

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Function to compute the hazard ratio for a risk prediction.

Usage

1
2
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.

Details

The hazard ratio is computed using the Cox model.

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).

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

Example output

Loading required package: survival
Loading required package: prodlim
$hazard.ratio
[1] 0.9976671

$coef
[1] -0.002335581

$se
[1] 0.01424647

$lower
[1] 0.970195

$upper
[1] 1.025917

$p.value
[1] 0.8697696

$n
[1] 100

$coxm
Call:
coxph(formula = Surv(stime, sevent) ~ strata(sstrat) + sx, weights = sweights)

       coef exp(coef) se(coef)     z    p
sx -0.00234   0.99767  0.01425 -0.16 0.87

Likelihood ratio test=0.03  on 1 df, p=0.87
n= 100, number of events= 70 

$data
$data$x
  [1] 55.9 57.1 48.9 45.5 56.1 31.8 56.3 47.2 47.2 40.8 48.8 68.2 53.7 55.2 42.5
 [16] 58.2 41.1 46.7 61.2 53.0 57.8 64.6 43.6 34.5 34.0 68.1 45.2 56.2 56.1 48.4
 [31] 58.1 72.0 70.5 66.3 52.5 54.9 46.8 33.4 67.7 50.3 61.3 26.2 39.4 59.4 58.5
 [46] 64.6 35.9 55.7 55.8 36.9 44.6 69.5 50.5 53.5 43.3 52.8 56.9 58.2 71.5 26.5
 [61] 51.5 36.6 55.5 65.9 44.1 31.7 58.9 65.9 55.2 37.0 50.5 42.2 39.5 73.3 64.0
 [76] 59.4 58.3 41.9 54.8 60.2 56.5 60.4 47.0 74.8 59.7 68.7 56.7 46.9 55.4 58.2
 [91] 40.4 41.4 68.9 46.1 40.2 56.9 44.9 71.6 44.0 43.1

$data$surv.time
  [1] 0.1772 0.0858 0.3273 0.5311 1.4325 1.4688 0.1122 0.3026 0.8770 0.3910
 [11] 1.1858 0.7370 0.2267 0.0698 0.2519 1.6764 1.7902 0.0692 0.4922 1.0174
 [21] 0.5481 0.1440 1.1760 0.0331 0.2638 0.6286 0.5688 0.2527 0.3513 0.2334
 [31] 0.5813 0.6132 0.0117 0.8969 0.8461 0.6515 0.6231 0.0576 0.8562 0.3821
 [41] 0.6177 0.9645 1.5754 0.0204 0.5384 0.0881 1.6552 1.3080 0.7972 1.2041
 [51] 0.6837 0.5931 0.0127 0.0372 0.4109 0.6632 1.7654 0.6298 0.9595 0.9056
 [61] 0.1973 0.4166 0.3069 0.1548 0.3566 0.5638 1.3510 0.5246 0.8472 1.1544
 [71] 0.3653 0.7238 0.2169 0.2382 1.3072 1.1605 0.0110 1.0911 0.5064 0.4733
 [81] 0.3497 1.6239 0.4594 1.0946 0.3565 0.2532 0.5904 0.0307 0.3694 0.2448
 [91] 0.4406 0.1704 0.1505 0.8269 0.5740 1.3492 1.0962 0.8613 0.4346 0.1761

$data$surv.event
  [1] 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1
 [38] 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1
 [75] 1 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1

survcomp documentation built on Nov. 8, 2020, 4:54 p.m.