> I am having trouble with obtaining convergence
> of the nls() routine .
>
> The routine appears to reach a solution
> (or rather it looks good enough for me....)
> but its converence criteria does not register
> this fact. The output is included at the end
> of this mail.
>
> My question is twofold :-
>
> (1) how can I get the nls() routine to stop without
> falling over ( e.g. instead of producing error
> message it just finishes, so that _I_ can decide if
> convergence is reached. I need to do this for
> 100 data sets, so manual options are not on. ) ?
>
change
if(z$control[5])
stop(switch(as.integer(z$control[5]),
"step factor reduced below minimum",
"maximum number of iterations exceeded",
"singular gradient matrix",
"singular design matrix",
"singular gradient matrix"))
nls.out <- list(parameters = z$parameters, formula = .expr, call =
match.call(), residuals = z$outmat[, 1])
to
conv <- stop(switch(as.integer(z$control[5]+1),
"success"
"step factor reduced below minimum",
"maximum number of iterations exceeded",
"singular gradient matrix",
"singular design matrix",
"singular gradient matrix"))
if(z$control[5]) warning(conv)
nls.out <- list(parameters = z$parameters, formula = .expr, call =
match.call(), residuals = z$outmat[, 1], convergence=conv)
> (2) what is the current convergence criterion
> ( I can find no mention of details in any of the
> documentation I have access to) ?
Have you tried:
REFERENCES:
Chambers, J. M., and Hastie, T. J. (eds) (1992).
Statistical Models in S, Chapter 10, "Nonlinear Models".
Pacific Grove, CA.: Wadsworth & Brooks/Cole.
It gives the details, via a reference to Bates & Watts. Essentially
it is that the parameters are stable to within a small multiple of their
standard error. One of your parameters is going to zero; without
knowing the model it looks as if that might be a problem and you may
need to re-parametrize.
-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news