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

From: Andrew Robinson <A.Robinson_at_ms.unimelb.edu.au>
Date: Tue, 19 Feb 2008 05:51:54 +1100

Hi Marc,

use try()

Cheers

Andrew

On Mon, Feb 18, 2008 at 01:45:35PM -0500, Marc Belisle 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.
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

-- 
Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/

______________________________________________
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.
Received on Mon 18 Feb 2008 - 18:57:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Feb 2008 - 20:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive