Pinheiro 和 Bates 的非线性混合效应模型的收敛问题
Trouble with Convergence in Non-Linear Mixed-Effects Model from Pinheiro and Bates
我正在处理的问题(参见 and )使 Pinheiro 和 Bates 的第 8 章中的非线性混合效应模型收敛。这次使用 Quinidine
数据集(第 385 页)。这又是一个迭代的模型构建练习。我在使用系列中的第三个模型时遇到问题。
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)
现在是麻烦的模型
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))
我尝试在 nlmeControl
中将最大迭代次数设置得更高,但不断收到类似的错误消息
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
似乎与线性混合效应模型相比,使这些非线性模型在 R 中收敛需要更多的技巧。非常感谢任何帮助。
这次我们可以借助两件事实现收敛:不同的初始值和不同的 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))
请注意,pnlsTol
的默认值为 0.001,因此变化非常小。起始值实际上是书中提供的最佳解决方案,所以有点作弊。然而,fm3Quin.nlme
收敛到一个略有不同的值......在这种情况下,我的猜测是该函数是非常非线性的并且实现的最优值非常接近其他更大的值,因此复杂的收敛。 (我猜这是因为需要增加 pnlsTol
并指定好的初始值。)
我正在处理的问题(参见 Quinidine
数据集(第 385 页)。这又是一个迭代的模型构建练习。我在使用系列中的第三个模型时遇到问题。
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)
现在是麻烦的模型
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))
我尝试在 nlmeControl
中将最大迭代次数设置得更高,但不断收到类似的错误消息
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
似乎与线性混合效应模型相比,使这些非线性模型在 R 中收敛需要更多的技巧。非常感谢任何帮助。
这次我们可以借助两件事实现收敛:不同的初始值和不同的 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))
请注意,pnlsTol
的默认值为 0.001,因此变化非常小。起始值实际上是书中提供的最佳解决方案,所以有点作弊。然而,fm3Quin.nlme
收敛到一个略有不同的值......在这种情况下,我的猜测是该函数是非常非线性的并且实现的最优值非常接近其他更大的值,因此复杂的收敛。 (我猜这是因为需要增加 pnlsTol
并指定好的初始值。)