[R] problem-nlme

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Wed May 24 23:02:04 CEST 2006


Gabriela,

it may be that the model that you are trying to fit is vey complex.
Try something simpler.  Note that the default setting for the random
effects is the same as the fixed effects.  In my experience this is a
very difficult model to fit, especially for the Richards and von
Bertalanffy models. So, try a simpler model, and build from there.

Eg

Rich.nlme.linf <- nlme(size ~ Rich(age, Linf, K, t0, m), 
                       data = L.gd,                            
                       fixed = Linf + K + t0 + m ~ 1,
                       random = Linf ~ 1,
                       start = list(fixed = c(900, 0.3,-3,0.9))) 


Good luck!

Andrew

On Wed, May 24, 2006 at 06:30:43PM +0000, gabriela escati pe?aloza wrote:
> Hi,
> I have great problems with my work in R.
> I look for to model the growth of fish.
> I have "Longitudinal data", a serie of repeated
> measures for each individual.
> Using the corresponding packages "nlme" in R.
> I treat to fit to the data different growth functions,
> wich were entered by me.
> Unfortunately for no it was arrived at the
> convergence, several error messages appeared.
> 
> I am going to display the growth functions so as they
> were entered and a "nlme" call example:
> 
> # differents growth function
> 
> #vonBertlalanffy
> vonBert<- function(x, Linf, K, t0)
> Linf*(1-exp(-K*(x-t0)))
> 
> size ~ vonBert(age, Linf, K,t0)
> 
> vonBert <-deriv(~ Linf*(1-exp(-K*(x-t0))), 
>       c("Linf","K","t0"),function(x,Linf,K,t0){})
> 
> vonBertInit <-  function(mCall, LHS, data)
>   {
> xy <- sortedXyData(mCall[["x"]], LHS, data)
>     Linf <- 900
>     if (Linf != max(xy[,"y"])) Linf <- -Linf
>     K <- 0.3
>     t0<-0
>     value <- c(Linf, K, t0)
>     names(value) <- mCall[c("Linf", "K","t0")]
>     value
>  }
> 
> vonBert <- selfStart(vonBert, initial = vonBertInit)
> 
> class(vonBert)
> 
> 
> #Richards
> Rich <- function(x, Linf, K, t0, m)
> Linf*(1-exp(-K*(x-t0)))^(1/(1-m))
> 
> size ~ Rich(age, Linf, K, t0, m)
>  
> Rich <-deriv(~ Linf*(1-exp(-K*(x-t0)))^(1/(1-m)), 
>      
> c("Linf","K","t0","m"),function(x,Linf,K,t0,m){})
> 
> RichInit <-  function(mCall, LHS, data)
>   {
> xy <- sortedXyData(mCall[["x"]], LHS, data)
>     Linf <- 900
>     if (Linf != max(xy[,"y"])) Linf <- -Linf
>     K <- 0.3
>     t0<-0
>     m <- 0.3
>     value <- c(Linf, K, t0, m)
>     names(value) <- mCall[c("Linf", "K","t0","m")]
>     value
>  }
> 
> Rich <- selfStart(Rich, initial = RichInit)
> 
> class(Rich)
> 
> #call
> Rich.nlme <- nlme(size ~ Rich(age, Linf, K, t0, m),
> 	data = L.gd,
> 	fixed = Linf + K +t0 +m~ 1,
>       start = list(fixed = c(900, 0.3,-3,0.9)))
> 
> #error message
> Error: Singularity in backsolve at level 0, block 1
> In addition: Warning message:
> NaNs produced in: log(x)
> 
> 
> What is the problem? I do not understand that it is
> what is bad: the data, the entered growth functions,
> some specification...
> I will thank for any contribution of information.
> 
> 
> Lic. Gabriela Escati Pe?aloza
> Biolog?a y Manejo de Recursos Acu?ticos
> Centro Nacional Patag?nico(CENPAT). 
> CONICET
> Bvd. Brown s/n?.
> (U9120ACV)Pto. Madryn 
> Chubut
> Argentina
> 
> Tel: 54-2965/451301/451024/451375/45401 (Int:277)
> Fax: 54-29657451543
> 
> 
> 		
> ______________________________________________________ 
> Yahoo! Autos. M?s de 100 veh?culos vendidos por d?a. 
> ?Qu? esper?s para vender el tuyo? 
> Hacelo ahora y ganate un premio de Yahoo!
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
Email: a.robinson at ms.unimelb.edu.au         http://www.ms.unimelb.edu.au



More information about the R-help mailing list