From nashjc at uottawa.ca  Thu Mar 19 14:36:50 2015
From: nashjc at uottawa.ca (Prof J C Nash (U30A))
Date: Thu, 19 Mar 2015 09:36:50 -0400
Subject: [Rd] nls
In-Reply-To: <mailman.21.1426762805.8229.r-devel@r-project.org>
References: <mailman.21.1426762805.8229.r-devel@r-project.org>
Message-ID: <550AD0F2.4010608@uottawa.ca>

nls() is using
1) only a Gauss-Newton code which is prone to some glitches
2) approximate derivatives

Package nlmrt uses symbolic derivatives for expressions (you have to
provide Jacobian code for R functions) and an aggressive Marquardt
method to try to reduce the sum of squares. It does return more
information about the problem (singular values of the final Jacobian
and gradient at the proposed solution) but does NOT return the nls
structured object. And it will usually take more time and computing
effort because it tries hard to reduce the SS.

A reproducible example would get you a more informed response.

John Nash


On 15-03-19 07:00 AM, r-devel-request at r-project.org wrote:
> Date: Wed, 18 Mar 2015 14:14:12 +0200
> From: Evans Otieno Ochiaga <evansochiaga at aims.ac.za>
> To: r-devel at r-project.org
> Subject: [Rd] Help
> Message-ID:
> 	<CAObCh3XfvtCz+qWtSS+pSPrhWtUKtdZoYANN=_4AJndziiiDOQ at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
> 
> Hi to All,
> 
> I am fitting some models to a data using non linear least square, and
> whenever i run the command, parameters value have good convergence but I
> get the  error in red as shown below. Kindly how can I fix this problem.
> 
> 
> Convergence of parameter values
> 
> 0.2390121 :  0.1952981 0.9999975 1.0000000
> 0.03716107 :  0.1553976 0.9999910 1.0000000
> 0.009478433 :  0.2011017 0.9999798 1.0000000
> 0.004108196 :  0.2640111 0.9999693 1.0000000
> 0.003705189 :  0.2938360 0.9999652 1.0000000
> 0.003702546 :  0.2965745 0.9999650 1.0000000
> 0.003702546 :  0.2965898 0.9999650 1.0000000
> 0.003702546 :  0.2965898 0.9999650 1.0000000
> 0.003702546 :  0.2965898 0.9999650 1.0000000
> 
> Error in nls(Occupancy ~ 1 - (theta * beta^(2 * Resolution^(1/2)) *
> delta^Resolution),  :
>   step factor 0.000488281 reduced below 'minFactor' of 0.000976562
> 
> Regards,
> 
> 
> 
> 
> *Evans Ochiaga*



[Rd] nls
Prof J C Nash (U30A