Hi Harold,
Hans is right. You can see this if you use BB::spg
require(BB)
opt2 - spg(startVal, fn) # this is fine
opt3 - spg(startVal, fn,gradient) # this is not fine!
opt3 - spg(startVal, fn, gradient)
Gradient check details: max. relative difference in gradients= 0.001697913
I have constructed the function mml2 (below) based on the likelihood function
described in the minimal latex I have pasted below for anyone who wants to look
at it. This function finds parameter estimates for a basic Rasch (IRT) model.
Using the function without the gradient, using either
Your function named 'gradient' is not the correct gradient. Take as an
example the following point x0, very near to the true minimum,
x0 - c(-0.2517964, 0.4898680, -0.2517962, 0.4898681, 0.7500995)
then you get
gradient(x0)
[1] -0.0372110470 0.0001816991 -0.0372102284
3 matches
Mail list logo