Skip to content
Prev 307047 / 398506 Next

problem with convergence in mle2/optim function

On 05-10-2012, at 07:12, Adam Zeilinger wrote:

            
After playing with your function, I can't agree with your interpretation of what could be wrong.
During optim iterations your function is dmnom2 is getting negative values for prob and that leads to the error messages.
I checked this by inserting the following lines in NLL.func after the assignment to p.all:

 cat("NLL.func p.all {P1,P2,P3}\n")
 print(matrix(p.all, ncol=3))

At some stage entries for P1, P2, P3 become negative (which ones and how many depends on the random number generator).
Try set.seed(1), set.seed(11) and set.seed(413) to see what happens.

The expressions are too complicated for further analysis.
Assuming your expressions are correct, you will need to restrict P1,P2,P3 to take on valid values.

Berend