I have a function which I maximize using maxlik (maximum likelihood estimation approach) function. Specifically, I provide Gauss the likelihood function and the corresponding first order conditions (user provided gradient function). I was wondering if there is any way to split my data into subsets and compute the corresponding probabilities and first order values and then join them together and pass it to a single maxlik function?.
Maxlikmt and CMLMT are able to do that because they use the same procedure for the likelihood as well as the derivatives. Maxlik uses separate procedures for the likelihood and the derivatives so they can't be joined. It would be possible to have the likelihood procedure compute the derivatives and store them globally, and then have the derivative function retrieve them. However, there are many calls for just the likelihood and you wouldn't save any computation time by computing the derivatives when they weren't going to be used.
The Maxlikmt and CMLMT likelihood/derivative procedure has an indicator telling it which calculation is needed and so time is not wasted computing derivatives when they aren't needed, but allows for not duplicating calculations when they are needed.