3

My ongoing problems (see here and here) making the nonlinear mixed effects models in Chapter 8 of Pinheiro and Bates converge continue. This time with the Quinidine dataset (p. 385). Once again this is an iterative model-building exercise. I am having trouble with the third model in the series.

library(nlme)
fm1Quin.nlme <- nlme(conc ~ quinModel(Subject, time, conc, dose, interval, lV, lKa, lCl),
                     data = Quinidine, 
                     fixed = lV + lKa + lCl ~ 1,
                     random = pdDiag(lV + lCl ~ 1),
                     groups = ~ Subject,
                     start = list(fixed = c(5, -0.3, 2)),
                     na.action = na.pass, # R does not have the function na.include
                     naPattern = ~ !is.na(conc))
fm1Quin.fix <- fixef(fm1Quin.nlme)
fm2Quin.nlme <- update(fm1Quin.nlme, 
                       fixed = list(lCl ~ glyco, lKa + lV ~ 1),
                       start = c(fm1Quin.fix[3], 0, fm1Quin.fix[2:1]))
fm2Quin.fix <- fixef(fm2Quin.nlme)

Now for the troublesome model

fm3Quin.nlme <- update(fm2Quin.nlme,
                       fixed = list(lCl ~ glyco + Creatinine, lKa + lV ~ 1),
                       start = c(fm2Quin.fix[1:2], 0.2, fm2Quin.fix[3:4]),
                       control = nlmeControl(maxIter = 50))

I tried setting the maximum number of iterations higher in nlmeControl but keep getting similar error messages

Error in nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  : 
  maximum number of iterations (maxIter = 50) reached without convergence
In addition: Warning messages:
1: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1
2: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1
3: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1
4: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1
5: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1
6: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1
7: In nlme.formula(model = conc ~ quinModel(Subject, time, conc, dose,  :
  Singular precision matrix in level -1, block 1

It seems as if there is more finesse required in getting these nonlinear models to converge in R than with the linear mixed-effects models. Any help much appreciated.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
llewmills
  • 2,959
  • 3
  • 31
  • 58

1 Answers1

3

This time we may achieve convergence with the help of two things: different initial values and a different value for pnlsTol:

fm3Quin.nlme <- update(fm2Quin.nlme,
                       fixed = list(lCl ~ glyco + Creatinine, lKa + lV ~ 1),
                       start = c(3.0291, -0.3631, 0.1503, -0.7458, 5.2893),
                       control = nlmeControl(pnlsTol = 0.0011))

Note that the default value of pnlsTol is 0.001, so the change is really tiny. The starting values are actually the ones provided in the book as the optimal solution, so it's kind of cheating. However, fm3Quin.nlme converges to a slightly different values... In this case my guess would be that the function is very nonlinear and the achieved optimum is very close to other much larger values, hence the complicated convergence. (I'm guessing this because of the need to increase pnlsTol and to specify good initial values.)

Julius Vainora
  • 47,421
  • 9
  • 90
  • 102