# Create some data from the class `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),
doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)
# Initialize the CRM model.
my_model <- LogisticLogNormal(
mean = c(-0.85, 1),
cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
ref_dose = 56
)
# Sample from the posterior distribution.
my_options <- McmcOptions(
burnin = 100,
step = 2,
samples = 1000
)
samples <- mcmc(data = my_data, model = my_model, options = my_options)
samples
# Create some data from the class `DataDual`.
plcb <- 0.001
my_data <- DataDual(
w = c(13, 77, 86, 26, 27, 36, 37, 97, 21, 49, 87, 48),
x = c(plcb, 25, 25, 25, plcb, 50, 50, 50, plcb, 100, 100, 100),
y = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L),
doseGrid = c(plcb, seq(25, 300, 25)),
placebo = TRUE,
ID = 1:12,
cohort = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L)
)
# Initialize the CRM model.
my_model <- DualEndpointRW(
mean = c(0, 1),
cov = matrix(c(1, 0, 0, 1), nrow = 2),
sigma2W = c(a = 0.1, b = 0.1),
rho = c(a = 1, b = 1),
sigma2betaW = 0.01,
rw1 = TRUE
)
# Sample from the posterior distribution.
my_options <- McmcOptions(
burnin = 50,
step = 2,
samples = 4,
rng_kind = "Mersenne-Twister",
rng_seed = 1
)
samples <- mcmc(data = my_data, model = my_model, options = my_options)
samples
# Create some data from the class `DataDual`.
plcb <- 0.001
my_data <- DataDual(
w = c(13, 77, 86, 26, 27, 36, 37, 97, 21, 49, 87, 48),
x = c(plcb, 25, 25, 25, plcb, 50, 50, 50, plcb, 100, 100, 100),
y = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L),
doseGrid = c(plcb, seq(25, 300, 25)),
placebo = TRUE,
ID = 1:12,
cohort = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L)
)
# Initialize the CRM model.
my_model <- DualEndpointBeta(
mean = c(0, 1),
cov = diag(2),
ref_dose = 2,
use_log_dose = FALSE,
sigma2W = c(a = 1, b = 2),
rho = c(a = 1.5, b = 2.5),
E0 = 2,
Emax = 50,
delta1 = 6,
mode = 9,
ref_dose_beta = my_data@doseGrid[my_data@nGrid] + 10
)
# Sample from the posterior distribution.
my_options <- McmcOptions(
burnin = 50,
step = 2,
samples = 4,
rng_kind = "Mersenne-Twister",
rng_seed = 1
)
samples <- mcmc(data = my_data, model = my_model, options = my_options)
samples
##obtain mcmc DLE samples given the data, LogisticIndepBeta (DLE model) and mcmc simulations options
## data must be of 'Data' class
data <- Data(
x = c(25, 50, 50, 75, 100, 100, 225, 300),
y = c(0, 0, 0, 0, 1, 1, 1, 1),
doseGrid = seq(25, 300, 25)
)
## model must be of 'LogisticIndepBeta' class
model <- LogisticIndepBeta(
binDLE = c(1.05, 1.8),
DLEweights = c(3, 3),
DLEdose = c(25, 300),
data = data
)
## options must be ''McmcOptions' class
options <- McmcOptions(burnin = 100, step = 2, samples = 200)
set.seed(94)
samples <- mcmc(data = data, model = model, options = options)
# nolint start
##obtain mcmc efficacy samples given the data, 'Effloglog' model (efficacy model) and
## mcmc simulations options data must be of 'DataDual' class
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),
doseGrid = seq(25, 300, 25),
placebo = FALSE
)
## model must be of 'Effloglog' class
Effmodel <- Effloglog(
eff = c(1.223, 2.513),
eff_dose = c(25, 300),
nu = c(a = 1, b = 0.025),
data = data
)
## options must be ''McmcOptions' class
options <- McmcOptions(burnin = 100, step = 2, samples = 200)
set.seed(94)
samples <- mcmc(data = data, model = Effmodel, options = options)
# nolint end
## obtain mcmc efficacy samples given the data, 'EffFlexi' model (efficacy model) and
## mcmc simulations options
## data must be of 'DataDual' class
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),
doseGrid = seq(25, 300, 25)
)
## model must be of 'EffFlexi' class
effmodel <- 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 = data
)
## options must be ''McmcOptions' class
options <- McmcOptions(burnin = 100, step = 2, samples = 200)
set.seed(94)
samples <- mcmc(data = data, model = effmodel, options = options)
ordinal_data <- .DefaultDataOrdinal()
ordinal_model <- .DefaultLogisticLogNormalOrdinal()
mcmc_options <- .DefaultMcmcOptions()
samples <- mcmc(ordinal_data, ordinal_model, mcmc_options)
Run the code above in your browser using DataLab