chjackson / flexsurv

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

Analytic second derivatives #170

Closed chjackson closed 12 months ago

chjackson commented 1 year ago

It would be good to implement analytic second derivatives of the likelihood with respect to the parameters, for all survival distributions where these can be obtained. For example, the distributions for which the first derivatives are currently implemented. The second derivatives are used to calculate the Hessian at the estimates, which is currently obtained by numerical differentation. Analytic derivatives would be expected to be more accurate. This would give more accurate standard errors and confidence intervals.

Optionally these might also be used as part of a Newton-Raphson or other optimisation method which employs second derivatives. Though I don't know if we would expect this to be better than the the current default optimisation method of BFGS with derivatives.

chjackson commented 12 months ago

Analytic Hessians implemented in https://github.com/chjackson/flexsurv/commit/3d6c0947d2aa8b6bc24c11aa2c97acef97419e7d but no new optimisation method included.