[R] Problem plotting curve on survival curve
Calum
stats at wittongilbert.free-online.co.uk
Tue Mar 4 00:24:00 CET 2008
Terry Therneau wrote:
>
> It is easier to get survival curves using the predict function. Here is a
> simple example:
>> tfit <- survreg(Surv(time, status) ~ factor(ph.ecog), data=lung)
>> tdata <- data.frame(ph.ecog=factor(0:3))
>> qpred <- predict(tfit, newdata= tdata, type='quantile', p=1:99/100)
>> matplot(t(qpred), 99:1/100, type='l')
>
Many thanks - that worked at treat... (One day I might work out what it
does - for now I'm happy it does it!) In terms of when I write up what I
did is this still a weibull regression? help(predict.survreg) just
calls it a quantile... (Sorry that may be dumb question ;-) )
> The above fit assumed a common shape for the 4 groups,
> you can add a "+ strata(ph.ecog)" term to have a separate scale for each group;
> this would give the same curves as 4 separate fits to the subgroups.
Any thoughts on which is scientifically more valid? I'd have thoughts 4
separate shapes? Certainly if I'm modeling drugs - its surely possible
that a new drug might change the course of disease and therefore the
shape of the curve altogether?
Brings me back to my extra question - is there any way to determine
quality of the fit for this (like an R^2 value for a linear regression).
That might answer if a strata approach is needed.
More information about the R-help
mailing list