0

I'm implementing the code for an extension of the Cox model in R and I need to find the roots of an estimating equation (derivative of the log-likelihood = 0). I managed to get the solution with the nleqslv function of the homonymous package but the algorithm is very slow, it takes some hours to find the solution. I have 18 variables and 1000 observations.

I was wondering whether there exists a way to run nleqslv in parallel to speed up the algorithm.

  • 2
    Probably not. We probably need more information about your problem in order to help. Can you get a Jacobian function to pass to the nleqslv() function? Can you reformulate as a minimization function, for which more options are available? – Ben Bolker Mar 14 '23 at 14:01
  • I passed the jacobian to nleqslv but it was even slower, it's a very complicated function. Now I'm trying to directly minimize the negative loglikelihood with optimParallel, it's a bit faster but still very slow. I think I should check for making the whole code more efficient – Daniele Zampieri Mar 14 '23 at 16:22
  • 18 variables does not sound too difficult. Have you tried just solving as an optimization problem? Also, note that different solvers can have dramatically different performance. Exact gradients can also be essential. A strategy that sometimes works is to try to get a good starting point using a different, simpler estimation method. – Erwin Kalvelagen Mar 15 '23 at 15:34

0 Answers0