View source: R/AvgHazardRatios.R
AvgHazardRatios | R Documentation |
This function computes the average treatment-to-total hazard ratio for the time periods before and after a crossing occurs.
AvgHazardRatios(obj)
obj |
An object of class |
The crossing time can either represent a crossing of the survival functions
or a crossing a crossing of the hazard functions. If one wants to use
a crossing time of the survival functions, make sure the
surv.delay
object was obtained from running the DelayedSurvFit
function. Likewise, if one wants to use
a crossing time of the hazard functions, make sure the
surv.delay
object was obtained from running the DelayedHazFit
function.
A list with the following two components
precross.avg |
Average treatment-to-total hazard ratio before the crossing time |
postcross.avg |
Average treatment-to-total hazard ratio after the crossing time |
Nicholas Henderson
set.seed(5172)
### Generate simulated survival data
n <- 400
cens.time <- 8
X1 <- rweibull(n, shape=2.3, scale=7)
X2 <- rweibull(n, shape=.8, scale=10)
Y1 <- pmin(X1, cens.time)
Y2 <- pmin(X2, cens.time)
e1 <- as.numeric(X1 < cens.time)
e2 <- as.numeric(X2 < cens.time)
times <- c(Y1, Y2) ## follow-up times
events <- c(e1, e2) ## event indicators
trt <- rep(c(0,1), each=n) ## treatment arm assignment
dhz.obj <- DelayedHazFit(times, events, trt, max.times=50)
AvgHazardRatios(dhz.obj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.