From ggrothendieck at gmail.com  Sun Aug 22 13:32:21 2010
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sun, 22 Aug 2010 07:32:21 -0400
Subject: [Rd] nls.control(warnOnly = TRUE) gives error rather than
	warning
In-Reply-To: <AANLkTikLqc0sz3dUvy7KqdY+EF1-j_6J5z3mTk0r3xfR@mail.gmail.com>
References: <AANLkTikLqc0sz3dUvy7KqdY+EF1-j_6J5z3mTk0r3xfR@mail.gmail.com>
Message-ID: <AANLkTimn58XycyAXbVA8S53uu+a6-aHn9sf_asF8oVDd@mail.gmail.com>

On Sun, Aug 22, 2010 at 7:30 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> In ?nls.control it says:
>
> warnOnly a logical specifying whether nls() should return instead of
> signalling an error in the case of termination before convergence.
> Termination before convergence happens upon completion of maxiter
> iterations, in the case of a singular gradient, and in the case that
> the step-size factor is reduced below minFactor.
>
> however,
>
> 1. here we have a singular gradient but it gave an error rather than
> the expected behavior of returning:
>
>> set.seed(1)
>> y <- exp(x) + rnorm(10)
>>
>> nls(y ~ a * exp(b * x), start = c(a = 0, b = 0),
> + control = nls.control(warnOnly = TRUE))
> Error in nlsModel(formula, mf, start, wts) :
> ?singular gradient matrix at initial parameter estimates
>
> 2. and here we have a failure in numericDeriv and although that is not
> documented as one of the conditions I think it would be desirable that
> it be included as something that does not result in an error when
> warnOnly = TRUE:
>
>> nls(y ~ a * exp(b * x), start = c(a = 10, b = 0),
> + control = nls.control(warnOnly = TRUE))
> Error in numericDeriv(form[[3L]], names(ind), env) :
> ?Missing value or an infinity produced when evaluating the model
>

In the above:

x <- 1:10



[Rd] nls.control(warnOnly = TRUE) gives error rather than warning
Gabor Grothendieck