Description Usage Arguments Value Author(s) Examples
View source: R/DelayedSurvFit.R
This computes nonparametric estimates of the survival curves in two treatment arms under the constraint that the two survival curves can cross at most one time.
1 2 | DelayedSurvFit(times, events, trt, gamma=NULL, theta.fixed=NULL, max.times=100,
inner.iter=50, final.iter=1000, verbose=TRUE)
|
times |
vector of follow-up times |
events |
vector of event indicators |
trt |
vector of treatment arm assignment |
gamma |
value of the gamma parameter |
theta.fixed |
optional fixed value of theta. Estimated if not provided. |
max.times |
tbf |
inner.iter |
tbf |
final.iter |
tbf |
verbose |
tbf |
an object of class surv.delay
Nicholas Henderson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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
dsf.obj <- DelayedSurvFit(times, events, trt, gamma=-1, theta.fixed=5.8, max.times=100)
km0 <- cumprod(1 - dsf.obj$nevents0/dsf.obj$nrisk0)
km1 <- cumprod(1 - dsf.obj$nevents1/dsf.obj$nrisk1)
plot(dsf.obj)
lines(dsf.obj$times, km0, type="s", lty=2)
lines(dsf.obj$times, km1, type="s", lty=2, col="red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.