[R] Survival analysis: ERROR: Time and status are different lengths

Marleen Hamoen hamoen.m at gmail.com
Thu Dec 3 16:45:25 CET 2015


I am fitting an AFT model assuming a Weibull distribution and I would like
to check the residuals compared to the Kaplan Meier residuals, but when I
try to create the Kaplan Meier residuals I get an error: Time and status
are different lengths.

I am using the following script:

# Fitting the AFT model
fit.weib <- survreg(Surv(TimeDeath, event) ~ age + sex + mutation +
ventilation + BM1 + BM2, data = DF, dist = "weibull")
fits <- fit.weib$linear.predictors
resids <- (fit.weib$y[, 1] - fits)/fit.weib$scale
resKM <- survfit(Surv(resids, event) ~ 1, data = DF)

I get the error from the last line of the script.

I tried some things that didn't work and I was wondering if anyone could
help me.
If you need more information please let me know.

Thanks in advance,


	[[alternative HTML version deleted]]

More information about the R-help mailing list