SurvFn | R Documentation |
Given a fitted object from either DelayedSurvFit
or DelayedHazFit
, this
will return a step function which represents the estimated survival function
for either the control arm or active treatment arm.
SurvFn(obj, arm = 1)
obj |
An object of class |
arm |
The treatment arm; |
A function of class "stepfun"
Nicholas Henderson
### Generate simulated survival data
## Not run:
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
dfs.obj <- DelayedSurvFit(times, events, trt, max.times=50)
S1 <- SurvFn(dfs.obj, arm=1) # active treatment arm survival function
S0 <- SurvFn(dfs.obj, arm=0) # control treatment arm survival function
## Difference in survival function at time 2
S1(2) - S0(2)
## Difference in survival function at time 5
S1(5) - S0(5)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.