Skip to content
Prev 261825 / 398502 Next

predict witht he eha package

"Error in predict.coxph(f.ph.eha, newdata = mort, type = "lp") :  Data
is not the same size as it was in the original fit"

This error message was added in a recent update to predict.coxph.  If it
needs to reconstruct some aspects from the original fit, such as the X
matrix or strata vector, it makes sure that the data set is the same
size.  It was to stop
  fit <- coxph(Surv(......     , data=mydata)

   read in a new copy of mydata
  predict(fit) then gives wrong results

One solution is to use model=TRUE in the orignal coxph call, so that no
reconstruction is needed.  The lm() function made model=TRUE the default
at some point for this very reason, the original lm had model=FALSE to
save space.  Whether coxph should make the same change is open to
debate.

Terry Therneau