Skip to content

Problem plotting curve on survival curve

2 messages · Terry Therneau, Calum

#
Calum had a long question about drawing survival curves after fitting a Weibull 
model, using pweibull, which I have not reproduced.

It is easier to get survival curves using the predict function.  Here is a
simple example:
0    1    2    3 <NA> 
  63  113   50    1    1
The result of predict is a matrix with one row per group and one column per 
quantile.  The final plot uses "99:1" so as to show 1-F(t) = S(t) rather than F.
Don't ask for the 1.0 quantile BTW -- it is infinity and I doubt you want the 
plot to stretch out that far.  The 0.0 quantile can also have issues due to the 
implicit log transform used in many distributions.  
   If I had not used the newdata argument, we would get 227 rows in the result, 
one for each subject.  That is, 63 copies of the ph.ecog==0 curve, 113 of the 
ph.ecog==1 curve, ...  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.
  
  There are several advantages to using the predict function.  The first is that 
the code does not need to change if you decide to use a different distribution.  
The second is that you can add the "se.fit=T" argument to get confidence bounds 
for the curves.  (A couple more lines for your matplot call of course).

	Terry Therneau
	Mayo Clinic
#
Terry Therneau wrote:
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 ;-) )
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.