[R] nls.lm

ProfJCNash profjcnash at gmail.com
Fri Oct 21 14:41:04 CEST 2016


Berend's point is well-taken. It's a lot of work to re-jig a code, especially one more than
30 years old.

On the other hand, nlmrt is all-R, and it does more or less work on underdetermined systems as I
illustrated in a small script. The changes needed to treat the problem as Mike suggests are
pretty easy, but they imply that some aspects of the modeling computations have to be omitted.
Mike: If you give that a try, I'd be interested in outcomes, and am willing to answer questions
on how the code works.

Indeed, I want to include the sort of "diagnostics" that allow underdetermined systems
in my packages, so that some results are replaced with NA or NULL and helpful warnings rather
than "Failed m<n" are reported.

Best, JN

On 16-10-21 03:39 AM, Berend Hasselman wrote:
> 
>> On 21 Oct 2016, at 06:00, Mike meyer <1101011 at gmx.net> wrote:
>>
>> Let's take a different view of the problem.
>> Given f=(f_1,...,f_m):R^n -> R^m we want to minimize ||f(x)||.
>>
>> What distinguishes this from a general minimization problem is that you know the structure of the
>> objective function F(x)=||f(x)||² and have the individual constituents f_j.
>> Make use of that information as appropriate.
>>
>> This is more general than trying to solve the system f(x)=0 or fitting a model to data.
>> In this more general setting notions such as underdetermined/overdetermined system do not apply.
>>
>> The restricted view of model fitting serves only to confuse the issue.
>> For that reason it is (in my view) a bad idea to force the user to set up his problem in 
>> R-model notation.
>>
> 
> I assume that you have been referring to the R package minpack.lm.
> 
> I've had a look at the underlying Fortran code (from Minpack and developed by More et.al.  made in a distant past) as used by the package.
> That underlying code returns an error when the condition:  number of functions (m)  >=  the number of independent variables (n)
> is not satisfied i.e. when m < n.
> 
> Making that more general would entail a lot of thinking and reworking of the code. As far as I can see it is not possible to just remove the condition m>=n from the underlying Fortran. More (possibly many) changes would be required. Blaming R and/or the package author/maintainer is unfair.
> 
> If you require a more general version of the algorithm or if you want something else you will have to roll your own package/code.
> If you don't feel that minpack.lm is appropriate for your application and you want changes you'll have to discuss matters with Moré (http://www.mcs.anl.gov/~more/) if I got the correct link.
> 
> Berend
>



More information about the R-help mailing list