Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of optimizers other than those in optim #200

Open
colinorourke opened this issue Nov 27, 2024 · 1 comment
Open

Implementation of optimizers other than those in optim #200

colinorourke opened this issue Nov 27, 2024 · 1 comment

Comments

@colinorourke
Copy link

It would be a great enhancement to allow users to access additional optimizers, such as those wrapped by the optimx package, if it is available. This would open the door to a wider array of optimization methods and even enable users to compare the performance of multiple routines, which can be particularly useful for challenging models.

I understand the hesitation to introduce a hard dependency, but optimx could be included as a suggested package. This way, core functionality would remain unaffected for users who don’t need this feature. In my experience, while BFGS and other optim methods often perform adequately, they can struggle in certain scenarios where alternatives might succeed. Allowing access to these tools would enhance the versatility and robustness of flexsurv.

@chjackson
Copy link
Owner

I agree this would be a beneficial feature, if it were implemented in a clean modular way.

For advanced users who want to might try different optimisation algorithms, it's already feasible to do this with a bit of work. You could define your own objective function using flexsurvreg(...,inits=...,fixedpars=TRUE) to compute (but not maximise) the likelihood given initial values. That could be maximised with any algorithm.

Then to make use of the output summary/prediction functions in flexsurv, you would need to take a model object fitted using one of the built-in algorithms, then substitute the new estimates into the relevant components of the object (see https://chjackson.github.io/flexsurv/reference/flexsurvreg.html#value).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants