[R] problem-nlme

gabriela escati peñaloza gescati at yahoo.com.ar
Wed May 24 20:30:43 CEST 2006


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!



More information about the R-help mailing list