[R] nlme
Jim Lindsey
jlindsey at alpha.luc.ac.be
Fri Jan 7 11:08:14 CET 2000
The follow are variations on res2 from my first email.
When I try,
res2f <- 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),weights=varPower(2),
groups=~subj,data=datam,verbose=T,method="ML")
I immediately get
Error in logLik.reStruct(object, conLin) : Singular precision matrix in level -1, block 11
Unless I am badly mistaken (which is quite possible), this exact model
was fitted to these data with an earlier S-Plus version of nlme with
no problem. See below.
If I use varPower(), after 1 iteration, I get the same error. Recall
that res2, without weights specified, worked (converging after 8 iterations).
When I try,
res2bf <- 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(p3~1),weights=varPower(2),
groups=~subj,data=datam,verbose=T,method="ML")
it does not converge after 50 iterations. I know that this is a
reasonable model as I can fit it with elliptic in a few seconds,
because p3 is in fact a random linear intercept. (The 50 iterations
with nlme take over 5 min - on a Pentium II 300.)
The same thing happens with varPower(1). If I use varPower(0.5), I get
Error in logLik.reStruct(object, conLin) : NA/NaN/Inf in foreign function call (arg 1)
after 17 iterations.
I should mention that I analyzed these data originally primarily using R in
Lindsey, J.K., Wang, J., Byrom, W.D., and Jones, B. (1999)
Modelling the covariance structure in pharmacokinetic cross-over
trials. Journal of Biopharmaceutical Statistics 9, 439--450.
with, I believe (if I have understood the current docs correctly) the
same models res, res2f, and res2bf that a (Chinese) colleague did
using S-Plus and nlme several years ago. At that time, he encountered
no problems of convergence or otherwise. Unfortunately, I have no way
of finding out the versions. The syntax of nlme has changed so much
that the old code is not of much help here. I thought it would be
useful in getting me into nlme, but such was not the case.
On Wednesday, I started teaching a nonlinear regression course using R
for the medical statistics M.Sc. I reach PK in a couple of weeks. If I
cannot get a bit further with this, I shall have difficulty explaining
to the students how to handle random nonlinear parameters! All the
rest, including autoregression (which is usually more important than
random effects in data rich PK) can be handled by my libraries.
Thanks very much for your help. Jim
PS
In my earlier tries with nlme, I ran into a lot of rather strange
error reports, most of which I eventually figured out. One that I
remember occurred when I put fixed=list(p1=~1,p2=~1,p3=~1)
giving
Error in fixed[[i]][[3]] : subscript out of bounds
which is not too helpful. (My excuse for that blunder is that my libraries
have that sort of syntax.)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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