我尝试使用我自己的数据集运行R文档中提供的针对nlmeODE包的Theoph模型,并且能够返回参数估计值。但是,当我添加一个我想估计的附加参数时,我收到了一条错误消息,如下所示。谁能告诉我哪里出了问题以及如何解决这个问题呢?
R文档中提供的示例模型如下所示:
data(Theoph)
TheophODE <- Theoph
TheophODE$Dose[TheophODE$Time!=0] <- 0
TheophODE$Cmt <- rep(1,dim(TheophODE)[1])
OneComp <- list(DiffEq=list(
dy1dt = ~ -ka*y1 ,
dy2dt = ~ ka*y1-ke*y2),
ObsEq=list(
c1 = ~ 0,
c2 = ~ y2/CL*ke),
Parms=c("ka","ke","CL"),
States=c("y1","y2"),
Init=list(0,0))
TheophModel <- nlmeODE(OneComp,TheophODE)
Theoph.nlme <- nlme(conc ~ TheophModel(ka,ke,CL,Time,Subject),
data = TheophODE, fixed=ka+ke+CL~1, random = pdDiag(ka+CL~1),
start=c(ka=0.5,ke=-2.5,CL=-3.2),
control=list(returnObject=TRUE,msVerbose=TRUE),
verbose=TRUE)
plot(augPred(Theoph.nlme,level=0:1))
我的修改后的模型如下:
group1 <- groupedData(conc ~ Time | Subject,
data=myowndata)
OneComp2 <- list(DiffEq=list(
dy1dt = ~ -ka*y1 + kr*y2,
dy2dt = ~ ka*y1 - kr*y2 -ke*y2), #I added in a reabsorption rate kr
ObsEq=list(
c1 = ~ 0,
c2 = ~ y2/CL*ke),
Parms=c("ka","ke","kr","CL"),
States=c("y1","y2"),
Init=list(0,0))
Model2 <- nlmeODE(OneComp2,group1)
nlme2 <- nlme(conc ~ Model2(ka,ke,kr,CL,Time,Subject),
data = group1, fixed=ka+ke+kr+CL~1, random = pdDiag(ka+CL~1),
start=c(ka=0.5,ke=-2.5,kr=-2.5,CL=-3.2),
control=list(returnObject=TRUE,msVerbose=TRUE),
verbose=TRUE)
错误消息显示为:
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model