[R] error in function: nls (urgent)

John C Nash nashjc at uottawa.ca
Thu Nov 20 16:28:46 CET 2008


Doug Bates and I have exchanged ideas on the issue of singularities in nonlinear models a number of times over the years. Both perspectives are "right", and though I will characterize them as adversarial, they are really complementary. These views can be overly simplified as 
- if there's a singularity, something's wrong (DB)
- if you can minimize the objective you should (JN)

Thesse attitudes result in somewhat different output, and the JN attitude can often have multiple solutions (even an infinity of solutions in some cases), akin to collinearity in linear models. It is a minimization attitude rather than a statistical usefulness viewpoint.

Sometimes in some problems, the singularity is local in the parameter space and a suitable solution can be found by different starting point(s). I've found crude minimizers, like the Nelder-Mead approach, often work better for these problems, but prepare to go have a coffee while it chugs along. However, NM only gives you a set of parameters, with no variability measures like nls. You may be able to use the results as initial info to nls to get more info, but if the singularity is at the solution, you need to think how to explain your results.

John Nash

>>>>>>>>>
From: "Douglas Bates" <bates at stat.wisc.edu>
Subject: Re: [R] error in function: nls (urgent)
To: tedzzx <zengzhenxing at gmail.com>
Cc: r-help at r-project.org
Message-ID:
	<40e66e0b0811191243v192a97bbq215f0e719db95d2d at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Nov 18, 2008 at 6:19 AM, tedzzx <zengzhenxing at gmail.com> wrote:


> > Hi,all:
> > I am running a nonlinear regression and there is a problem.
>   

Yes.  The problem is that there is a singular gradient matrix at the
initial parameter estimates.  You will need to modify your function or
your initial parameter estimates.


> > There is a data frame: data
> >     p       s     x          t
> > 1  875.0 12392.5 11600 0.06967213
> > 2  615.0 12332.5 12000 0.06967213
> > 3  595.0 12332.5 12000 0.06967213
> > 4  592.5 12337.0 12000 0.06967213



More information about the R-help mailing list