bbmle icon indicating copy to clipboard operation
bbmle copied to clipboard

provide analytical gradients for formula-based methods

Open bbolker opened this issue 8 years ago • 3 comments

bbolker avatar Nov 29 '16 19:11 bbolker

Hi Ben, thank you for bbmle.

I know it's a while since the last change to this project, but could you give a summary of what would be needed to make this work?

We are implementing a MLE fit function for some custom densities using the model formula interface to mle2() and wondered how hard it would be to include analytical gradients.

mbg-unsw avatar Jun 06 '24 07:06 mbg-unsw

Hmm. I had a student working on a version of this for a while here, but the project is at best 2/3 done. (Since we started on that version RTMB has come out, I would probably build that part of the project on RTMB rather than TMB ...

It's not too hard in principle - you can use built-in deriv, or the derivs package, to derive gradients of the parameters of the conditional distribution with respect to the top-level model parameters, and the gradients of the log-likelihood with respect to the parameters of the conditional distribution with respect to its parameters, then use the chain rule to combine them; something similar is done in the fitode package. The plumbing, and maintaining a reasonable level of backward compatibility, is the hard part ...

bbolker avatar Jun 06 '24 13:06 bbolker

Thanks Ben. When I have a couple of hours I will try to read the code and figure out what still needs doing to meet our requirements.

mbg-unsw avatar Jun 07 '24 01:06 mbg-unsw