# [R] a question about nlme

From: Lijuan Wang <lw7s_at_cms.mail.virginia.edu>
Date: Sat 31 Jul 2004 - 03:53:34 EST

Hi,
Sorry to bother those who are not interested in the question.

I am using R to run a multiphase mixed-effects model. I simulated a data set by using the following model. And now I want to use R to estimate the parameters and compare the results with the true values.
The equations of the models are as below:

```gf[ij]=b0[i]+b1[i]*age[ij]+b2[i]*max(0,(age[ij]-tau[i]))+e[ij]
b0[i]=b00+e[i0]
b1[i]=b10+e[i1]
b2[i]=b20+e[i2]
```

tau[i]=tau+e[i3]

i: 1,2,...,111 subjects
j: 1,2,...,6 occasions

The main scripts of R is:

> simu1<-groupedData(gf~age|id,data=simu1)
#fitting a linear mixed-effects model is ok
> mm.lme.1<-lme(gf~age,random=~age|id,data=simu1)
#but when I fit a nonlinear mixed-effects model, it shows an error as below
> simu.nlme<-nlme(gf~b0 + b1 * age + b2 * max(0,(age-tau)),data=simu1,fixed=b0+b1+b2+tau~1,random=b0+b1+b2+tau~1, start=c(b0=4,b1=5.32,b2=-5.29,tau=14.8))

Error in MEEM(object, conLin, control\$niterEM) :

Singularity in backsolve at level 0, block 1

I don't know if my scripts have some mistakes, or my data has some problems.