[R] skip non-converging nls() in a list

Gabor Grothendieck ggrothendieck at gmail.com
Mon Feb 18 19:55:36 CET 2008


See warnOnly in ?nls.control

On Feb 18, 2008 1:45 PM, Marc Belisle <marc.m.belisle at usherbrooke.ca> wrote:
> Howdee,
>
> My question appears at #6 below:
>
> 1. I want to model the growth of each of a large number of individuals using
> a 4-parameter logistic growth curve.
>
> 2. nlme does not converge with the random structure that I want to use.
>
> 3. nlsList does not converge for some individuals.
>
> 4. I decided to go around nlsList using:
>
> t(sapply(split(data, list(data$id)),
>    function(subd){coef(nls(mass ~ SSfpl(age, A, B, xmid, scal), data =
> subd))}))
>
> 5. This does not converge either:
>
> 'Error in nls(y ~ cbind(1, 1/(1 + exp((xmid - x)/exp(lscal)))), data = xy,
> :
>        singular gradient'
>
> 6. Would anyone know if I can get R to skip non-converging use of nls() so
> that I can at least obtain the parameters for the curves which R can fit?
>
> Thanks for your time,
>
> Marc
>
> ===================
> Marc Bélisle
> Professeur adjoint
> Chaire de recherche du Canada en écologie spatiale et en écologie du paysage
> Département de biologie
> Université de Sherbrooke
> 2500 Boul. de l'Université
> Sherbrooke, Québec
> J1K 2R1 Canada
>
> Tél: +1-819-821-8000 poste 61313
> Fax: +1-819-821-8049
> Courriél: Marc.M.Belisle at USherbrooke.ca
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list