I am working through Mixed Effects Models in S and S-Plus in R but some of the code does not produce the results in-text. In Chapter 6 one of the examples fails to converge with the code supplied.
The example is a non-linear mixed effects model performed on the Phenobarb
dataset supplied with the nlme
package.
library(nlme)
fm1Pheno.nlme <- nlme(model = conc ~ phenoModel(Subject, time, dose, lCl, lV),
data = Phenobarb,
fixed = lCl + lV ~ 1,
random = pdDiag(lCl + lV ~ 1),
start = c(-5,0),
na.action = na.pass,
naPattern = ~ !is.na(conc))
fm1Pheno.nlme
This first model runs fine, but the second model, based on the first
fm2Pheno.nlme <- update( fm1Pheno.nlme,
fixed = list(lCl ~ Wt, lV ~ Wt + ApgarInd),
start = c(-5.0935, 0, 0.34259, 0, 0),
control = list(pnlsTol = 1e-6) )
..returns the error
Error in nlme.formula(model = conc ~ phenoModel(Subject, time, dose, lCl, :
maximum number of iterations (maxIter = 50) reached without convergence
This second model apparently work in S but not in R. Can anyone suggest a solution? Is the error due to some difference between S and R?