Re: [R] gradient function in OPTIMX

2011-08-30 Thread John C Nash
optimx uses exactly the same code as optim for BFGS. However, the call to optim in optimx is preceded by a check of the gradient at the starting values supplied using numDeriv. That is, we evaluate the gradient with gr=(user's function for gradient) and then with the grad() function from numDer

Re: [R] gradient function in OPTIMX

2011-08-30 Thread Rubén Roa
Hi, In my package CatDyn, which uses optimx, I included the gradients of 20 version of the model involved. I estimate model parameters with numerical gradients, and at the final estimates I calculate the analytical gradients. In the simplest version of the model the analytical gradients computed

Re: [R] Gradient function in OPTIMX

2011-08-30 Thread Ravi Varadhan
Hi Kathie, The gradient check in "optimx" checks if the user specified gradient (at starting parameters) is within roughly 1.e-05 * (1 + fval) of the numerically computed gradient. It is likely that you have correctly coded up the gradient, but still there can be significant differences b/w num