# [R] nlme : convergence problem and other errors

Thomas BRUNEL Thomas.Brunel at ifremer.fr
Tue Jan 16 14:48:19 CET 2007

```Dear R-user,

I am trying to use the R "nlme" function to fit a non linear mixed
effects model. The model I wand to fit is an individual somatic growth
model with 4 parameters. For all parameters both fixed and random
effects have to be estimated, as well as their covariance matrix (see
the formula bellow).
The data are simulated with the same growth model as in the nlme, with
know parameters, and covariance matrix.

I tried to fit the model with several simulated data sets, but most of
the time, R returns an error message.
there are three main types of errors :
- there is a singular matrix
- a factor is reduced bellow the PNLS level.
- max number of iteration is reached but there is no convergence.

Do you know how to resolve these problems. Is there a way to modify the
parameters of the maximization algorithm to avoid these error messages?

Furthermore, do you know if it is possible to fix the values of the
fixed effects so that the model only has to estimate the random effects?

Regards,

Thomas Brunel

pds.fit<-nlme(pds~(exp (lna)/(exp (lnb) + 1/(1 + exp(1000 * (exp
(lntmat) - t + 0.5))) * exp (lnc)))^4 * (1 - (1 - (  0.051 * (1 - 1/(1 +
exp(1000 * (exp (lntmat) - t + 0.5)))) + (exp (lna)/exp (lnb))^4 * (1 -
(1 - (0.051)^0.25 * (exp (lnb)/exp (lna))) * exp( - ((exp (lnb) * exp
(lntmat))/4)))^4 * 1/(1 + exp(1000 * (exp (lntmat) - t + 0.5))))^0.25 *
((exp (lnb) + 1/(1 + exp(1000 * (exp (lntmat) - t + 0.5))) * exp
(lnc))/exp (lna))) * exp( - (((exp (lnb) + 1/(1 + exp(1000 * (exp
(lntmat) - t + 0.5))) * exp (lnc)) *(t - (1/(1 + exp(1000 * (exp
(lntmat) - t + 0.5))) * exp
(lntmat))))/4)))^4,data=pdsdata,fixed=lna+lnb+lnc+lntmat~1,random=
lna+lnb+lnc+lntmat~1|indi ,start=c(lna=log(a2),lnb=log(b2) ,lnc =
log(c2), lntmat=log(1200)))

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Laboratoire Halieutique de Port-en-Bessin

avenue du Général de Gaulle
14520 Port-en-Bessin
tél : 02 31 51 56 00 (standard)
fax : 02 31 51 56 01

page personnelle (CV online):
http://www.ifremer.fr/drvrhbr/personnel/brunel/index.htm

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

```