Title: | Bayesian Logistic Regression for Oncology Dose-Escalation Trials |
---|---|
Description: | Bayesian logistic regression model with optional EXchangeability-NonEXchangeability parameter modelling for flexible borrowing from historical or concurrent data-sources. The safety model can guide dose-escalation decisions for adaptive oncology Phase I dose-escalation trials which involve an arbitrary number of drugs. Please refer to Neuenschwander et al. (2008) <doi:10.1002/sim.3230> and Neuenschwander et al. (2016) <doi:10.1080/19466315.2016.1174149> for details on the methodology. |
Authors: | Novartis Pharma AG [cph], Sebastian Weber [aut, cre], Lukas A. Widmer [aut], Andrew Bean [aut], Trustees of Columbia University [cph] (R/stanmodels.R, configure, configure.win) |
Maintainer: | Sebastian Weber <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.9-0 |
Built: | 2025-03-02 04:11:07 UTC |
Source: | https://github.com/cran/OncoBayes2 |
A version of bind_rows out of dplyr that fills non-common columns with zeroes instead of NA. Gives an error if any of the input data contains NA already.
bind_rows_0(...)
bind_rows_0(...)
... |
Data frames to combine, passed into bind_rows (see dplyr documentation) |
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) library(tibble) dose_info_A <- tibble( group_id = "hist_A", drug_A = 1 ) dose_info_B <- tibble( group_id = "hist_B", drug_B = 100 * (1:2) ) bind_rows_0(dose_info_A, dose_info_B) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) library(tibble) dose_info_A <- tibble( group_id = "hist_A", drug_A = 1 ) dose_info_B <- tibble( group_id = "hist_B", drug_B = 100 * (1:2) ) bind_rows_0(dose_info_A, dose_info_B) ## Recover user set sampling defaults options(.user_mc_options)
Bayesian Logistic Regression Model (BLRM) for N compounds using EXchangability and NonEXchangability (EXNEX) modeling.
blrm_exnex( formula, data, prior_EX_mu_comp, prior_EX_mu_mean_comp, prior_EX_mu_sd_comp, prior_EX_tau_comp, prior_EX_tau_mean_comp, prior_EX_tau_sd_comp, prior_EX_corr_eta_comp, prior_EX_mu_inter, prior_EX_mu_mean_inter, prior_EX_mu_sd_inter, prior_EX_tau_inter, prior_EX_tau_mean_inter, prior_EX_tau_sd_inter, prior_EX_corr_eta_inter, prior_is_EXNEX_inter, prior_is_EXNEX_comp, prior_EX_prob_comp, prior_EX_prob_inter, prior_NEX_mu_comp, prior_NEX_mu_mean_comp, prior_NEX_mu_sd_comp, prior_NEX_mu_inter, prior_NEX_mu_mean_inter, prior_NEX_mu_sd_inter, prior_tau_dist, iter = getOption("OncoBayes2.MC.iter", 2000), warmup = getOption("OncoBayes2.MC.warmup", 1000), save_warmup = getOption("OncoBayes2.MC.save_warmup", TRUE), thin = getOption("OncoBayes2.MC.thin", 1), init = getOption("OncoBayes2.MC.init", 0.5), chains = getOption("OncoBayes2.MC.chains", 4), cores = getOption("mc.cores", 1L), control = getOption("OncoBayes2.MC.control", list()), backend = getOption("OncoBayes2.MC.backend", "rstan"), prior_PD = FALSE, verbose = FALSE ) ## S3 method for class 'blrmfit' print(x, ..., prob = 0.95, digits = 2)
blrm_exnex( formula, data, prior_EX_mu_comp, prior_EX_mu_mean_comp, prior_EX_mu_sd_comp, prior_EX_tau_comp, prior_EX_tau_mean_comp, prior_EX_tau_sd_comp, prior_EX_corr_eta_comp, prior_EX_mu_inter, prior_EX_mu_mean_inter, prior_EX_mu_sd_inter, prior_EX_tau_inter, prior_EX_tau_mean_inter, prior_EX_tau_sd_inter, prior_EX_corr_eta_inter, prior_is_EXNEX_inter, prior_is_EXNEX_comp, prior_EX_prob_comp, prior_EX_prob_inter, prior_NEX_mu_comp, prior_NEX_mu_mean_comp, prior_NEX_mu_sd_comp, prior_NEX_mu_inter, prior_NEX_mu_mean_inter, prior_NEX_mu_sd_inter, prior_tau_dist, iter = getOption("OncoBayes2.MC.iter", 2000), warmup = getOption("OncoBayes2.MC.warmup", 1000), save_warmup = getOption("OncoBayes2.MC.save_warmup", TRUE), thin = getOption("OncoBayes2.MC.thin", 1), init = getOption("OncoBayes2.MC.init", 0.5), chains = getOption("OncoBayes2.MC.chains", 4), cores = getOption("mc.cores", 1L), control = getOption("OncoBayes2.MC.control", list()), backend = getOption("OncoBayes2.MC.backend", "rstan"), prior_PD = FALSE, verbose = FALSE ) ## S3 method for class 'blrmfit' print(x, ..., prob = 0.95, digits = 2)
formula |
the model formula describing the linear predictors of the model. The lhs of the formula is a two-column matrix which are the number of occured events and the number of times no event occured. The rhs of the formula defines the linear predictors for the marginal models for each drug component, then the interaction model and at last the grouping and optional stratum factors of the models. These elements of the formula are separated by a vertical bar. The marginal models must follow a intercept and slope form while the interaction model must not include an interaction term. See the examples below for an example instantiation. |
data |
optional data frame containing the variables of the
model. If not found in |
prior_EX_mu_comp |
List of bivariate normal mixture priors for
intercept and slope parameters |
prior_EX_mu_mean_comp , prior_EX_mu_sd_comp
|
|
prior_EX_tau_comp |
List of bivariate normal mixture priors
for heterogeniety parameter |
prior_EX_tau_mean_comp , prior_EX_tau_sd_comp
|
|
prior_EX_corr_eta_comp |
Prior LKJ correlation parameter for each component given as numeric vector. If missing, then a 1 is assumed corresponding to a marginal uniform prior of the correlation. |
prior_EX_mu_inter |
Multivariate normal mixture prior for
interaction parameter vector
|
prior_EX_mu_mean_inter , prior_EX_mu_sd_inter
|
|
prior_EX_tau_inter |
List of multivariate normal mixture
priors for heterogeniety interaction parameter vector
|
prior_EX_tau_mean_inter , prior_EX_tau_sd_inter
|
|
prior_EX_corr_eta_inter |
Prior LKJ correlation parameter for interaction given as numeric. If missing, then a 1 is assumed corresponding to a marginal uniform prior of the correlations. |
prior_is_EXNEX_inter |
Defines if non-exchangability is
admitted for a given interaction parameter. Logical vector of
length equal to the number of interactions. If missing
|
prior_is_EXNEX_comp |
Defines if non-exchangability is
admitted for a given component. Logical vector of length equal to
the number of components. If missing |
prior_EX_prob_comp |
Prior probability |
prior_EX_prob_inter |
Prior probability |
prior_NEX_mu_comp |
List of bivariate normal mixture priors
|
prior_NEX_mu_mean_comp , prior_NEX_mu_sd_comp
|
|
prior_NEX_mu_inter |
Multivariate normal mixture prior (mean
|
prior_NEX_mu_mean_inter , prior_NEX_mu_sd_inter
|
|
prior_tau_dist |
Defines the distribution used for heterogeniety parameters. Choices are 0=fixed to it's mean, 1=log-normal, 2=truncated normal. |
iter |
number of iterations (including warmup). |
warmup |
number of warmup iterations. |
save_warmup |
save warmup samples ( |
thin |
period of saving samples. |
init |
positive number to specify uniform range on
unconstrained space for random initialization. See
|
chains |
number of Markov chains. |
cores |
number of cores for parallel sampling of chains. |
control |
additional sampler parameters for NuTS algorithm. |
backend |
sets Stan backend to be used. Possible choices are
|
prior_PD |
Logical flag (defaults to |
verbose |
Logical flag (defaults to |
x |
|
... |
not used in this function |
prob |
central probability mass to report, i.e. the quantiles 0.5-prob/2 and 0.5+prob/2 are displayed. Multiple central widths can be specified. |
digits |
number of digits to show |
blrm_exnex
is a flexible function for Bayesian meta-analytic
modeling of binomial count data. In particular, it is designed to
model counts of the number of observed dose limiting toxicities
(DLTs) by dose, for guiding dose-escalation studies in Oncology. To
accommodate dose escalation over more than one agent, the dose may
consist of combinations of study drugs, with any number of
treatment components.
In the simplest case, the aim is to model the probability that
a patient experiences a DLT, by complementing the binomial likelihood with
a monotone logistic regression
where . Most typically,
represents the dose,
and
is an appropriate transformation, such as
. A joint prior on
completes the model and ensures
monotonicity
.
Many extensions are possible. The function supports general combination regimens, and also provides framework for Bayesian meta-analysis of dose-toxicity data from multiple historical and concurrent sources.
For an example of a single-agent trial refer to example-single-agent
.
The function returns a S3 object of type
blrmfit
.
print(blrmfit)
: print function.
For a combination of two treatment components, the basic modeling
framework is that the DLT rate is comprised of
(1) a "no-interaction" baseline model
driven by the single-agent toxicity of each component, and (2)
optional interaction terms
representing
synergy or antagonism between the drugs. On the log-odds scale,
The "no interaction" part represents the probability
of a DLT triggered by either treatment component acting independently.
That is,
In simple terms, P(no DLT for combination) = P(no DLT for drug 1) * P(no DLT from drug 2). To complete this part, the treatment components can then be modeled with monotone logistic regressions as before.
where is a monotone transformation of the doses of the
respective drug component $i$, such as
.
The inclusion of an interaction term allows
DLT rates above or below the "no-interaction" rate. The magnitude
of the interaction term may also be made dependent on the doses (or
other covariates) through regression. As an example, one could let
The specific functional form is specified in the usual notation for
a design matrix. The interaction model must respect the constraint
that whenever any dose approaches zero, then the interaction
term must vanish as well. Therefore, the interaction model must not
include an intercept term which would violate this consistency
requirement. A dual combination example can be found in
example-combo2
.
The model is extended to general combination treatments consisting
of components by expressing the probability
on
the logit scale as
Multiple drug-drug interactions among the components are
now possible, and are represented through the
interaction
terms
.
Regression models can be again be specified for each
and
, such as
Interactions for some subset of
the treatment components can be modeled with regression as well,
for example on products of doses,
For example, results in the three-way
interaction term
for drugs 1, 2, and 3.
For a triple combination example please refer to
example-combo3
.
Information on the toxicity of a drug may be available from
multiple studies or sources. Furthermore, one may wish to stratify
observations within a single study (for example into groups of
patients corresponding to different geographic regions, or multiple
dosing dose_info
corresponding to different schedules).
blrm_exnex
provides tools for robust Bayesian hierarchical
modeling to jointly model data from multiple sources. An additional
index on the parameters and observations
denotes the
groups. The resulting model allows the DLT rate
to differ across the groups. The general
-component model
becomes
for groups . The component toxicities
and interaction terms
are
modelled, as before, through regression. For example,
could be a logistic regression on
with intercept and log-slope
, and
regressed with coefficient
on a product
for some subset
of components.
Thus, for , we now have group-specific parameters
and
for each component
and interaction
.
The structure of the prior on
and
determines how much
information will be shared across groups
. Several modeling
choices are available in the function.
EX (Full exchangeability): One can assume the parameters are conditionally exchangeable given hyperparameters
independently across groups and treatment
components
. The covariance matrix
captures the patterns of cross-group
heterogeneity, and is parametrized with standard deviations
and the correlation
. Similarly for the
interactions, the fully-exchangeable model is
for groups and interactions
, and the prior on the covariance matrix
captures the amount of
heterogeneity expected in the interaction terms a-priori. The
covariance is again parametrized with standard deviations
and its correlation matrix.
Differential discounting: For one or more of the groups ,
larger deviations of
may be expected from the mean
, or of the interactions
from the mean
. Such differential heterogeneity can be modeled by mapping the groups
to strata through
,
and modifying the model specification to
where
For the interactions, the model becomes
where the covariance matrix is modelled as stratum specific standard deviations
and a stratum independent correlation matrix.
Each stratum
then corresponds to its own set of standard deviations
leading to different discounting per stratum.
Independent priors are specified for the component parameters
and
and
for the interaction parameters
for each stratum
. Inference for strata
where the prior is centered
on larger values of the
parameters will exhibit less shrinkage
towards the the means,
and
respectively.
EXNEX (Partial exchangeability): Another mechansim for increasing robustness is to introduce mixture priors for the group-specific parameters, where one mixture component is shared across groups, and the other is group-specific. The result, known as an EXchangeable-NonEXchangeable (EXNEX) type prior, has a form
when applied to the treatment-component parameters, and
when applied to the interaction parameters. The exchangeability weights
and
are fixed constants in the interval
that control the degree to which inference for group
is informed
by the exchangeable mixture components. Larger values for the
weights correspond to greater exchange of information, while smaller values
increase robustness in case of outlying observations in individual groups
.
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
Neuenschwander, B., Wandel, S., Roychoudhury, S., & Bailey, S. (2016). Robust exchangeability designs for early phase clinical trials with multiple strata. Pharmaceutical statistics, 15(2), 123-134.
Neuenschwander, B., Branson, M., & Gsponer, T. (2008). Critical aspects of the Bayesian approach to phase I cancer trials. Statistics in medicine, 27(13), 2420-2439.
Neuenschwander, B., Matano, A., Tang, Z., Roychoudhury, S., Wandel, S. Bailey, Stuart. (2014). A Bayesian Industry Approach to Phase I Combination Trials in Oncology. In Statistical methods in drug combination studies (Vol. 69). CRC Press.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # fit an example model. See documentation for "combo3" example example_model("combo3") # print a summary of the prior prior_summary(blrmfit, digits = 3) # print a summary of the posterior (model parameters) print(blrmfit) # summary of posterior for DLT rate by dose for observed covariate levels summ <- summary(blrmfit, interval_prob = c(0, 0.16, 0.33, 1)) print(cbind(hist_combo3, summ)) # summary of posterior for DLT rate by dose for new set of covariate levels newdata <- expand.grid( stratum_id = "BID", group_id = "Combo", drug_A = 400, drug_B = 800, drug_C = c(320, 400, 600, 800), stringsAsFactors = FALSE ) summ_pred <- summary(blrmfit, newdata = newdata, interval_prob = c(0, 0.16, 0.33, 1)) print(cbind(newdata, summ_pred)) # update the model after observing additional data newdata$num_patients <- rep(3, nrow(newdata)) newdata$num_toxicities <- c(0, 1, 2, 2) library(dplyr) blrmfit_new <- update(blrmfit, data = rbind(hist_combo3, newdata) %>% arrange(stratum_id, group_id) ) # updated posterior summary summ_upd <- summary(blrmfit_new, newdata = newdata, interval_prob = c(0, 0.16, 0.33, 1)) print(cbind(newdata, summ_upd)) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # fit an example model. See documentation for "combo3" example example_model("combo3") # print a summary of the prior prior_summary(blrmfit, digits = 3) # print a summary of the posterior (model parameters) print(blrmfit) # summary of posterior for DLT rate by dose for observed covariate levels summ <- summary(blrmfit, interval_prob = c(0, 0.16, 0.33, 1)) print(cbind(hist_combo3, summ)) # summary of posterior for DLT rate by dose for new set of covariate levels newdata <- expand.grid( stratum_id = "BID", group_id = "Combo", drug_A = 400, drug_B = 800, drug_C = c(320, 400, 600, 800), stringsAsFactors = FALSE ) summ_pred <- summary(blrmfit, newdata = newdata, interval_prob = c(0, 0.16, 0.33, 1)) print(cbind(newdata, summ_pred)) # update the model after observing additional data newdata$num_patients <- rep(3, nrow(newdata)) newdata$num_toxicities <- c(0, 1, 2, 2) library(dplyr) blrmfit_new <- update(blrmfit, data = rbind(hist_combo3, newdata) %>% arrange(stratum_id, group_id) ) # updated posterior summary summ_upd <- summary(blrmfit_new, newdata = newdata, interval_prob = c(0, 0.16, 0.33, 1)) print(cbind(newdata, summ_upd)) ## Recover user set sampling defaults options(.user_mc_options)
blrm_formula_linear
is a convenience function
for generating a formula for blrm_trial
and
blrm_exnex
with an interaction of the form:
blrm_formula_linear( ref_doses, max_interaction_level = 2, specific_interaction_terms = NULL )
blrm_formula_linear( ref_doses, max_interaction_level = 2, specific_interaction_terms = NULL )
ref_doses |
Numeric vector of reference doses with names corresponding to drug names |
max_interaction_level |
Highest interaction order to consider
|
specific_interaction_terms |
List of custom interaction terms to generate (e.g. list(c("drug1", "drug2"), c("drug1", "drug3"))). Default: NULL |
The function returns an object of class
blrm_formula
.
ref_doses <- c(drug_A = 10, drug_B = 20) # can be used with blrm_trial blrm_formula_linear(ref_doses)
ref_doses <- c(drug_A = 10, drug_B = 20) # can be used with blrm_trial blrm_formula_linear(ref_doses)
blrm_formula_saturating
is a convenience
function for generating a formula for blrm_trial
and
blrm_exnex
with an interaction of the form:
blrm_formula_saturating( ref_doses, max_interaction_level = 2, specific_interaction_terms = NULL )
blrm_formula_saturating( ref_doses, max_interaction_level = 2, specific_interaction_terms = NULL )
ref_doses |
Numeric vector of reference doses with names corresponding to drug names |
max_interaction_level |
Highest interaction order to consider
|
specific_interaction_terms |
List of custom interaction terms
to generate (e.g. |
The function returns an object of class blrm_formula
.
Widmer, L.A., Bean, A., Ohlssen, D., Weber, S., Principled Drug-Drug Interaction Terms for Bayesian Logistic Regression Models of Drug Safety in Oncology Phase I Combination Trials arXiv pre-print, 2023, doi:10.48550/arXiv.2302.11437
ref_doses <- c(drug_A = 10, drug_B = 20) # can be used with blrm_trial blrm_formula_saturating(ref_doses)
ref_doses <- c(drug_A = 10, drug_B = 20) # can be used with blrm_trial blrm_formula_saturating(ref_doses)
blrm_trial
facilitates the conduct of dose
escalation studies guided by Bayesian Logistic Regression
Models (BLRM). While the blrm_exnex
only fits the BLRM
model to data, the blrm_trial
function standardizes the
specification of the entire trial design and provides various
standardized functions for trial data accrual and derivation of
model summaries needed for dose-escalation decisions.
blrm_trial( data, dose_info, drug_info, simplified_prior = FALSE, EXNEX_comp = FALSE, EX_prob_comp_hist = 1, EX_prob_comp_new = 0.8, EXNEX_inter = FALSE, EX_prob_inter = 1, formula_generator = blrm_formula_saturating, interval_prob = c(0, 0.16, 0.33, 1), interval_max_mass = c(prob_underdose = 1, prob_target = 1, prob_overdose = 0.25), ... ) ## S3 method for class 'blrm_trial' print(x, ...)
blrm_trial( data, dose_info, drug_info, simplified_prior = FALSE, EXNEX_comp = FALSE, EX_prob_comp_hist = 1, EX_prob_comp_new = 0.8, EXNEX_inter = FALSE, EX_prob_inter = 1, formula_generator = blrm_formula_saturating, interval_prob = c(0, 0.16, 0.33, 1), interval_max_mass = c(prob_underdose = 1, prob_target = 1, prob_overdose = 0.25), ... ) ## S3 method for class 'blrm_trial' print(x, ...)
data |
dose-toxicity data available at design stage of trial |
dose_info |
specificaion of the dose levels as planned for the ongoing trial arms. |
drug_info |
specification of drugs used in trial arms. |
simplified_prior |
logical (defaults to |
EXNEX_comp |
logical (default to |
EX_prob_comp_hist |
prior weight ( |
EX_prob_comp_new |
prior weight ( |
EXNEX_inter |
logical (default to |
EX_prob_inter |
prior weight ( |
formula_generator |
formula generation function (see for
example |
interval_prob |
defines the interval probabilities reported in
the standard outputs. Defaults to |
interval_max_mass |
named vector defining for each interval of
the |
... |
Additional arguments are forwarded to |
x |
|
blrm_trial
constructs an object of class
blrm_trial
which stores the compelte information about
the study design of a dose-escalation trial. The study design
is defined through the data sets (see sections below for a
definition of the columns):
The data
argument defines
available dose-toxicity data at the design stage of the
trial. Together with the prior of model (without any data) this
defines the prior used for the trial conduct.
Definition of the pre-specified dose levels explored in the ongoing trial arms. Thus, all dose-toxcitiy trial data added to the object is expected correspond to one of the dose levels in the pre-defined set of dose_info.
Determines the drugs used in the trial, their units, reference dose level and optionally defines the expected probability for a toxicity at the reference dose.
Once the blrm_trial
object is setup the complete trial
design is specified and the model is fitted to the given
data
. This allows evaluation of the pre-specified dose
levels of the trial design wrt. to safety, i.e. whether the
starting dose of the trial fullfills the escalate with overdose
criterion (EWOC) condition.
The blrm_trial
trial can also be constructed in a 2-step
process which allows for a more convenient specification of the
prior since meta data like number of drugs and the like can be
used. See the example section for details.
After setup of the initial blrm_trial
object additional data
is added through the use of the update
method which has a
add_data
argument intended to add data from the ongoing
trial. The summary
function finally allows to extract
various model summaries. In particular, the EWOC criterion can be
calculated for the pre-defined dose levels of the trial.
The function returns an object of class blrm_trial
.
print(blrm_trial)
: print function.
As a convenience for the user, a simplified prior can be specifed
whenever the reference_p_dlt
column is present in the
drug_info
data set. However, the user is warned
that the simplified prior will change in future releases of the
package and thus we strongly discourage the use of the
simplified prior for setting up trial designs. The functionality
is intended to provide the user a quick start and as a starting
point. The actually instantiated prior can be seen as demonstrated
below in the examples.
The data given to the data
argument of blrm_trial
is
considered as the available at design stage of the trial. The
collected input data thus does not necessarily need to have the
same dose levels as the pre-specified dose_info for the
ongoing trial(s). It's data columns must include, but are not
limited to:
study
optional, only required for differential discounting of groups
number of patients
number of toxicities
Columns for the dose of each treatment component,
with column names matching the drug_name
values specified
in the drug_info
argument of blrm_trial
The drug information data-set defines drug properties. The fields included are:
name of drug which is also used as column name for the dose
reference dose
units used for drug amounts
optional; if provided, allows setup of a simplified prior
The drug_info
data-set pre-specifies the dose levels of the
ongoing trial. Thus, all data added to the blrm_trial
through the update
command must be consistent with the
pre-defined dose levels as no other than those pre-specified ones
can be explored in an ongoing trial.
optional column which assigns a unique id to each group_id/dose combination. If not specified the column is internally generated.
study
Columns for the dose of each treatment component,
with column names matching the drug_name
values specified
in the drug_info
argument of blrm_trial
Babb, J., Rogatko, A., & Zacks, S. (1998). Cancer phase I clinical trials: efficient dose escalation with overdose control. Statistics in medicine, 17(10), 1103-1120.
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
Other blrm_trial combo2 example:
dose_info_combo2
,
drug_info_combo2
,
example-combo2_trial
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # construct initial blrm_trial object from built-in example datasets combo2_trial_setup <- blrm_trial( data = hist_combo2, dose_info = dose_info_combo2, drug_info = drug_info_combo2, simplified_prior = TRUE ) # extract blrm_call to see setup of the prior as passed to blrm_exnex summary(combo2_trial_setup, "blrm_exnex_call") # Warning: The simplified prior will change between releases! # please refer to the combo2_trial example for a complete # example. You can obtain this example with # ?example-combo2_trial # or by running # example_model("combo2_trial") ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # construct initial blrm_trial object from built-in example datasets combo2_trial_setup <- blrm_trial( data = hist_combo2, dose_info = dose_info_combo2, drug_info = drug_info_combo2, simplified_prior = TRUE ) # extract blrm_call to see setup of the prior as passed to blrm_exnex summary(combo2_trial_setup, "blrm_exnex_call") # Warning: The simplified prior will change between releases! # please refer to the combo2_trial example for a complete # example. You can obtain this example with # ?example-combo2_trial # or by running # example_model("combo2_trial") ## Recover user set sampling defaults options(.user_mc_options)
One of two datasets from the application described in Neuenschwander et al
(2016). In the study trial_AB
, the risk of DLT was studied as a function of
dose for two drugs, drug A and drug B. Historical information on the toxicity
profiles of these two drugs is available from single agent trials trial_A
and trial_B
. Another study IIT
was run concurrently to trial_AB
, and
studies the same combination. A second dataset hist_combo2
is
available from this example, which includes only the data from the single
agent studies, prior to the initiation of trial_AB
and IIT
.
codata_combo2
codata_combo2
A data frame with 20 rows and 5 variables:
study
dose of Drug A
dose of Drug B
number of patients
number of DLTs
cohort number of patients
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) dref <- c(6, 960) num_comp <- 2 # two investigational drugs num_inter <- 1 # one drug-drug interaction needs to be modeled num_groups <- nlevels(codata_combo2$group_id) # no stratification needed num_strata <- 1 # no stratification needed blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) | group_id, data = codata_combo2, prior_EX_mu_comp = list(mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1)))), mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1))))), prior_EX_tau_comp = list(mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2))), mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2)))), prior_EX_mu_inter = mixmvnorm(c(1, 0, 1.121^2)), prior_EX_tau_inter = mixmvnorm(c(1, log(0.125), (log(4) / 1.96)^2)), prior_is_EXNEX_comp = rep(FALSE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_EX_prob_comp = matrix(1, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1, nrow = num_groups, ncol = num_inter), prior_tau_dist = 1 ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) dref <- c(6, 960) num_comp <- 2 # two investigational drugs num_inter <- 1 # one drug-drug interaction needs to be modeled num_groups <- nlevels(codata_combo2$group_id) # no stratification needed num_strata <- 1 # no stratification needed blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) | group_id, data = codata_combo2, prior_EX_mu_comp = list(mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1)))), mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1))))), prior_EX_tau_comp = list(mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2))), mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2)))), prior_EX_mu_inter = mixmvnorm(c(1, 0, 1.121^2)), prior_EX_tau_inter = mixmvnorm(c(1, log(0.125), (log(4) / 1.96)^2)), prior_is_EXNEX_comp = rep(FALSE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_EX_prob_comp = matrix(1, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1, nrow = num_groups, ncol = num_inter), prior_tau_dist = 1 ) ## Recover user set sampling defaults options(.user_mc_options)
Calculates the critical value of a model covariate for which a fixed quantile of the crude rate is equal to the specified (tail or interval) probability. The specified quantile can relate to the posterior or the predictive distribution of the response rate.
critical_quantile(object, ...) ## S3 method for class 'blrmfit' critical_quantile( object, newdata, x, p, qc, lower.tail, interval.x, extendInt.x = c("auto", "no", "yes", "downX", "upX"), log.x, predictive = FALSE, maxiter = 100, ... ) ## S3 method for class 'blrm_trial' critical_quantile( object, newdata, x, p, qc, lower.tail, interval.x, extendInt.x = c("auto", "no", "yes", "downX", "upX"), log.x, predictive = FALSE, maxiter = 100, ... )
critical_quantile(object, ...) ## S3 method for class 'blrmfit' critical_quantile( object, newdata, x, p, qc, lower.tail, interval.x, extendInt.x = c("auto", "no", "yes", "downX", "upX"), log.x, predictive = FALSE, maxiter = 100, ... ) ## S3 method for class 'blrm_trial' critical_quantile( object, newdata, x, p, qc, lower.tail, interval.x, extendInt.x = c("auto", "no", "yes", "downX", "upX"), log.x, predictive = FALSE, maxiter = 100, ... )
object |
fitted model object |
... |
not used in this function |
newdata |
optional data frame specifying for what to predict;
if missing, then the data of the input model |
x |
character giving the covariate name which is being search
for to meet the critical conditions. This also supports 'tidy'
parameter selection by specifying |
p |
cumulative probability corresponding to the critical quantile range. |
qc |
if given as a sorted vector of length 2, then the two
entries define the interval on the response rate scale which
must correspond to the cumulative probability |
lower.tail |
defines if probabilities are lower or upper tail
areas. Must be defined if |
interval.x |
interval the covariate |
extendInt.x |
controls if the interval given in
|
log.x |
determines if during the numerical search for the
critical value the covariate space is logarithmized. By default
|
predictive |
logical indicates if the critical quantile
relates to the posterior ( |
maxiter |
maximal number of iterations for root
finding. Defaults to |
The function searches for a critical value of the covariate
(
x
) at which the integral over the model response in the
specified interval to
(
qc
) is equal to the
given probability (
p
). The given interval is considered
a tail area when lower.tail
is used such that
for
TRUE
and for
FALSE
. At the
critical value the equality holds
Note that a solution not guranteed to exist under all
circumstances. However, for a single agent model and when
requesting a tail probability then a solution does exist. In case
an interval probability is specified, then the solution may not
necessarily exist and the root finding is confined to the range
specified in interval.x
.
In case the solution is requested for the predictive distribution
(predictive=TRUE
), then the respective problem solved leads
to the equality of
Furthermore, the covariate space is log transformed by default
whenever all values of the covariate are positive in the data
set. Values of
are shifted into the positive domain by the
machine precision to avoid issues with an ill-defined
.
For blrm_trial
objects the default arguments for p
,
qc
and lower.tail
are set to correspond to the
highest interval of interval_prob
to be constrained by the
respective interval_max_mass
(which are defined as part of
the blrm_trial
objects). This will in the default case
correspond to the EWOC metric. These defaults are only applied if
p
, qc
and lower.tail
are missing.
Vector of length equal to the number of rows of the input
data set with the crticial value for the covariate specified as
x
which fullfills the requirements as detailled
above. May return NA
for cases where no solution is
found on the specified interval interval.x
.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # fit an example model. See documentation for "combo2" example example_model("combo2", silent = TRUE) # Find dose of drug_A at which EWOC criterium is just fulfilled data_trial_ab <- subset(codata_combo2, group_id == "trial_AB") drug_A_crit <- critical_quantile(blrmfit, newdata = data_trial_ab, x = "drug_A", p = 0.25, qc = 0.33, lower.tail = FALSE ) data_trial_ab$drug_A <- drug_A_crit summary(blrmfit, newdata = data_trial_ab, interval_prob = c(0, 0.16, 0.33, 1)) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # fit an example model. See documentation for "combo2" example example_model("combo2", silent = TRUE) # Find dose of drug_A at which EWOC criterium is just fulfilled data_trial_ab <- subset(codata_combo2, group_id == "trial_AB") drug_A_crit <- critical_quantile(blrmfit, newdata = data_trial_ab, x = "drug_A", p = 0.25, qc = 0.33, lower.tail = FALSE ) data_trial_ab$drug_A <- drug_A_crit summary(blrmfit, newdata = data_trial_ab, interval_prob = c(0, 0.16, 0.33, 1)) ## Recover user set sampling defaults options(.user_mc_options)
Extract quantities that can be used to diagnose sampling behavior of the algorithms applied by Stan at the back-end of OncoBayes2.
## S3 method for class 'blrmfit' log_posterior(object, ...) ## S3 method for class 'blrmfit' nuts_params(object, pars = NULL, ...) ## S3 method for class 'blrmfit' rhat(object, pars = NULL, ...) ## S3 method for class 'blrmfit' neff_ratio(object, pars = NULL, ...)
## S3 method for class 'blrmfit' log_posterior(object, ...) ## S3 method for class 'blrmfit' nuts_params(object, pars = NULL, ...) ## S3 method for class 'blrmfit' rhat(object, pars = NULL, ...) ## S3 method for class 'blrmfit' neff_ratio(object, pars = NULL, ...)
object |
A |
... |
Arguments passed to individual methods. |
pars |
An optional character vector of parameter names.
For |
For more details see
bayesplot-extractors
.
The exact form of the output depends on the method.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) head(log_posterior(blrmfit)) np <- nuts_params(blrmfit) str(np) # extract the number of divergence transitions sum(subset(np, Parameter == "divergent__")$Value) head(rhat(blrmfit)) head(neff_ratio(blrmfit)) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) head(log_posterior(blrmfit)) np <- nuts_params(blrmfit) str(np) # extract the number of divergence transitions sum(subset(np, Parameter == "divergent__")$Value) head(rhat(blrmfit)) head(neff_ratio(blrmfit)) ## Recover user set sampling defaults options(.user_mc_options)
The data set defines all pre-defined dose-levels which can be explored in the dual-agent example trial.
dose_info_combo2
dose_info_combo2
An object of class tbl_df
(inherits from tbl
, data.frame
) with 42 rows and 4 columns.
study
drug A dose amount
drug B dose amount
unique id of record
Other blrm_trial combo2 example:
blrm_trial()
,
drug_info_combo2
,
example-combo2_trial
blrmfit
to draws
objectsTransform a blrmfit
object to a format supported by the
posterior package.
## S3 method for class 'blrmfit' as_draws(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_matrix(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_array(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_df(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_list(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_rvars(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
## S3 method for class 'blrmfit' as_draws(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_matrix(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_array(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_df(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_list(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...) ## S3 method for class 'blrmfit' as_draws_rvars(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
x |
A |
variable |
A character vector providing the variables to extract. By default, all variables are extracted. |
regex |
Logical; Should variable be treated as a (vector of)
regular expressions? Any variable in |
inc_warmup |
Should warmup draws be included? Defaults to
|
... |
Arguments passed to individual methods (if applicable). |
To subset iterations, chains, or draws, use the
subset_draws
method after
transforming the blrmfit
to a draws
object.
The function is experimental as the set of exported posterior variables are subject to updates.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # fit an example model. See documentation for "combo2" example example_model("combo2") post <- as_draws(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # fit an example model. See documentation for "combo2" example example_model("combo2") post <- as_draws(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
Data set describing the two drugs involved in the example for a dual-agent combination study.
drug_info_combo2
drug_info_combo2
A tibble with 2 rows (one per durg) and 4 columns:
name of drug
reference dose
units used for drug amounts
a-priori probability for a DLT at the reference dose
Other blrm_trial combo2 example:
blrm_trial()
,
dose_info_combo2
,
example-combo2_trial
Runs example models
example_model(topic, envir = parent.frame(), silent = FALSE)
example_model(topic, envir = parent.frame(), silent = FALSE)
topic |
example to run |
envir |
environment which the example is loaded into. Defaults to the caller environment. |
silent |
logical controlling if execution is run silently
(defaults to |
When topic is not specified a list of all possible topics is return. Whenever a valid topic is specified, the function inserts the example into the environment given and returns (invisibly) the updated environment.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## get a list of available examples example_model() ## run 3 component example example_model("combo3") ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## get a list of available examples example_model() ## run 3 component example example_model("combo3") ## Recover user set sampling defaults options(.user_mc_options)
Example using a combination of two experimental drugs.
The following example is described in the reference
Neuenschwander, B. et al (2016). The data are described
in the help page for codata_combo2
. In the study
trial_AB
, the risk of DLT was studied as a function of
dose for two drugs, drug A and drug B. Historical information
on the toxicity profiles of these two drugs was available from
single agent trials trial_A
and trial_B
. Another
study IIT
was run concurrently to trial_AB
, and
studies the same combination.
The model described in Neuenschwander, et al (2016) is adapted as follows.
For groups representing each of the four sources
of data mentioned above,
and
are logistic regressions for the single-agent toxicity of drugs A and B,
respectively, when administered in group . Conditional on the
regression parameters
and
,
the toxicity
for
the combination is modeled as the "no-interaction" DLT rate,
with a single interaction term added on the log odds scale,
A hierarchical model across the four groups allows
dose-toxicity information to be shared through common hyperparameters.
For the component parameters ,
For the mean, a further prior is specified as
while in the manuscript the prior and
for each
is
used, we deviate here and use instead
and
.
For the standard deviations and correlation parameters in the covariance matrix,
the specified priors are
,
,
and
for
.
For the interaction parameters in each group, the hierarchical
model has
for , with
and
Below is the syntax for specifying this fully exchangeable model in
blrm_exnex
.
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) dref <- c(6, 960) num_comp <- 2 # two investigational drugs num_inter <- 1 # one drug-drug interaction needs to be modeled num_groups <- nlevels(codata_combo2$group_id) # no stratification needed num_strata <- 1 # no stratification needed blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) | group_id, data = codata_combo2, prior_EX_mu_comp = list(mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1)))), mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1))))), prior_EX_tau_comp = list(mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2))), mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2)))), prior_EX_mu_inter = mixmvnorm(c(1, 0, 1.121^2)), prior_EX_tau_inter = mixmvnorm(c(1, log(0.125), (log(4) / 1.96)^2)), prior_is_EXNEX_comp = rep(FALSE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_EX_prob_comp = matrix(1, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1, nrow = num_groups, ncol = num_inter), prior_tau_dist = 1 ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) dref <- c(6, 960) num_comp <- 2 # two investigational drugs num_inter <- 1 # one drug-drug interaction needs to be modeled num_groups <- nlevels(codata_combo2$group_id) # no stratification needed num_strata <- 1 # no stratification needed blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) | group_id, data = codata_combo2, prior_EX_mu_comp = list(mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1)))), mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1))))), prior_EX_tau_comp = list(mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2))), mixmvnorm(c(1, log(0.250), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2)))), prior_EX_mu_inter = mixmvnorm(c(1, 0, 1.121^2)), prior_EX_tau_inter = mixmvnorm(c(1, log(0.125), (log(4) / 1.96)^2)), prior_is_EXNEX_comp = rep(FALSE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_EX_prob_comp = matrix(1, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1, nrow = num_groups, ncol = num_inter), prior_tau_dist = 1 ) ## Recover user set sampling defaults options(.user_mc_options)
Example using blrm_trial
to
guide the built-in two-drug combination study example.
blrm_trial
is used to collect
and store all relevant design information for the example. Subsequent
use of the update.blrm_trial
command
allows convenient model fitting via
blrm_exnex
. The
summary.blrm_trial
method allows
exploration of the design and modeling results.
To run this example, use example_model("combo2_trial")
. See
example_model
.
Other blrm_trial combo2 example:
blrm_trial()
,
dose_info_combo2
,
drug_info_combo2
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) library(tibble) library(dplyr) library(tidyr) # Combo2 example using blrm_trial functionality # construct initial blrm_trial object from built-in example datasets combo2_trial_setup <- blrm_trial( data = hist_combo2, dose_info = dose_info_combo2, drug_info = drug_info_combo2, simplified_prior = FALSE ) # summary of dimensionality of data structures dims <- summary(combo2_trial_setup, "dimensionality") # Fit the initial model with the historical data and fully specified prior combo2_trial_start <- update( combo2_trial_setup, ## bivariate normal prior for drug A and drug B of intercept and ## log-slope prior_EX_mu_comp = replicate(2, mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1)))) , FALSE), prior_EX_tau_comp = replicate(2, mixmvnorm(c(1, log(0.25), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2))) , FALSE), prior_EX_mu_inter = mixmvnorm(c(1, 0, 1.121^2)), prior_EX_tau_inter = mixmvnorm(c(1, log(0.125), (log(4) / 1.96)^2)), prior_is_EXNEX_comp = c(FALSE, FALSE), prior_is_EXNEX_inter = FALSE, prior_EX_prob_comp = matrix(1, nrow = dims$num_groups, ncol = 2 ), prior_EX_prob_inter = matrix(1, nrow = nlevels(dose_info_combo2$group_id), ncol = 1 ), prior_tau_dist = 1 ) # print summary of prior specification prior_summary(combo2_trial_start) # summarize inference at observed dose levels summary(combo2_trial_start, "data_prediction") # summarize inference at specified dose levels summary(combo2_trial_start, "dose_prediction") # Update again with new data # using update() with data argument supplied # dem <- update(combo2_trial_start, data = codata_combo2) # alternate way using update() with add_data argument for # new observations only (those collected after the trial # design stage). new_data <- filter(codata_combo2, cohort_time > 0) combo2_trial <- update(combo2_trial_start, add_data = new_data) summary(combo2_trial, "data") # cohort_time is tracked summary(combo2_trial, "data_prediction") summary(combo2_trial, "dose_prediction") rm(dims, new_data) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) library(tibble) library(dplyr) library(tidyr) # Combo2 example using blrm_trial functionality # construct initial blrm_trial object from built-in example datasets combo2_trial_setup <- blrm_trial( data = hist_combo2, dose_info = dose_info_combo2, drug_info = drug_info_combo2, simplified_prior = FALSE ) # summary of dimensionality of data structures dims <- summary(combo2_trial_setup, "dimensionality") # Fit the initial model with the historical data and fully specified prior combo2_trial_start <- update( combo2_trial_setup, ## bivariate normal prior for drug A and drug B of intercept and ## log-slope prior_EX_mu_comp = replicate(2, mixmvnorm(c(1, logit(0.2), 0, diag(c(2^2, 1)))) , FALSE), prior_EX_tau_comp = replicate(2, mixmvnorm(c(1, log(0.25), log(0.125), diag(c(log(4)/1.96, log(4)/1.96)^2))) , FALSE), prior_EX_mu_inter = mixmvnorm(c(1, 0, 1.121^2)), prior_EX_tau_inter = mixmvnorm(c(1, log(0.125), (log(4) / 1.96)^2)), prior_is_EXNEX_comp = c(FALSE, FALSE), prior_is_EXNEX_inter = FALSE, prior_EX_prob_comp = matrix(1, nrow = dims$num_groups, ncol = 2 ), prior_EX_prob_inter = matrix(1, nrow = nlevels(dose_info_combo2$group_id), ncol = 1 ), prior_tau_dist = 1 ) # print summary of prior specification prior_summary(combo2_trial_start) # summarize inference at observed dose levels summary(combo2_trial_start, "data_prediction") # summarize inference at specified dose levels summary(combo2_trial_start, "dose_prediction") # Update again with new data # using update() with data argument supplied # dem <- update(combo2_trial_start, data = codata_combo2) # alternate way using update() with add_data argument for # new observations only (those collected after the trial # design stage). new_data <- filter(codata_combo2, cohort_time > 0) combo2_trial <- update(combo2_trial_start, add_data = new_data) summary(combo2_trial, "data") # cohort_time is tracked summary(combo2_trial, "data_prediction") summary(combo2_trial, "dose_prediction") rm(dims, new_data) ## Recover user set sampling defaults options(.user_mc_options)
Example using a combination of two experimental drugs, with EXNEX and differential discounting.
This dataset involves a hypothetical dose-escalation study of combination
therapy with three treatment components. From two previous studies
HistAgent1
and HistAgent2
, historical data is available on each
of the treatments as single-agents, as well as two of the two-way
combinations. However, due to a difference in treatment schedule between the
Combo
study and the historical studies, a stratification (through stratum_id
)
is made between the groups to allow differential discounting of the
alternate-schedule data. The association is as below.
group_id (j): | stratum_id (s_j): |
Combo (1) | BID (1) |
HistAgent1 (2) | QD (2) |
HistAgent2 (3) | QD (2) |
For additional robustness, EXNEX priors are used for all group-level treatment components while not for the interaction parameters. This is to limit the amount of borrowing in case of significant heterogeneity across groups.
The complete model is as follows. As a function of doses , the
DLT rate in group
is, for
,
In group each treatment component
toxicity is modeled with
logistic regression,
The intercept and log-slope parameters
are are given an EXNEX prior
where the exchangeability weights are all .
The NEX parameters are set to
,
for all components
and
groups
, and the EX parameters are modeled hierarchically. The
mean of the exchangeable part has the distribution
with and
for each component
.
For differentially discounting data from each schedule (QD and BID), the
covariance parameters for the exchangeable part
are allowed to vary across groups depending on their mapping
to strata
as described above. For stratum
(
BID
,
which contains only the group (
Combo
)), the standard
deviations are modeled as
Whereas in stratum (
QD
, which contains the historical groups
(
HistData1
, HistData2
)), the standard deviations are
For all interaction parameters ,
,
, and
(
), the following
prior is assumed:
The exchangeability weights are for all
parameters with EXNEX. Here, for each
,
,
, and
, we take
and for each ,
,
, and
,
for both strata .
Below is the syntax for specifying this model in blrm_exnex
.
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## example combo3 library(abind) dref <- c(500, 500, 1000) num_comp <- 3 num_inter <- choose(3, 2) + 1 num_strata <- nlevels(hist_combo3$stratum_id) num_groups <- nlevels(hist_combo3$group_id) blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 1 + I(log(drug_C / dref[3])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) + I(drug_A / dref[1] * drug_C / dref[3]) + I(drug_B / dref[2] * drug_C / dref[3]) + I(drug_A / dref[1] * drug_B / dref[2] * drug_C / dref[3]) | stratum_id / group_id, data = hist_combo3, prior_EX_mu_comp = replicate(num_comp, mixmvnorm(c(1, logit(1/3), 0, diag(c(2^2, 1)))), FALSE), prior_EX_tau_comp = list(replicate(num_comp, mixmvnorm(c(1, log(c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE), replicate(num_comp, mixmvnorm(c(1, log(2 * c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE)), prior_EX_mu_inter = mixmvnorm(c(1, rep.int(0, num_inter), diag((rep.int(sqrt(2) / 2, num_inter))^2))), prior_EX_tau_inter = replicate(num_strata, mixmvnorm(c(1, rep.int(log(0.25), num_inter), diag((rep.int(log(2) / 1.96, num_inter))^2))), FALSE), prior_EX_prob_comp = matrix(0.9, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1.0, nrow = num_groups, ncol = num_inter), prior_is_EXNEX_comp = rep(TRUE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_tau_dist = 1, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## example combo3 library(abind) dref <- c(500, 500, 1000) num_comp <- 3 num_inter <- choose(3, 2) + 1 num_strata <- nlevels(hist_combo3$stratum_id) num_groups <- nlevels(hist_combo3$group_id) blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 1 + I(log(drug_C / dref[3])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) + I(drug_A / dref[1] * drug_C / dref[3]) + I(drug_B / dref[2] * drug_C / dref[3]) + I(drug_A / dref[1] * drug_B / dref[2] * drug_C / dref[3]) | stratum_id / group_id, data = hist_combo3, prior_EX_mu_comp = replicate(num_comp, mixmvnorm(c(1, logit(1/3), 0, diag(c(2^2, 1)))), FALSE), prior_EX_tau_comp = list(replicate(num_comp, mixmvnorm(c(1, log(c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE), replicate(num_comp, mixmvnorm(c(1, log(2 * c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE)), prior_EX_mu_inter = mixmvnorm(c(1, rep.int(0, num_inter), diag((rep.int(sqrt(2) / 2, num_inter))^2))), prior_EX_tau_inter = replicate(num_strata, mixmvnorm(c(1, rep.int(log(0.25), num_inter), diag((rep.int(log(2) / 1.96, num_inter))^2))), FALSE), prior_EX_prob_comp = matrix(0.9, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1.0, nrow = num_groups, ncol = num_inter), prior_is_EXNEX_comp = rep(TRUE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_tau_dist = 1, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
Example using a single experimental drug.
The single agent example is described in the reference
Neuenschwander, B. et al (2008). The data are described
in the help page for hist_SA
. In this case, the data
come from only one study, with the treatment being only single
agent. Hence the model specified does not involve a hierarchical
prior for the intercept and log-slope parameters. The model
described in Neuenschwander, et al (2008) is adapted as follows:
where , and the prior for
is
and and
are constants.
In the blrm_exnex
framework, in which
the prior must be specified as a hierarchical model
with additional priors on
and
,
the simple prior distribution above is accomplished
by fixing the diagonal elements
and
of
to zero, and taking
The arguments prior_tau_dist
and prior_EX_tau_mean_comp
as specified below ensure that the 's are fixed at zero.
Neuenschwander, B., Branson, M., & Gsponer, T. (2008). Critical aspects of the Bayesian approach to phase I cancer trials. Statistics in medicine, 27(13), 2420-2439.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## Example from Neuenschwander, B., et al. (2009). Stats in Medicine num_comp <- 1 # one investigational drug num_inter <- 0 # no drug-drug interactions need to be modeled num_groups <- nlevels(hist_SA$group_id) # no stratification needed num_strata <- 1 # no stratification needed dref <- 50 ## Since there is no prior information the hierarchical model ## is not used in this example by setting tau to (almost) 0. blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + log(drug_A / dref) | 0 | group_id, data = hist_SA, prior_EX_mu_comp = mixmvnorm(c(1, logit(1 / 2), log(1), diag(c(2^2, 1)))), ## Here we take tau as known and as zero. ## This disables the hierarchical prior which is ## not required in this example as we analyze a ## single trial. prior_EX_tau_comp = mixmvnorm(c(1, 0, 0, diag(c(1, 1)))), prior_EX_prob_comp = matrix(1, nrow = num_comp, ncol = 1), prior_tau_dist = 0, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## Example from Neuenschwander, B., et al. (2009). Stats in Medicine num_comp <- 1 # one investigational drug num_inter <- 0 # no drug-drug interactions need to be modeled num_groups <- nlevels(hist_SA$group_id) # no stratification needed num_strata <- 1 # no stratification needed dref <- 50 ## Since there is no prior information the hierarchical model ## is not used in this example by setting tau to (almost) 0. blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + log(drug_A / dref) | 0 | group_id, data = hist_SA, prior_EX_mu_comp = mixmvnorm(c(1, logit(1 / 2), log(1), diag(c(2^2, 1)))), ## Here we take tau as known and as zero. ## This disables the hierarchical prior which is ## not required in this example as we analyze a ## single trial. prior_EX_tau_comp = mixmvnorm(c(1, 0, 0, diag(c(1, 1)))), prior_EX_prob_comp = matrix(1, nrow = num_comp, ncol = 1), prior_tau_dist = 0, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
One of two datasets from the application described in Neuenschwander et al
(2016). The risk of DLT is to be studied as a function of dose for two drugs,
drug A and drug B. Historical information on the toxicity profiles of these
two drugs is available from single agent trials trial_A
and trial_B
.
A second dataset codata_combo2
is available from this application,
which includes additional dose-toxicity data from trial_AB
and IIT
of the
combination of Drugs A and B.
hist_combo2
hist_combo2
A tibble with 11 rows and 5 variables:
study
dose of Drug A
dose of Drug B
number of patients
number of DLTs
cohort number of patients
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
This dataset involves a hypothetical dose-escalation study of combination
therapy with three treatment components. From two previous studies
HistAgent1
and HistAgent2
, historical data is available on each
of the treatments as single-agents, as well as two of the two-way
combinations. However, due to a difference in treatment schedule between the
Combo
study and the historical studies, a stratification (through stratum_id
)
is made between the groups to allow differential discounting of the
alternate-dose data.
hist_combo3
hist_combo3
A data frame with 18 rows and 7 variables:
study
dose of Drug A
dose of Drug B
dose of Drug C
number of patients
number of DLTs
stratum for group_id
's used for differential discounting
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## example combo3 library(abind) dref <- c(500, 500, 1000) num_comp <- 3 num_inter <- choose(3, 2) + 1 num_strata <- nlevels(hist_combo3$stratum_id) num_groups <- nlevels(hist_combo3$group_id) blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 1 + I(log(drug_C / dref[3])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) + I(drug_A / dref[1] * drug_C / dref[3]) + I(drug_B / dref[2] * drug_C / dref[3]) + I(drug_A / dref[1] * drug_B / dref[2] * drug_C / dref[3]) | stratum_id / group_id, data = hist_combo3, prior_EX_mu_comp = replicate(num_comp, mixmvnorm(c(1, logit(1/3), 0, diag(c(2^2, 1)))), FALSE), prior_EX_tau_comp = list(replicate(num_comp, mixmvnorm(c(1, log(c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE), replicate(num_comp, mixmvnorm(c(1, log(2 * c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE)), prior_EX_mu_inter = mixmvnorm(c(1, rep.int(0, num_inter), diag((rep.int(sqrt(2) / 2, num_inter))^2))), prior_EX_tau_inter = replicate(num_strata, mixmvnorm(c(1, rep.int(log(0.25), num_inter), diag((rep.int(log(2) / 1.96, num_inter))^2))), FALSE), prior_EX_prob_comp = matrix(0.9, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1.0, nrow = num_groups, ncol = num_inter), prior_is_EXNEX_comp = rep(TRUE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_tau_dist = 1, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## example combo3 library(abind) dref <- c(500, 500, 1000) num_comp <- 3 num_inter <- choose(3, 2) + 1 num_strata <- nlevels(hist_combo3$stratum_id) num_groups <- nlevels(hist_combo3$group_id) blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + I(log(drug_A / dref[1])) | 1 + I(log(drug_B / dref[2])) | 1 + I(log(drug_C / dref[3])) | 0 + I(drug_A / dref[1] * drug_B / dref[2]) + I(drug_A / dref[1] * drug_C / dref[3]) + I(drug_B / dref[2] * drug_C / dref[3]) + I(drug_A / dref[1] * drug_B / dref[2] * drug_C / dref[3]) | stratum_id / group_id, data = hist_combo3, prior_EX_mu_comp = replicate(num_comp, mixmvnorm(c(1, logit(1/3), 0, diag(c(2^2, 1)))), FALSE), prior_EX_tau_comp = list(replicate(num_comp, mixmvnorm(c(1, log(c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE), replicate(num_comp, mixmvnorm(c(1, log(2 * c(0.25, 0.125)), diag(c(log(4)/1.96, log(4)/1.96)^2))), FALSE)), prior_EX_mu_inter = mixmvnorm(c(1, rep.int(0, num_inter), diag((rep.int(sqrt(2) / 2, num_inter))^2))), prior_EX_tau_inter = replicate(num_strata, mixmvnorm(c(1, rep.int(log(0.25), num_inter), diag((rep.int(log(2) / 1.96, num_inter))^2))), FALSE), prior_EX_prob_comp = matrix(0.9, nrow = num_groups, ncol = num_comp), prior_EX_prob_inter = matrix(1.0, nrow = num_groups, ncol = num_inter), prior_is_EXNEX_comp = rep(TRUE, num_comp), prior_is_EXNEX_inter = rep(FALSE, num_inter), prior_tau_dist = 1, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
Example data from the application in Neuenschwander, et. al. 2008, from an "open-label, multicenter, non-comparative, dose-escalation cancer trial to characterize the safety, tolerability, and pharmacokinetic profile of a drug and to determine its MTD."
hist_SA
hist_SA
A data frame with 5 rows and 4 variables:
study
dose
number of patients
number of events
Neuenschwander, B., Branson, M., & Gsponer, T. (2008). Critical aspects of the Bayesian approach to phase I cancer trials. Statistics in medicine, 27(13), 2420-2439.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## Example from Neuenschwander, B., et al. (2009). Stats in Medicine num_comp <- 1 # one investigational drug num_inter <- 0 # no drug-drug interactions need to be modeled num_groups <- nlevels(hist_SA$group_id) # no stratification needed num_strata <- 1 # no stratification needed dref <- 50 ## Since there is no prior information the hierarchical model ## is not used in this example by setting tau to (almost) 0. blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + log(drug_A / dref) | 0 | group_id, data = hist_SA, prior_EX_mu_comp = mixmvnorm(c(1, logit(1 / 2), log(1), diag(c(2^2, 1)))), ## Here we take tau as known and as zero. ## This disables the hierarchical prior which is ## not required in this example as we analyze a ## single trial. prior_EX_tau_comp = mixmvnorm(c(1, 0, 0, diag(c(1, 1)))), prior_EX_prob_comp = matrix(1, nrow = num_comp, ncol = 1), prior_tau_dist = 0, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## Example from Neuenschwander, B., et al. (2009). Stats in Medicine num_comp <- 1 # one investigational drug num_inter <- 0 # no drug-drug interactions need to be modeled num_groups <- nlevels(hist_SA$group_id) # no stratification needed num_strata <- 1 # no stratification needed dref <- 50 ## Since there is no prior information the hierarchical model ## is not used in this example by setting tau to (almost) 0. blrmfit <- blrm_exnex( cbind(num_toxicities, num_patients - num_toxicities) ~ 1 + log(drug_A / dref) | 0 | group_id, data = hist_SA, prior_EX_mu_comp = mixmvnorm(c(1, logit(1 / 2), log(1), diag(c(2^2, 1)))), ## Here we take tau as known and as zero. ## This disables the hierarchical prior which is ## not required in this example as we analyze a ## single trial. prior_EX_tau_comp = mixmvnorm(c(1, 0, 0, diag(c(1, 1)))), prior_EX_prob_comp = matrix(1, nrow = num_comp, ncol = 1), prior_tau_dist = 0, prior_PD = FALSE ) ## Recover user set sampling defaults options(.user_mc_options)
Calculates the logit (log-odds) and inverse-logit.
logit(mu) inv_logit(eta)
logit(mu) inv_logit(eta)
mu |
A numeric object with probabilies, with values in the in
the range |
eta |
A numeric object with log-odds values, with values in
the range |
Values of mu equal to 0 or 1 will return -Inf or Inf respectively.
A numeric object of the same type as mu and eta containing the logits or inverse logit of the input values. The logit and inverse transformation equates to
logit(0.2) inv_logit(-1.386)
logit(0.2) inv_logit(-1.386)
Return the number of posterior samples
## S3 method for class 'blrmfit' nsamples(object, ...)
## S3 method for class 'blrmfit' nsamples(object, ...)
object |
fitted model object |
... |
not used in this function |
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## run single-agent analysis which defines blrmfit model object example_model("single_agent", silent = TRUE) nsamples(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## run single-agent analysis which defines blrmfit model object example_model("single_agent", silent = TRUE) nsamples(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
Bayesian logistic regression model with optional EXchangeability-NonEXchangeability parameter modelling for flexible borrowing from historical or concurrent data-sources. The safety model can guide dose-escalation decisions for adaptive Oncology phase I dose-escalation trials which involve an arbitrary number of drugs.
Option | Default | Description |
OncoBayes2.MC.warmup |
1000 | MCMC warmup iterations |
OncoBayes2.MC.iter |
2000 | total MCMC iterations |
OncoBayes2.MC.save_warmup |
TRUE | save warmup samples |
OncoBayes2.MC.chains |
4 | MCMC chains |
OncoBayes2.MC.thin |
1 | MCMC thinning |
OncoBayes2.MC.control |
list(adapt_delta=0.99, |
sets control argument for Stan call |
stepsize=0.1 ) |
||
OncoBayes2.MC.backend |
rstan | Backend used to run Stan (rstan or cmdstanr ) |
OncoBayes2.abbreviate.min |
0 | Minimal length of variable names |
when abbreviating variable names. | ||
The default 0 disables abbreviation. | ||
Maintainer: Sebastian Weber [email protected]
Authors:
Lukas A. Widmer [email protected]
Andrew Bean [email protected]
Other contributors:
Novartis Pharma AG [copyright holder]
Trustees of Columbia University (R/stanmodels.R, configure, configure.win) [copyright holder]
Neuenschwander, B., Roychoudhury, S., & Schmidli, H. (2016). On the use of co-data in clinical trials. Statistics in Biopharmaceutical Research, 8(3), 345-354.
Neuenschwander, B., Wandel, S., Roychoudhury, S., & Bailey, S. (2016). Robust exchangeability designs for early phase clinical trials with multiple strata. Pharmaceutical statistics, 15(2), 123-134.
Neuenschwander, B., Branson, M., & Gsponer, T. (2008). Critical aspects of the Bayesian approach to phase I cancer trials. Statistics in medicine, 27(13), 2420-2439.
Neuenschwander, B., Matano, A., Tang, Z., Roychoudhury, S., Wandel, S. Bailey, Stuart. (2014). A Bayesian Industry Approach to Phase I Combination Trials in Oncology. In Statistical methods in drug combination studies (Vol. 69). CRC Press.
Stan Development Team (2019). RStan: the R interface to Stan. R package version 2.19.2. https://mc-stan.org
Warning: these methods are at an experimental stage of development, and may change with future releases.
Plotting methods for blrmfit
and blrm_trial
objects.
plot_toxicity_curve(object, ...) plot_toxicity_intervals(object, ...) plot_toxicity_intervals_stacked(object, ...) ## S3 method for class 'blrmfit' plot_toxicity_curve( object, newdata, x, group, xlim, ylim, transform = TRUE, prob = 0.5, prob_outer = 0.95, size = 0.75, alpha = 1, facet_args = list(), hline_at = c(0.16, 0.33), grid_length = 100, ... ) ## S3 method for class 'blrm_trial' plot_toxicity_curve( object, newdata, x, group, xlim, ylim, transform = TRUE, prob = 0.5, prob_outer = 0.95, size = 0.75, alpha = 1, facet_args = list(), hline_at, grid_length = 100, ewoc_shading = TRUE, ... ) ## S3 method for class 'blrmfit' plot_toxicity_intervals( object, newdata, x, group, interval_prob = c(0, 0.16, 0.33, 1), interval_max_mass = c(NA, NA, 0.25), ewoc_colors = c("green", "red"), facet_args = list(), ... ) ## S3 method for class 'blrm_trial' plot_toxicity_intervals( object, newdata, x, group, interval_prob, interval_max_mass, ewoc_colors = c("green", "red"), ... ) ## S3 method for class 'blrmfit' plot_toxicity_intervals_stacked( object, newdata, x, group, xlim, ylim = c(0, 0.5), predictive = FALSE, transform = !predictive, interval_prob, grid_length = 100, facet_args = list(), ... ) ## S3 method for class 'blrm_trial' plot_toxicity_intervals_stacked( object, newdata, x, group, xlim, ylim = c(0, 0.5), predictive = FALSE, transform = !predictive, interval_prob, grid_length = 100, ewoc_shading = TRUE, facet_args = list(), ... )
plot_toxicity_curve(object, ...) plot_toxicity_intervals(object, ...) plot_toxicity_intervals_stacked(object, ...) ## S3 method for class 'blrmfit' plot_toxicity_curve( object, newdata, x, group, xlim, ylim, transform = TRUE, prob = 0.5, prob_outer = 0.95, size = 0.75, alpha = 1, facet_args = list(), hline_at = c(0.16, 0.33), grid_length = 100, ... ) ## S3 method for class 'blrm_trial' plot_toxicity_curve( object, newdata, x, group, xlim, ylim, transform = TRUE, prob = 0.5, prob_outer = 0.95, size = 0.75, alpha = 1, facet_args = list(), hline_at, grid_length = 100, ewoc_shading = TRUE, ... ) ## S3 method for class 'blrmfit' plot_toxicity_intervals( object, newdata, x, group, interval_prob = c(0, 0.16, 0.33, 1), interval_max_mass = c(NA, NA, 0.25), ewoc_colors = c("green", "red"), facet_args = list(), ... ) ## S3 method for class 'blrm_trial' plot_toxicity_intervals( object, newdata, x, group, interval_prob, interval_max_mass, ewoc_colors = c("green", "red"), ... ) ## S3 method for class 'blrmfit' plot_toxicity_intervals_stacked( object, newdata, x, group, xlim, ylim = c(0, 0.5), predictive = FALSE, transform = !predictive, interval_prob, grid_length = 100, facet_args = list(), ... ) ## S3 method for class 'blrm_trial' plot_toxicity_intervals_stacked( object, newdata, x, group, xlim, ylim = c(0, 0.5), predictive = FALSE, transform = !predictive, interval_prob, grid_length = 100, ewoc_shading = TRUE, facet_args = list(), ... )
object |
fitted model object |
... |
currently unused |
newdata |
optional data frame specifying for what to predict;
if missing, then the data of the input model |
x |
Character giving the parameter name to be mapped to the
x-axis. This also supports 'tidy' parameter selection by
specifying |
group |
Grouping variable(s) whose levels will be mapped to
different facets of the plot. |
xlim |
x-axis limits |
ylim |
y-axis limits on the probability scale |
transform |
logical (defaults to |
prob |
central probability mass to report for the inner ribbon, i.e.
the quantiles |
prob_outer |
central probability mass to report for the outer ribbon, i.e.
the quantiles |
alpha , size
|
Arguments passed to geoms. For this plot, |
facet_args |
A named list of arguments (other than |
hline_at |
Location(s) of horizontal guide lines (passed to
|
grid_length |
Number of grid points within |
ewoc_shading |
logical indicates if doses violating EWOC should be
shaded in gray. Applies only to |
interval_prob |
defines the interval probabilities reported in
the standard outputs. Defaults to |
interval_max_mass |
vector defining for each interval of
the |
ewoc_colors |
Fill colors used for bars indicating EWOC OK or not.
Vector of two characters, each of which must correspond to
|
predictive |
logical indicates if the posterior predictive is
being summarized. Defaults to |
plot_toxicity_curve
plots continuous profiles of the dose-toxicity curve.
plot_toxicity_intervals
plots the posterior probability mass in
subintervals of , at a discrete set of provisional doses.
plot_toxicity_intervals_stacked
is similar to
plot_toxicity_intervals
, but over a continuous range of doses.
A ggplot object that can be further
customized using the ggplot2
package.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("combo2", silent = TRUE) # Plot the dose-toxicity curve plot_toxicity_curve(blrmfit, x = "drug_A", group = ~ group_id * drug_B, newdata = subset(dose_info_combo2, group_id == "trial_AB"), facet_args = list(ncol = 4) ) # Plot posterior DLT-rate-interval probabilities at discrete dose levels plot_toxicity_intervals(blrmfit, x = "drug_A", group = ~ group_id * drug_B, newdata = subset(dose_info_combo2, group_id == "trial_AB") ) # Plot posterior DLT-rate-interval probabilities over continuous dose plot_toxicity_intervals_stacked(blrmfit, x = "drug_A", group = ~ group_id * drug_B, newdata = subset(dose_info_combo2, group_id == "trial_AB") ) # Plot predictive distribution probabilities over continuous dose plot_toxicity_intervals_stacked(blrmfit, x = "drug_A", group = ~ group_id * drug_B, predictive = TRUE, interval_prob = c(-1, 0, 1, 6), newdata = transform( subset( dose_info_combo2, group_id == "trial_AB" ), num_patients = 6, num_toxicities = 0 ) ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("combo2", silent = TRUE) # Plot the dose-toxicity curve plot_toxicity_curve(blrmfit, x = "drug_A", group = ~ group_id * drug_B, newdata = subset(dose_info_combo2, group_id == "trial_AB"), facet_args = list(ncol = 4) ) # Plot posterior DLT-rate-interval probabilities at discrete dose levels plot_toxicity_intervals(blrmfit, x = "drug_A", group = ~ group_id * drug_B, newdata = subset(dose_info_combo2, group_id == "trial_AB") ) # Plot posterior DLT-rate-interval probabilities over continuous dose plot_toxicity_intervals_stacked(blrmfit, x = "drug_A", group = ~ group_id * drug_B, newdata = subset(dose_info_combo2, group_id == "trial_AB") ) # Plot predictive distribution probabilities over continuous dose plot_toxicity_intervals_stacked(blrmfit, x = "drug_A", group = ~ group_id * drug_B, predictive = TRUE, interval_prob = c(-1, 0, 1, 6), newdata = transform( subset( dose_info_combo2, group_id == "trial_AB" ), num_patients = 6, num_toxicities = 0 ) ) ## Recover user set sampling defaults options(.user_mc_options)
Posterior intervals of all model parameters.
## S3 method for class 'blrmfit' posterior_interval(object, prob = 0.95, ...)
## S3 method for class 'blrmfit' posterior_interval(object, prob = 0.95, ...)
object |
fitted model object |
prob |
central probability mass to report, i.e. the quantiles 0.5-prob/2 and 0.5+prob/2 are displayed. Multiple central widths can be specified. |
... |
not used in this function |
Reports the quantiles of posterior parameters which correspond to the central probability mass specified. The output includes the posterior of the hyper-parameters and the posterior of each group estimate.
Matrix of two columns for the central probability interval
prob
for all parameters of the model.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) posterior_interval(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) posterior_interval(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
Calculates the posterior of the linear predictor.
## S3 method for class 'blrmfit' posterior_linpred(object, transform = FALSE, newdata, draws, ...)
## S3 method for class 'blrmfit' posterior_linpred(object, transform = FALSE, newdata, draws, ...)
object |
fitted model object |
transform |
logical (defaults to |
newdata |
optional data frame specifying for what to predict;
if missing, then the data of the input model |
draws |
number of returned posterior draws; by default the entire posterior is returned |
... |
not used in this function |
Simulates the posterior of the linear predictor of the model
object
for the specified data set.
Matrix of dimensions draws
by nrow(newdata)
where row correspond to a draw of the posterior and each
column corresponds to a row in newdata
. The columns are
labelled with the row.names
of newdata
.
The groups and strata as defined when running the blrm_exnex
analysis cannot be changed at a later stage. As a result no
evaluations can be performed for groups which have not been present
in the data set used for running the analysis. However, it is
admissible to code the group (and/or stratum) column as a
factor
which contains empty levels. These groups are thus
not contained in the fitting data set and they are assigned by
default to the first stratum. In addition priors must be setup for
these groups (and/or strata). These empty group (and/or strata)
levels are then allowed in subsequent evaluations. This enables the
evaluation of the hierarchical model in terms of representing a
prior for future groups.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## run single-agent analysis which defines blrmfit model object example_model("single_agent", silent = TRUE) ## obtain posterior of linear prediction on 0-1 scale post_prob_dlt <- posterior_linpred(blrmfit, TRUE, newdata = hist_SA) ## name columns to obtain nice bayesplot labels colnames(post_prob_dlt) <- hist_SA$drug_A library(bayesplot) library(ggplot2) mcmc_intervals(post_prob_dlt, prob = 0.5, prob_outer = 0.95) + coord_flip() + vline_at(c(0.16, 0.33), linetype = 2) + ylab("Dose [mg]") + ggtitle("Posterior Probability of a DLT") + scale_x_continuous(breaks = c(0.1, 0.16, 0.33, 0.5, 0.75)) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## run single-agent analysis which defines blrmfit model object example_model("single_agent", silent = TRUE) ## obtain posterior of linear prediction on 0-1 scale post_prob_dlt <- posterior_linpred(blrmfit, TRUE, newdata = hist_SA) ## name columns to obtain nice bayesplot labels colnames(post_prob_dlt) <- hist_SA$drug_A library(bayesplot) library(ggplot2) mcmc_intervals(post_prob_dlt, prob = 0.5, prob_outer = 0.95) + coord_flip() + vline_at(c(0.16, 0.33), linetype = 2) + ylab("Dose [mg]") + ggtitle("Posterior Probability of a DLT") + scale_x_continuous(breaks = c(0.1, 0.16, 0.33, 0.5, 0.75)) ## Recover user set sampling defaults options(.user_mc_options)
Simulation of the predictive distribution.
## S3 method for class 'blrmfit' posterior_predict(object, newdata, draws, ...)
## S3 method for class 'blrmfit' posterior_predict(object, newdata, draws, ...)
object |
fitted model object |
newdata |
optional data frame specifying for what to predict;
if missing, then the data of the input model |
draws |
number of returned posterior draws; by default the entire posterior is returned |
... |
not used in this function |
Simulates the posterior predictive of the model object
for
the specified data set.
Matrix of dimensions draws
by nrow(newdata)
where row correspond to a draw of the posterior and each
column corresponds to a row in newdata
. The columns are
labelled with the row.names
of newdata
.
The groups and strata as defined when running the blrm_exnex
analysis cannot be changed at a later stage. As a result no
evaluations can be performed for groups which have not been present
in the data set used for running the analysis. However, it is
admissible to code the group (and/or stratum) column as a
factor
which contains empty levels. These groups are thus
not contained in the fitting data set and they are assigned by
default to the first stratum. In addition priors must be setup for
these groups (and/or strata). These empty group (and/or strata)
levels are then allowed in subsequent evaluations. This enables the
evaluation of the hierarchical model in terms of representing a
prior for future groups.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) post_pred <- posterior_predict(blrmfit) ## turn DLT counts into DLT rates post_pred_rate <- sweep(post_pred, 2, hist_SA$num_patients, "/") library(bayesplot) library(ggplot2) ## compare posterior predictive of the model for the response rates ## with observed data with( hist_SA, ppc_intervals(num_toxicities / num_patients, post_pred_rate, x = drug_A, prob_outer = 0.95) ) + xlab("Dose [mg]") ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) post_pred <- posterior_predict(blrmfit) ## turn DLT counts into DLT rates post_pred_rate <- sweep(post_pred, 2, hist_SA$num_patients, "/") library(bayesplot) library(ggplot2) ## compare posterior predictive of the model for the response rates ## with observed data with( hist_SA, ppc_intervals(num_toxicities / num_patients, post_pred_rate, x = drug_A, prob_outer = 0.95) ) + xlab("Dose [mg]") ## Recover user set sampling defaults options(.user_mc_options)
Posterior predictive intervals of the model.
## S3 method for class 'blrmfit' predictive_interval(object, prob = 0.95, newdata, ...)
## S3 method for class 'blrmfit' predictive_interval(object, prob = 0.95, newdata, ...)
object |
fitted model object |
prob |
central probability mass to report, i.e. the quantiles 0.5-prob/2 and 0.5+prob/2 are displayed. Multiple central widths can be specified. |
newdata |
optional data frame specifying for what to predict;
if missing, then the data of the input model |
... |
not used in this function |
Reports for each row of the input data set the predictive interval according to the fitted model.
Matrix with as many rows as the input data set and two
columns which contain the lower and upper quantile
corresponding to the central probability mass prob
for
the number of responses of the predictive distribution.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) predictive_interval(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) predictive_interval(blrmfit) ## Recover user set sampling defaults options(.user_mc_options)
Extracts a summary of the prior in a structured data format.
## S3 method for class 'blrmfit' prior_summary(object, digits = 2, ...)
## S3 method for class 'blrmfit' prior_summary(object, digits = 2, ...)
object |
|
digits |
number of digits to show |
... |
ignored by the function |
The summary of the prior creates a structured
representation of the specified prior from a
blrm_exnex
(blrm_trial
) analysis.
Returns an analysis specific list, which has it's own
print
function. The returned list contains arrays which
represent the prior in a structured format.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## run combo2 analysis which defines blrmfit model object example_model("combo2", silent = TRUE) prior_summary(blrmfit) prior_sum <- prior_summary(blrmfit) names(prior_sum) ## the entries of the prior list are labelled arrays dimnames(prior_sum$EX_mu_log_beta) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) ## run combo2 analysis which defines blrmfit model object example_model("combo2", silent = TRUE) prior_summary(blrmfit) prior_sum <- prior_summary(blrmfit) names(prior_sum) ## the entries of the prior list are labelled arrays dimnames(prior_sum$EX_mu_log_beta) ## Recover user set sampling defaults options(.user_mc_options)
Provides model summaries for blrm_trial
analyses.
## S3 method for class 'blrm_trial' summary( object, summarize = c("blrmfit", "blrm_exnex_call", "data", "drug_info", "dose_info", "dose_prediction", "data_prediction", "newdata_prediction", "dimensionality", "interval_prob", "interval_max_mass", "ewoc_check"), ... )
## S3 method for class 'blrm_trial' summary( object, summarize = c("blrmfit", "blrm_exnex_call", "data", "drug_info", "dose_info", "dose_prediction", "data_prediction", "newdata_prediction", "dimensionality", "interval_prob", "interval_max_mass", "ewoc_check"), ... )
object |
|
summarize |
one of the following options:
|
... |
further arguments for |
The ewoc_check
summary routine allows to assess the
accuracy and reliability of the ewoc criterion with respect to
MCMC sampling noise. The returned summary provides detailled
MCMC convergence and precision estimates for all criteria
defined by interval_prob
and interval_max_mass
which contribute to EWOC metric. That is, for each interval
probability with a maximal mass of less than unity the routine
will return these columns:
est
the MCMC estimate defining the critical value. For intervals defined by a tail probability this corresponds to the respective critical quantile while for interval probabilites this is equal to the interval probability.
stat
centered and standardized test quantity. The estimate is centered by the critical value and scaled by the Monte-Carlo standard error (MCSE) of the estimate. Hence, negative (positive) values correspond to the constraint being (not) fulfilled. The standardization with the MCSE allows to compare the values to standard normal quantiles accordingly.
mcse
the Monte-Carlo standard error of the estimate determined with mcse_quantile
(tail probability) or mcse_mean
(interval probability) functions.
ess
the Monte-Carlo effective sample size of the estimate determined with ess_quantile
(tail probability) or ess_mean
(interval probability) functions.
rhat
the Monte-Carlo non-convergence diagnostic Rhat as determined with the rhat function
.
For the common case of requiring that 33\
exceeded by more than 25\
estimate column est
contains the 75\
and the standardized statistic
stat
is
defined as:
The statistic is approximately distributed as a standard normal
variate. The ewoc_check
summary can be used to ensure that
the MCMC estimation accuracy is sufficient.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # construct initial blrm_trial object from built-in example datasets combo2_trial_setup <- blrm_trial( data = hist_combo2, dose_info = dose_info_combo2, drug_info = drug_info_combo2, simplified_prior = TRUE ) # extract blrm_call to see setup of the prior as passed to blrm_exnex summary(combo2_trial_setup, "blrm_exnex_call") # extract ewoc precision accuracy ec <- summary(combo2_trial_setup, "ewoc_check") # find any ewoc metrics which are within 95% MCMC error of the threshold # these are counted as "imprecise" when printing blrm_trial objects subset(ec, abs(prob_overdose_stat) < qnorm(0.975)) # ensure that the ewoc metric only flags "ok" whenever the MCMC error # is with 95% below the threshold ewoc_ok <- ec$prob_overdose_stat < qnorm(0.025) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # construct initial blrm_trial object from built-in example datasets combo2_trial_setup <- blrm_trial( data = hist_combo2, dose_info = dose_info_combo2, drug_info = drug_info_combo2, simplified_prior = TRUE ) # extract blrm_call to see setup of the prior as passed to blrm_exnex summary(combo2_trial_setup, "blrm_exnex_call") # extract ewoc precision accuracy ec <- summary(combo2_trial_setup, "ewoc_check") # find any ewoc metrics which are within 95% MCMC error of the threshold # these are counted as "imprecise" when printing blrm_trial objects subset(ec, abs(prob_overdose_stat) < qnorm(0.975)) # ensure that the ewoc metric only flags "ok" whenever the MCMC error # is with 95% below the threshold ewoc_ok <- ec$prob_overdose_stat < qnorm(0.025) ## Recover user set sampling defaults options(.user_mc_options)
Provides model summaries for blrm_exnex
and
blrm_trial
analyses.
## S3 method for class 'blrmfit' summary( object, newdata, transform = !predictive, prob = 0.95, interval_prob, predictive = FALSE, ... )
## S3 method for class 'blrmfit' summary( object, newdata, transform = !predictive, prob = 0.95, interval_prob, predictive = FALSE, ... )
object |
fitted model object |
newdata |
optional data frame specifying for what to predict;
if missing, then the data of the input model |
transform |
logical (defaults to |
prob |
central probability mass to report, i.e. the quantiles 0.5-prob/2 and 0.5+prob/2 are displayed. Multiple central widths can be specified. |
interval_prob |
optional vector of sorted quantiles for which the interval probabilities are calculated |
predictive |
logical indicates if the posterior predictive is
being summarized. Defaults to |
... |
not used in this function |
The calculated posterior summaries are returned as a
data.frame
and contain optional interval probabilites for
the specified vector of sorted quantiles. These summaries are
calculated on the response scale by default and can be obtained on
the link scale when setting transform=FALSE
.
When the results are requested for the predictive distribution with
predictive=TRUE
, then the link scale refers to the total
counts while the transformed scale divides the (predictive) counts
by the number of trials such that results are on the 0-1 scale.
Returns a data.frame
of the key summaries of the
posterior mean, standard deviation, central probability
interval, median and optional interval probabilities. Each row
of the data.frame
corresponds to the respective input
data which is by default the same data set as used for the
blrm_exnex
analysis or the data specified in the
newdata
argument.
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) ## obtain underdosing (0-0.16], target dosing (0.16-0.33] and ## overdosing (0.33-1] probabilities summary(blrmfit, interval_prob = c(0, 0.16, 0.33, 1)) ## obtain predictive distribution for respective cohorts and ## calculate probability for no event, 1 event or >1 event ## note that this does the calculation for the cohort sizes ## as put into the data-set summary(blrmfit, interval_prob = c(-1, 0, 1, 10), predictive = TRUE) ## to obtain the predictive for a cohort-size of 6 for all patients ## in the data-set one would need to use the newdata argument, e.g. summary(blrmfit, newdata = transform(hist_SA, num_patients = 6), interval_prob = c(-1, 0, 1, 10), predictive = TRUE ) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) ## obtain underdosing (0-0.16], target dosing (0.16-0.33] and ## overdosing (0.33-1] probabilities summary(blrmfit, interval_prob = c(0, 0.16, 0.33, 1)) ## obtain predictive distribution for respective cohorts and ## calculate probability for no event, 1 event or >1 event ## note that this does the calculation for the cohort sizes ## as put into the data-set summary(blrmfit, interval_prob = c(-1, 0, 1, 10), predictive = TRUE) ## to obtain the predictive for a cohort-size of 6 for all patients ## in the data-set one would need to use the newdata argument, e.g. summary(blrmfit, newdata = transform(hist_SA, num_patients = 6), interval_prob = c(-1, 0, 1, 10), predictive = TRUE ) ## Recover user set sampling defaults options(.user_mc_options)
Adds data rows to a blrm_trial
object (add_data argument)
Replaces data of a blrm_trial
object (data argument)
Sets the prior of a blrm_trial
object (... argument will be
passed to blrm_exnex)
## S3 method for class 'blrm_trial' update(object, ...)
## S3 method for class 'blrm_trial' update(object, ...)
object |
blrm_trial object |
... |
passed to default |
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # the combo2_trial example demonstrates the use of add_data of # update.blrmfit example_model("combo2_trial") ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) # the combo2_trial example demonstrates the use of add_data of # update.blrmfit example_model("combo2_trial") ## Recover user set sampling defaults options(.user_mc_options)
Adds data rows to a blrm_exnex
or
blrm_trial
analysis object.
## S3 method for class 'blrmfit' update(object, ..., add_data)
## S3 method for class 'blrmfit' update(object, ..., add_data)
object |
blrmfit analysis object |
... |
passed to default The data in Note that the |
add_data |
additional data added to analysis data of |
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) library(tibble) new_cohort <- tibble(group_id = "trial_A", drug_A = 50, num_patients = 4, num_toxicities = 1) ## this would fail, since add_data argument must be named ## new_blrmfit <- update(blrmfit, new_cohort) new_blrmfit <- update(blrmfit, add_data = new_cohort) ## Recover user set sampling defaults options(.user_mc_options)
## Setting up dummy sampling for fast execution of example ## Please use 4 chains and 100x more warmup & iter in practice .user_mc_options <- options( OncoBayes2.MC.warmup = 10, OncoBayes2.MC.iter = 20, OncoBayes2.MC.chains = 1, OncoBayes2.MC.save_warmup = FALSE ) example_model("single_agent", silent = TRUE) library(tibble) new_cohort <- tibble(group_id = "trial_A", drug_A = 50, num_patients = 4, num_toxicities = 1) ## this would fail, since add_data argument must be named ## new_blrmfit <- update(blrmfit, new_cohort) new_blrmfit <- update(blrmfit, add_data = new_cohort) ## Recover user set sampling defaults options(.user_mc_options)