Re: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

From: Ravi Varadhan <>
Date: Wed, 13 Oct 2010 11:28:51 -0400

Try this:

Myfunc2 <- function(rootM,Abund,Loss,OtherM) { # I have scaled the function
(Loss/Abund - (rootM/(rootM+OtherM)*



,0.001,print.level=0,fscale=0, gradtol=1E-10, stepmax = 100.0

This should work quite robustly under various R versions on different platforms.


-----Original Message-----
From: [] On Behalf Of Ravi Varadhan
Sent: Wednesday, October 13, 2010 9:27 AM To: 'Troy Robertson'; '' Subject: Re: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

Hi Troy,

I think that your problem is poorly scaled. You have variables that vary over several orders of magnitude. This means that any small changes (due to subtle differences between R versions) could cause a big difference in the convergence behavior of the algorithms. So, you are asking for trouble and you got it. I would scale the problem such that the parameters, function and its gradient are essentially of the same magnitude.

To paraphrase John Nash, who paraphrased Richard Varga, "It is all about scaling".

Furthermore, I would specify the analytic gradient, which should be very easy to derive.


-----Original Message-----
From: [] On Behalf Of Troy Robertson
Sent: Wednesday, October 13, 2010 1:51 AM To: ''
Subject: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

Hi all,

When upgrading to 2.11.1 recently I noticed different results being produced by my code.
After MUCH digging into my code I have finally narrowed it to a call to nlm().
The problem actually occurs in 2.10.1 and 2.12.0.

This can be replicated by trying the code below in some different versions of R:

Rates<- 0.3102445



,0.001,print.level=0,fscale=0, gradtol=1E-10, stepmax = 100.0


,0.001,print.level=0,fscale=0, gradtol=1E-10, stepmax = 100.0

Why would I be seeing a different value of 'estimate' (or any of the other returned list items)?
Originally I thought it was 2.11.1 that was giving me the grief with different output but now I see that in 2.11.1 I get the same value to each returned list item both ways.
Can anyone explain this?



    Australian Antarctic Division - Commonwealth of Australia IMPORTANT: This transmission is intended for the addressee only. If you are not the
intended recipient, you are notified that use or dissemination of this communication is
strictly prohibited by Commonwealth law. If you have received this transmission in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and
DELETE the message.

        Visit our web site at mailing list mailing list mailing list Received on Wed 13 Oct 2010 - 15:36:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Oct 2010 - 01:30:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive