[R] nlme

Jim Lindsey jlindsey at alpha.luc.ac.be
Thu Jan 6 16:44:59 CET 2000


Among others, datam contains the columns: logconc, tm, dose, subj, bilirubin.
None of these are factor variables.

The following compartment models work (the first still has not
converged after 100 interations):

res1 <- nlme(logconc~p2+p3+log(dose/(exp(p1)-exp(p2))*
	(exp(-exp(p2)*tm)-exp(-exp(p1)*tm))),start=list(fixed=c(5,-2,-0.1)),
	fixed=list(p1+p2+p3~1),control=list(maxIter=100),
	groups=~subj,data=datam,verbose=T,method="ML")

res2 <- nlme(logconc~p2+p3+log(dose/(exp(p1)-exp(p2))*
	(exp(-exp(p2)*tm)-exp(-exp(p1)*tm))),start=list(fixed=c(5,-2,-0.1)),
	fixed=list(p1+p2+p3~1),random=pdDiag(p1+p2+p3~1),
	groups=~subj,data=datam,verbose=T,method="ML")

res3 <- nlme(logconc~p2+p3+log(dose/(exp(p1)-exp(p2))*
	(exp(-exp(p2)*tm)-exp(-exp(p1)*tm))),start=list(fixed=c(5,-2,-0.1,0)),
	fixed=list(p1+p2~1,p3~bilirubin),random=pdDiag(p1+p2+p3~1),
	groups=~subj,data=datam,verbose=T,method="ML")

However, when I add a second covariate,

res4 <- nlme(logconc~p2+p3+log(dose/(exp(p1)-exp(p2))*
	(exp(-exp(p2)*tm)-exp(-exp(p1)*tm))),
	start=list(fixed=c(5,-2,-0.1,0,0)),
	fixed=list(p1+p2~1,p3~bilirubin+age),random=pdDiag(p1+p2+p3~1),
	groups=~subj,data=datam,verbose=T,method="ML")

I get the error:

Error in fixed[[nm]][[3]] != "1" : comparison (2) is possible only for vector types

If I try instead

res4a <- nlme(logconc~p2+p3+p4*bilirubin+p5*age+log(dose/(exp(p1)-exp(p2))*
	(exp(-exp(p2)*tm)-exp(-exp(p1)*tm))),
	start=list(fixed=c(5,-2,-0.1,0,0)),
	fixed=list(p1+p2+p3+p4+p5~1),random=pdDiag(p1+p2+p3~1),
	groups=~subj,data=datam,verbose=T,method="ML")

it runs.

Can anyone explain to me what I am doing wrong?

Sorry but I cannot supply the data as I am under nondisclosure to a
pharmaceutical company.

  How does one make the variance depend on a function of the mean as
is usual in PK modelling? I can only find how to make it depend on
covariates in the docs?

  It would be nice if nls printed out the log likelihood so
that the fits could be compared with those from nlme.
  I also find it very annoying that nlme stops with an error when the
iteration limit is exceeded (as in res1 above), returning nothing so
that one cannot even inspect the partially converged results.

  Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list