Skip to content

model.frame question

1 message · Terry Therneau

#
Brian,
   So let me ask an r-core opinion.  Should I change the default to model=TRUE?  Survival 
is heavily used and there is something to be said for consistency within the central 
packages.  Sometimes old habits die hard, and there is a "save memory" part of me that 
hates to save a large object that likely won't be used.  Not nearly as relevant today as 
when I started my career.

   I agree that the biggest issue with model=FALSE is when someone asks for predictions 
from a saved fit, perhaps saved weeks ago, and the data has changed under our feet.  I 
have a check in predict.coxph that the number of rows in the data hasn't changed, but 
there really is no defense.

    Aside: This would mean in theory that I could also change the default to y= FALSE.  I 
discovered a few years ago that that won't fly, when I set the default for y to "not 
model"; why keep redundant copies?  Several other packages that depend on survival failed. 
  They assume fit$y is there, without checking.  The iron chains of backwards compatability...
This hasn't left me any wiser.  Can you expand?  As stated in another note the real issue was
	fit <- coxph(formula, data=nd)
         predict(fit, type="expected")

within a user's function.  They, not unreasonably, expected it to work without further 
trickery.  It fails because the model.frame call within predict.coxph cannot find "nd".