Сводная информация о симуляции определения дозы в crmPack недоступна из-за "ошибки в uniroot" - PullRequest
0 голосов
/ 24 июня 2019

Я использую crmPack в R для имитации испытаний по дозированию фазы 1.В приведенном ниже коде все работает вплоть до запуска симуляции, но затем функция итога возвращает ошибку.Это из-за данных, которые я передаю в модель, или есть проблема с функцией?Когда я использую данные виньетки crmPack, она отлично работает ...

Любая помощь будет принята с благодарностью.

Спасибо

#install.packages("crmPack")
#install.packages("ggplot2")

rm(list=ls()) 

library(ggplot2)
library(crmPack)

options <- McmcOptions(burnin=1000,
step=2, samples=5000)

#### Using LogisticIndepBeta

emptydata <- Data(doseGrid=seq(from=1.2, to=2.4, by=0.4), placebo=FALSE)
data1 <- emptydata

DLTmodel<-LogisticIndepBeta(binDLE=c(2.5,12.5),DLEweights=c(50,50),
                            DLEdose=c(1.2,2.4),
                    data=data1)

DLTmodel
DLTsamples <- mcmc(data=data1,model=DLTmodel,options=options)

data3 <- Data(x=c(1.2,1.6,1.6,2,2,2.4),
y=c(0,0,0,0,1,0),
doseGrid=seq(from=1.2,to=2.4,by=0.4))

DLTpostsamples <- mcmc(data=data3,model=DLTmodel,options=options)

newDLTmodel <- update(object=DLTmodel,data=data3)

print(plot(DLTsamples,DLTmodel,data1))

print(plot(data1,DLTmodel))

myIncrements <- IncrementsRelative(intervals=c(1.2), increments=c(1))

nextMaxDose <- maxDose(myIncrements,
data=data3)
nextMaxDose

TDNextBest <- NextBestTD(targetDuringTrial=0.25,
targetEndOfTrial=0.2)

TDsamplesNextBest <- NextBestTDsamples(targetDuringTrial=0.25,
targetEndOfTrial=0.2,
derive=function(TDsamples){
quantile(TDsamples,probs=0.5)})

doseRecDLT <- nextBest(TDNextBest,doselimit=2.4,model=newDLTmodel,data=data3)

print(doseRecDLT$plot)

doseRecDLTSamples <- nextBest(TDsamplesNextBest,doselimit=2.4,
samples=DLTpostsamples,model=newDLTmodel,
data=data3)

print(doseRecDLTSamples$plot)

mySize <- CohortSizeConst(size=3)

myStopping1 <- StoppingMinCohorts(nCohorts=3)
myStopping2 <- StoppingTargetProb(target=c(0.2, 0.35),
prob=0.5)
myStopping3 <- StoppingMinPatients(nPatients=21)

#myStopping <- (myStopping1 & myStopping2) | myStopping3
myStopping <- myStopping3

DLTdesign <-TDDesign(model=DLTmodel,
nextBest=TDNextBest,
stopping=myStopping,
increments=myIncrements,
cohortSize=mySize,
data=data1,
startingDose=1.2)

DLTsamplesDesign <- TDsamplesDesign(model=DLTmodel,
nextBest=TDsamplesNextBest,
stopping=myStopping,
increments = myIncrements,
cohortSize=mySize,
data=data1,
startingDose=1.2)


## define the true function
TrueDLT <- function(dose){
#DLTmodel@prob(dose, phi1=-3.429955, phi2=2.662965)
DLTmodel@prob(dose, phi1=-53.66584, phi2=10.50499)

}
## plot it in the range of the dose grid
curve(TrueDLT, from=1.2, to=2.4, ylim=c(0, 1))

DLTSim <- simulate(DLTdesign,
args=NULL,truth=TrueDLT,
nsim=5,
seed=1,
parallel=FALSE)

print(plot(DLTSim))

summary(DLTSim, truth=TrueDLT)
DLTsimSum <- summary(DLTSim,truth=TrueDLT)
print(plot(DLTsimSum))
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...