[R] Stratified Survival Estimates

Thomas Lumley tlumley at u.washington.edu
Wed Aug 11 18:53:58 CEST 2004

On Wed, 11 Aug 2004, Erick Edwards wrote:

> Using R version 1.8.1 for Windows, I obtain an error message using the

It would be worth upgrading, though it wouldn't fix this particular

> following code.  The data frame was constructed in the counting process
> style, where V1 is the start time, V2 is the stop time, and V3 is the
> censoring indicator.  There are no zero-length time intervals.
> Variable V4 is the stratification factor (gender: F,M).
> S<-Surv(V1,V2,V3)
> fit<-survfit(S ~ V4,data=test.dat)
> summary(fit) produces the following error message:
> Call: survfit(formula = S ~ V4)
>                 V4=F
> Error in as.matrix(x) : (subscript) logical subscript too long
> I need to be able to write the survival curve for each stratum to a an
> external file.

You should still be able to get the survival curves written out.

fit[1]$time and fit[1]$surv give time and survival for the first stratum,
fit[2]$time and fit[2]$surv for the second stratum.

Thanks for the bug report.


More information about the R-help mailing list