R Coxph Timescale at Risk

39 views Asked by At
library(survival)
set.seed(1)
STARTAGE = sample(20:60, 100, T)
ENDAGE = sample(5:20, 100, T)
STATUS = sample(0:1, 100, T)
X1 = sample(1:3, 100, T)
X2 = sample(1:10, 100, T)

MODEL1 = survfit(Surv(ENDAGE, STATUS) ~ 1)
plot(MODEL1)
MODEL2 = survfit(Surv(ENDAGE, STARTAGE, STATUS) ~ 1)
plot(MODEL2)

In this example I build survival curves. When you plot you see risk starts at 0 but it should start at STARTAGE as this is the first time when the ID is at risk...How Do I Edit This?

0

There are 0 answers