chjackson / flexsurv

The flexsurv R package for flexible parametric survival and multi-state modelling
http://chjackson.github.io/flexsurv/
53 stars 28 forks source link

Allow predictions at time zero, fix list-column class #126

Closed mattwarkentin closed 2 years ago

mattwarkentin commented 2 years ago

Hi @chjackson,

As noted by @hfrick over in https://github.com/tidymodels/censored/issues/152#issuecomment-1076215197, there were two issues in predict.flexsurvreg() that I have addressed with this PR:

  1. Some overly strict code in predict.flexsurvreg() did not allow predictions to be made at time zero, which should indeed be allowed as per summary.flexsurvreg(). This has now been fixed.
  2. The nested list-columns which are returned when requesting multiple predictions per subject carried along some additional classes that were not needed. I have now used a safer function for nesting and this issue is resolved.

While I was at it, I worked on cleaning up some of the error messages to be cleaner and more accurate.

Please let me know if you would like to see any changes.

chjackson commented 2 years ago

Thanks, Matt, merged.