# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.