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 numerical and exact 
gradients.  This can happen when the gradients are very large.  

I would check this again separately as follows:

require(numDeriv)

mygrad <-  gr.fy(theta0)

numgrad <- grad(x=theta0, func=gr.fy)

cbind(mygrad, numgrad)

all.equal(mygrad, numgrad)

Can you report these gradients to us?

In "optimx", we should probably change this into a "warning" rather than a 
"stop". 

Ravi.

-------------------------------------------------------
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins 
University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to