nextBest | R Documentation |
A function that computes the recommended next best dose based on the
corresponding rule nextBest
, the posterior samples
from the model
and
the underlying data
.
nextBest(nextBest, doselimit, samples, model, data, ...)
## S4 method for signature 'NextBestMTD,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature 'NextBestNCRM,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature
## 'NextBestNCRM,numeric,Samples,GeneralModel,DataParts'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature 'NextBestNCRMLoss,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature
## 'NextBestThreePlusThree,missing,missing,missing,Data'
nextBest(nextBest, doselimit, samples, model, data, ...)
## S4 method for signature
## 'NextBestDualEndpoint,numeric,Samples,DualEndpoint,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature 'NextBestMinDist,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature
## 'NextBestInfTheory,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature 'NextBestTD,numeric,missing,LogisticIndepBeta,Data'
nextBest(nextBest, doselimit = Inf, model, data, in_sim = FALSE, ...)
## S4 method for signature
## 'NextBestTDsamples,numeric,Samples,LogisticIndepBeta,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, in_sim, ...)
## S4 method for signature 'NextBestMaxGain,numeric,missing,ModelTox,DataDual'
nextBest(
nextBest,
doselimit = Inf,
model,
data,
model_eff,
in_sim = FALSE,
...
)
## S4 method for signature
## 'NextBestMaxGainSamples,numeric,Samples,ModelTox,DataDual'
nextBest(
nextBest,
doselimit = Inf,
samples,
model,
data,
model_eff,
samples_eff,
in_sim = FALSE,
...
)
## S4 method for signature
## 'NextBestProbMTDLTE,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit, samples, model, data, ...)
## S4 method for signature
## 'NextBestProbMTDMinDist,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit, samples, model, data, ...)
## S4 method for signature 'NextBestOrdinal,numeric,Samples,GeneralModel,Data'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
## S4 method for signature
## 'NextBestOrdinal,numeric,Samples,LogisticLogNormalOrdinal,DataOrdinal'
nextBest(nextBest, doselimit = Inf, samples, model, data, ...)
nextBest |
( |
doselimit |
( |
samples |
( |
model |
( |
data |
( |
... |
additional arguments without method dispatch. |
in_sim |
( |
model_eff |
( |
samples_eff |
( |
A list with the next best dose recommendation (element named value
)
from the grid defined in data
, and a plot depicting this recommendation
(element named plot
). In case of multiple plots also an element
named singlePlots
is included. The singlePlots
is itself a list with
single plots. An additional list with elements describing the outcome
of the rule can be contained too.
nextBest(
nextBest = NextBestMTD,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: find the next best dose based on the MTD rule.
nextBest(
nextBest = NextBestNCRM,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: find the next best dose based on the NCRM method. The
additional element probs
in the output's list contains the target and
overdosing probabilities (across all doses in the dose grid) used in the
derivation of the next best dose.
nextBest(
nextBest = NextBestNCRM,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = DataParts
)
: find the next best dose based on the NCRM method when
two parts trial is used.
nextBest(
nextBest = NextBestNCRMLoss,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: find the next best dose based on the NCRM method and
loss function.
nextBest(
nextBest = NextBestThreePlusThree,
doselimit = missing,
samples = missing,
model = missing,
data = Data
)
: find the next best dose based on the 3+3 method.
nextBest(
nextBest = NextBestDualEndpoint,
doselimit = numeric,
samples = Samples,
model = DualEndpoint,
data = Data
)
: find the next best dose based on the dual endpoint
model. The additional list element probs
contains the target and
overdosing probabilities (across all doses in the dose grid) used in the
derivation of the next best dose.
nextBest(
nextBest = NextBestMinDist,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: gives the dose which is below the dose limit and has an
estimated DLT probability which is closest to the target dose.
nextBest(
nextBest = NextBestInfTheory,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: gives the appropriate dose within an information
theoretic framework.
nextBest(
nextBest = NextBestTD,
doselimit = numeric,
samples = missing,
model = LogisticIndepBeta,
data = Data
)
: find the next best dose based only on the DLT responses
and for LogisticIndepBeta
model class object without DLT samples.
nextBest(
nextBest = NextBestTDsamples,
doselimit = numeric,
samples = Samples,
model = LogisticIndepBeta,
data = Data
)
: find the next best dose based only on the DLT responses
and for LogisticIndepBeta
model class object involving DLT samples.
nextBest(
nextBest = NextBestMaxGain,
doselimit = numeric,
samples = missing,
model = ModelTox,
data = DataDual
)
: find the next best dose based only on pseudo DLT model
ModelTox
and Effloglog
efficacy model without samples.
nextBest(
nextBest = NextBestMaxGainSamples,
doselimit = numeric,
samples = Samples,
model = ModelTox,
data = DataDual
)
: find the next best dose based on DLT and efficacy
responses with DLT and efficacy samples.
nextBest(
nextBest = NextBestProbMTDLTE,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: find the next best dose based with the highest
probability of having a toxicity rate less or equal to the target toxicity
level.
nextBest(
nextBest = NextBestProbMTDMinDist,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: find the next best dose based with the highest
probability of having a toxicity rate with minimum distance to the
target toxicity level.
nextBest(
nextBest = NextBestOrdinal,
doselimit = numeric,
samples = Samples,
model = GeneralModel,
data = Data
)
: find the next best dose for ordinal CRM models.
nextBest(
nextBest = NextBestOrdinal,
doselimit = numeric,
samples = Samples,
model = LogisticLogNormalOrdinal,
data = DataOrdinal
)
: find the next best dose for ordinal CRM models.
# Example of usage for `NextBestMTD` NextBest class.
# Create the data.
my_data <- Data(
x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y = c(0, 0, 0, 0, 0, 0, 1, 0),
ID = 1:8,
cohort = c(0, 1, 2, 3, 4, 5, 5, 5),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
# Initialize the CRM model used to model the data.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsRelative(
intervals = c(0, 20),
increments = c(1, 0.33)
)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose
# based on the 'NextBestMTD' class.
mtd_next_best <- NextBestMTD(
target = 0.33,
derive = function(mtd_samples) {
quantile(mtd_samples, probs = 0.25)
}
)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = mtd_next_best,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
# Example of usage for `NextBestNCRM` NextBest class.
# Create the data.
my_data <- Data(
x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y = c(0, 0, 0, 0, 0, 0, 1, 0),
ID = 1:8,
cohort = c(0, 1, 2, 3, 4, 5, 5, 5),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
# Initialize the CRM model used to model the data.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsRelative(
intervals = c(0, 20),
increments = c(1, 0.33)
)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose
# based on the 'NextBestNCRM' class.
nrcm_next_best <- NextBestNCRM(
target = c(0.2, 0.35),
overdose = c(0.35, 1),
max_overdose_prob = 0.25
)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = nrcm_next_best,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
# See the probabilities.
dose_recommendation$probs
# Example of usage for `NextBestNCRM-DataParts` NextBest class.
# Create the data.
my_data <- DataParts(
x = c(0.1, 0.5, 1.5),
y = c(0, 0, 0),
ID = 1:3,
cohort = 1:3,
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2)),
part = c(1L, 1L, 1L),
nextPart = 1L,
part1Ladder = c(0.1, 0.5, 1.5, 3, 6, 10)
)
# Initialize the CRM model used to model the data.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsRelativeParts(
dlt_start = 0,
clean_start = 1
)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose
# based on the 'NextBestNCRM' class.
nrcm_next_best <- NextBestNCRM(
target = c(0.2, 0.35),
overdose = c(0.35, 1),
max_overdose_prob = 0.25
)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = nrcm_next_best,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
dose_recommendation
# Example of usage for `NextBestNCRMLoss` NextBest class.
# Create the data.
my_data <- Data(
x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y = c(0, 0, 0, 0, 0, 0, 1, 0),
ID = 1:8,
cohort = c(0, 1, 2, 3, 4, 5, 5, 5),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
# Initialize the CRM model used to model the data.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsRelative(
intervals = c(0, 20),
increments = c(1, 0.33)
)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose
# based on the class `NextBestNCRMLoss`.
nrcm_loss_next_best <- NextBestNCRMLoss(
target = c(0.2, 0.35),
overdose = c(0.35, 0.6),
unacceptable = c(0.6, 1),
max_overdose_prob = 0.999,
losses = c(1, 0, 1, 2)
)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = nrcm_loss_next_best,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
# Next best dose.
dose_recommendation$value
# Look at the probabilities.
dose_recommendation$probs
# Define another rule (loss function of 3 elements).
nrcm_loss_next_best_losses_3 <- NextBestNCRMLoss(
target = c(0.2, 0.35),
overdose = c(0.35, 1),
max_overdose_prob = 0.30,
losses = c(1, 0, 2)
)
# Calculate the next best dose.
dose_recommendation_losses_3 <- nextBest(
nextBest = nrcm_loss_next_best_losses_3,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
# Next best dose.
dose_recommendation_losses_3$value
# Look at the probabilities.
dose_recommendation_losses_3$probs
# Example of usage for `NextBestThreePlusThree` NextBest class.
# Create the data.
my_data <- Data(
x = c(5, 5, 5, 10, 10, 10),
y = c(0, 0, 0, 0, 1, 0),
ID = 1:6,
cohort = c(0, 0, 0, 1, 1, 1),
doseGrid = c(0.1, 0.5, 1.5, 3, 5, seq(from = 10, to = 80, by = 2))
)
# The rule to select the next best dose will be based on the 3+3 method.
my_next_best <- NextBestThreePlusThree()
# Calculate the next best dose.
dose_recommendation <- nextBest(my_next_best, data = my_data)
# Example of usage for `NextBestDualEndpoint` NextBest class.
# Create the data.
my_data <- DataDual(
x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10, 20, 20, 20, 40, 40, 40, 50, 50, 50),
y = c(0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1),
ID = 1:17,
cohort = c(1L, 2L, 3L, 4L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L),
w = c(
0.31, 0.42, 0.59, 0.45, 0.6, 0.7, 0.55, 0.6, 0.52, 0.54,
0.56, 0.43, 0.41, 0.39, 0.34, 0.38, 0.21
),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
# Initialize the Dual-Endpoint model (in this case RW1).
my_model <- DualEndpointRW(
mean = c(0, 1),
cov = matrix(c(1, 0, 0, 1), nrow = 2),
sigma2betaW = 0.01,
sigma2W = c(a = 0.1, b = 0.1),
rho = c(a = 1, b = 1),
rw1 = TRUE
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsRelative(
intervals = c(0, 20),
increments = c(1, 0.33)
)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose. In this case,
# target a dose achieving at least 0.9 of maximum biomarker level (efficacy)
# and with a probability below 0.25 that prob(DLT)>0.35 (safety).
de_next_best <- NextBestDualEndpoint(
target = c(0.9, 1),
overdose = c(0.35, 1),
max_overdose_prob = 0.25
)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = de_next_best,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
# See the probabilities.
dose_recommendation$probs
# Joint plot.
print(dose_recommendation$plot)
# Show customization of single plot.
variant1 <- dose_recommendation$singlePlots$plot1 + xlim(0, 20)
print(variant1)
# Example of usage for `NextBestTD` NextBest class.
my_data <- Data(
x = c(25, 50, 50, 75, 150, 200, 225, 300),
y = c(0, 0, 0, 0, 1, 1, 1, 1),
ID = 1:8,
cohort = c(1L, 2L, 2L, 3L, 4L, 5L, 6L, 7L),
doseGrid = seq(from = 25, to = 300, by = 25)
)
my_model <- LogisticIndepBeta(
binDLE = c(1.05, 1.8),
DLEweights = c(3, 3),
DLEdose = c(25, 300),
data = my_data
)
# Target probabilities of the occurrence of a DLT during trial and
# at the end of the trial are defined as 0.35 and 0.3, respectively.
td_next_best <- NextBestTD(prob_target_drt = 0.35, prob_target_eot = 0.3)
# doselimit is the maximum allowable dose level to be given to subjects.
dose_recommendation <- nextBest(
nextBest = td_next_best,
doselimit = max(my_data@doseGrid),
model = my_model,
data = my_data
)
dose_recommendation$next_dose_drt
dose_recommendation$plot
# Example of usage for `NextBestTDsamples` NextBest class.
my_data <- Data(
x = c(25, 50, 50, 75, 150, 200, 225, 300),
y = c(0, 0, 0, 0, 1, 1, 1, 1),
ID = 1:8,
cohort = c(1L, 2L, 2L, 3L, 4L, 5L, 6L, 7L),
doseGrid = seq(from = 25, to = 300, by = 25)
)
my_model <- LogisticIndepBeta(
binDLE = c(1.05, 1.8),
DLEweights = c(3, 3),
DLEdose = c(25, 300),
data = my_data
)
# Set-up some MCMC parameters and generate samples.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 800)
my_samples <- mcmc(my_data, my_model, my_options)
# Target probabilities of the occurrence of a DLT during trial and
# at the end of the trial are defined as 0.35 and 0.3, respectively.
# 'derive' is specified such that the 30% posterior quantile of the TD35 and
# TD30 samples will be used as TD35 and TD30 estimates.
tds_next_best <- NextBestTDsamples(
prob_target_drt = 0.35,
prob_target_eot = 0.3,
derive = function(samples) {
as.numeric(quantile(samples, probs = 0.3))
}
)
# doselimit is the maximum allowable dose level to be given to subjects.
dose_recommendation <- nextBest(
nextBest = tds_next_best,
doselimit = max(my_data@doseGrid),
samples = my_samples,
model = my_model,
data = my_data
)
dose_recommendation$next_dose_drt
dose_recommendation$plot
# Example of usage for `NextBestMaxGain` NextBest class.
# Create the data.
my_data <- DataDual(
x = c(25, 50, 25, 50, 75, 300, 250, 150),
y = c(0, 0, 0, 0, 0, 1, 1, 0),
ID = 1:8,
cohort = 1:8,
w = c(0.31, 0.42, 0.59, 0.45, 0.6, 0.7, 0.6, 0.52),
doseGrid = seq(25, 300, 25),
placebo = FALSE
)
# 'ModelTox' DLT model, e.g 'LogisticIndepBeta'.
my_model_dlt <- LogisticIndepBeta(
binDLE = c(1.05, 1.8),
DLEweights = c(3, 3),
DLEdose = c(25, 300),
data = my_data
)
# 'ModelEff' efficacy model, e.g. 'Effloglog'.
my_model_eff <- Effloglog(
eff = c(1.223, 2.513),
eff_dose = c(25, 300),
nu = c(a = 1, b = 0.025),
data = my_data
)
# Target probabilities of the occurrence of a DLT during trial and at the
# end of trial are defined as 0.35 and 0.3, respectively.
mg_next_best <- NextBestMaxGain(
prob_target_drt = 0.35,
prob_target_eot = 0.3
)
# doselimit is the maximum allowable dose level to be given to subjects.
dose_recommendation <- nextBest(
nextBest = mg_next_best,
doselimit = 300,
model = my_model_dlt,
model_eff = my_model_eff,
data = my_data
)
dose_recommendation$next_dose
dose_recommendation$plot
# Example of usage for `NextBestMaxGainSamples` NextBest class.
# Create the data.
my_data <- DataDual(
x = c(25, 50, 25, 50, 75, 300, 250, 150),
y = c(0, 0, 0, 0, 0, 1, 1, 0),
w = c(0.31, 0.42, 0.59, 0.45, 0.6, 0.7, 0.6, 0.52),
ID = 1:8,
cohort = 1:8,
doseGrid = seq(25, 300, 25),
placebo = FALSE
)
# 'ModelTox' DLT model, e.g 'LogisticIndepBeta'.
my_model_dlt <- LogisticIndepBeta(
binDLE = c(1.05, 1.8),
DLEweights = c(3, 3),
DLEdose = c(25, 300),
data = my_data
)
# 'ModelEff' efficacy model, e.g 'Effloglog'.
my_model_effll <- Effloglog(
eff = c(1.223, 2.513),
eff_dose = c(25, 300),
nu = c(a = 1, b = 0.025),
data = my_data
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples_dlt <- mcmc(my_data, my_model_dlt, my_options)
my_samples_effll <- mcmc(my_data, my_model_effll, my_options)
# Target probabilities of the occurrence of a DLT during trial and at the end of
# trial are defined as 0.35 and 0.3, respectively.
# Use 30% posterior quantile of the TD35 and TD30 samples as estimates of TD35
# and TD30.
# Use 50% posterior quantile of the Gstar (the dose which gives the maxim gain value)
# samples as Gstar estimate.
mgs_next_best <- NextBestMaxGainSamples(
prob_target_drt = 0.35,
prob_target_eot = 0.3,
derive = function(samples) {
as.numeric(quantile(samples, prob = 0.3))
},
mg_derive = function(mg_samples) {
as.numeric(quantile(mg_samples, prob = 0.5))
}
)
dose_recommendation <- nextBest(
nextBest = mgs_next_best,
doselimit = max(my_data@doseGrid),
samples = my_samples_dlt,
model = my_model_dlt,
data = my_data,
model_eff = my_model_effll,
samples_eff = my_samples_effll
)
dose_recommendation$next_dose
dose_recommendation$plot
# Now using the 'EffFlexi' class efficacy model:
my_model_effflexi <- EffFlexi(
eff = c(1.223, 2.513),
eff_dose = c(25, 300),
sigma2W = c(a = 0.1, b = 0.1),
sigma2betaW = c(a = 20, b = 50),
rw1 = FALSE,
data = my_data
)
my_samples_effflexi <- mcmc(my_data, my_model_effflexi, my_options)
dose_recommendation <- nextBest(
nextBest = mgs_next_best,
doselimit = max(my_data@doseGrid),
samples = my_samples_dlt,
model = my_model_dlt,
data = my_data,
model_eff = my_model_effflexi,
samples_eff = my_samples_effflexi
)
dose_recommendation$next_dose
dose_recommendation$plot
# Example of usage for `NextBestProbMTDLTE` NextBest class.
# Create the data.
my_data <- Data(
x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y = c(0, 0, 0, 0, 0, 0, 1, 0),
ID = 1:8,
cohort = c(0, 1, 2, 3, 4, 5, 5, 5),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
# Initialize the CRM model used to model the data.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsRelative(
intervals = c(0, 20),
increments = c(1, 0.33)
)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose
# based on the 'NextBestProbMTDLTE' class.
nb_mtd_lte <- NextBestProbMTDLTE(target = 0.33)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = nb_mtd_lte,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
# Example of usage for `NextBestProbMTDMinDist` NextBest class.
# Create the data.
my_data <- Data(
x = c(1.5, 1.5, 1.5, 2.5, 2.5, 2.5, 3.5, 3.5, 3.5),
y = c(0, 0, 0, 0, 0, 0, 1, 1, 0),
ID = 1:9,
cohort = c(1, 1, 1, 2, 2, 2, 3, 3, 3),
doseGrid = c(1.5, 2.5, 3.5, 4.5, 6, 7)
)
# Initialize the CRM model used to model the data.
my_model <- my_model <- LogisticKadaneBetaGamma(
theta = 0.3,
xmin = 1.5,
xmax = 7,
alpha = 1,
beta = 19,
shape = 0.5625,
rate = 0.125
)
# Set-up some MCMC parameters and generate samples from the posterior.
my_options <- McmcOptions(burnin = 100, step = 2, samples = 500)
my_samples <- mcmc(my_data, my_model, my_options)
# Define the rule for dose increments and calculate the maximum dose allowed.
my_increments <- IncrementsDoseLevels(levels = 1)
next_max_dose <- maxDose(my_increments, data = my_data)
# Define the rule which will be used to select the next best dose
# based on the 'NextBestProbMTDMinDist' class.
nb_mtd_min_dist <- NextBestProbMTDMinDist(target = 0.3)
# Calculate the next best dose.
dose_recommendation <- nextBest(
nextBest = nb_mtd_min_dist,
doselimit = next_max_dose,
samples = my_samples,
model = my_model,
data = my_data
)
ordinal_data <- .DefaultDataOrdinal()
ordinal_model <- .DefaultLogisticLogNormalOrdinal()
options <- .DefaultMcmcOptions()
ordinal_samples <- mcmc(ordinal_data, ordinal_model, options)
nextBest(
nextBest = NextBestOrdinal(2L, .DefaultNextBestNCRM()),
samples = ordinal_samples,
doselimit = Inf,
model = ordinal_model,
data = ordinal_data
)
ordinal_data <- .DefaultDataOrdinal()
ordinal_model <- .DefaultLogisticLogNormalOrdinal()
options <- .DefaultMcmcOptions()
ordinal_samples <- mcmc(ordinal_data, ordinal_model, options)
nextBest(
nextBest = NextBestOrdinal(2L, .DefaultNextBestNCRM()),
samples = ordinal_samples,
doselimit = Inf,
model = ordinal_model,
data = ordinal_data
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.