chjackson / flexsurv

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

[ready to review] safe conversion between hessian and covariance matrix after likelihood minimization #85

Closed kkmann closed 3 years ago

kkmann commented 3 years ago

solve(H) does not handle cases where H is not PD. That should be cought and a warning issues. I propose to accept a tolerance and continue with a positive definite approximation of H^-1 as covariance matrix. This guarantees a PD covariance matrix.

kkmann commented 3 years ago

addendum: chol2inv(chol(H)) does not work when H is not PD. It is a bit harder to define sensible tolerances for the raw Hessian.

kkmann commented 3 years ago

@chjackson I only used the new helper function in flexsurvmix. for sake of consistency, this should probably be handled uniformly across flexsurv?

kkmann commented 3 years ago

@chjackson sorry, I don't seem to be able to request a review, but this should be fine now.