Dear s-plus users,
please let me summarize the response I got to my question which was:
-------------------------------------------------------------------------------------------------------------
> May I ask you to support me in extracting "parameters" from the survfit
> output. This is a simplified example:
>
>
> > within <- survfit(Surv(daysfda, censfda) ~ treatmentcode, data =
> survival.df)
> > within
> Call: survfit(formula = Surv(daysfda, censfda) ~ treatmentcode, data =
> survival.df)
>
> n events mean se(mean) median 0.95LCL 0.95UCL
> treatmentcode=0 398 31 408 5.65 NA NA NA
> treatmentcode=1 696 22 426 3.02 NA NA NA
>
> How to extract "mean" survival as a variable from this output? Something like
> "within$mean"?
>
>
---solution-------------------------------------------
The solution was provided by Terry Therneau:
> within <- survfit(Surv(daysfda, censfda) ~ treatmentcode, data =
survival.df)
> within
Call: survfit(formula = Surv(daysfda, censfda) ~ treatmentcode, data =
survival.df)
n events mean se(mean) median 0.95LCL 0.95UCL
treatmentcode=0 398 31 408 5.65 NA NA NA
treatmentcode=1 696 22 426 3.02 NA NA NA
> temp <- summary(within)
Now there is an object temp$table that contains the printout above. It
is a matrix with column labels of "n", "mean", etc.
This is in the same flavor as lm(), where the fitted object contains
enough information to create the printout, but summary() actually puts
it together.
Terry Therneau
------------------------------------------------------------------------
Best regards
Ansgar Hebborn
F. Hoffmann-La Roche AG
Pharma Division
PBSE (Global Health Economics & Strategic Pricing)
B 74/4.OG-O
CH-4070 Basel
Switzerland
T +41-61-68.80396
T +41-61-68.82321
E ansgar.hebborn@roche.com
|