Package 'BayesianMCPMod'

Title: Simulate, Evaluate, and Analyze Dose Finding Trials with Bayesian MCPMod
Description: Bayesian MCPMod (Fleischer et al. (2022) <doi:10.1002/pst.2193>) is an innovative method that improves the traditional MCPMod by systematically incorporating historical data, such as previous placebo group data. This R package offers functions for simulating, analyzing, and evaluating Bayesian MCPMod trials with normally distributed endpoints. It enables the assessment of trial designs incorporating historical data across various true dose-response relationships and sample sizes. Robust mixture prior distributions, such as those derived with the Meta-Analytic-Predictive approach (Schmidli et al. (2014) <doi:10.1111/biom.12242>), can be specified for each dose group. Resulting mixture posterior distributions are used in the Bayesian Multiple Comparison Procedure and modeling steps. The modeling step also includes a weighted model averaging approach (Pinheiro et al. (2014) <doi:10.1002/sim.6052>). Estimated dose-response relationships can be bootstrapped and visualized.
Authors: Boehringer Ingelheim Pharma GmbH & Co. KG [cph, fnd], Stephan Wojciekowski [aut, cre], Lars Andersen [aut], Sebastian Bossert [aut], Steven Brooks [ctb], Jonas Schick [ctb], Gina Kleibrink [ctb]
Maintainer: Stephan Wojciekowski <[email protected]>
License: Apache License (>= 2)
Version: 1.0.2
Built: 2024-10-29 05:55:21 UTC
Source: https://github.com/boehringer-ingelheim/bayesianmcpmod

Help Index


assessDesign .

Description

This function performs simulation based trial design evaluations for a set of specified dose-response models

Usage

assessDesign(
  n_patients,
  mods,
  prior_list,
  sd,
  n_sim = 1000,
  alpha_crit_val = 0.05,
  simple = TRUE,
  reestimate = FALSE,
  contr = NULL,
  dr_means = NULL
)

Arguments

n_patients

Vector specifying the planned number of patients per dose group

mods

An object of class "Mods" as specified in the DoseFinding package.

prior_list

A prior_list object specifying the utilized prior for the different dose groups

sd

A positive value, specification of assumed sd

n_sim

Number of simulations to be performed

alpha_crit_val

(Un-adjusted) Critical value to be used for the MCP testing step. Passed to the getCritProb() function for the calculation of adjusted critical values (on the probability scale). Default is 0.05.

simple

Boolean variable defining whether simplified fit will be applied. Passed to the getModelFits function. Default FALSE.

reestimate

Boolean variable defining whether critical value should be calculated with re-estimated contrasts (see getCritProb function for more details). Default FALSE

contr

An object of class 'optContr' as created by the getContr() function. Allows specification of a fixed contrasts matrix. Default NULL

dr_means

A vector, allows specification of individual (not model based) assumed effects per dose group. Default NULL

Value

Returns success probabilities for the different assumed dose-response shapes, attributes also includes information around average success rate (across all assumed models) and prior Effective sample size

Examples

if (interactive()) { # takes typically > 5 seconds

mods <- DoseFinding::Mods(linear      = NULL,
                          linlog      = NULL,
                          emax        = c(0.5, 1.2),
                          exponential = 2,
                          doses       = c(0, 0.5, 2,4, 8),
                          maxEff      = 6)
sd <- 12
prior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 12), sigma = 2),
                   DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 1, s = 12), sigma = 2),
                   DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.2, s = 11), sigma = 2) ,
                   DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.3, s = 11), sigma = 2) ,
                   DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 2, s = 13), sigma = 2))
n_patients <- c(40, 60, 60, 60, 60)

success_probabilities <- assessDesign(
  n_patients  = n_patients,
  mods        = mods,
  prior_list  = prior_list,
  sd          = sd,
  n_sim       = 1e2) # speed up exammple run time

success_probabilities

}

getBootstrapQuantiles

Description

A function for the calculation of bootstrapped model predictions. Samples from the posterior distribution are drawn (via the RBesT function rmix()) and for every sample the simplified fitting step (see getModelFits() function) and a prediction is performed. These fits are then used to identify the specified quantiles. This approach can be considered as the Bayesian equivalent of the frequentist bootstrap approach described in O'Quigley et al. (2017). Instead of drawing n bootstrap samples from the sampling distribution of the trial dose-response estimates, here the samples are directly taken from the posterior distribution.

Usage

getBootstrapQuantiles(
  model_fits,
  quantiles,
  n_samples = 1000,
  doses = NULL,
  avg_fit = TRUE
)

Arguments

model_fits

An object of class modelFits, i.e. information about fitted models & corresponding model coefficients as well as the posterior distribution that was the basis for the model fitting

quantiles

A vector of quantiles that should be evaluated

n_samples

Number of samples that should be drawn as basis for the bootstrapped quantiles

doses

A vector of doses for which a prediction should be performed

avg_fit

Boolean variable, defining whether an average fit (based on generalized AIC weights) should be performed in addition to the individual models. Default TRUE.

Value

A data frame with columns for model, dose, and bootstrapped samples

References

O'Quigley J, Iasonos A, Bornkamp B. 2017. Handbook of Methods for Designing, Monitoring, and Analyzing Dose-Finding Trials (1st ed.). Chapman and Hall/CRC. doi:10.1201/9781315151984

Examples

posterior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 1), sigma = 2),
                       DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 3, s = 1.2), sigma = 2),
                       DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 4, s = 1.5), sigma = 2) ,
                       DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 6, s = 1.2), sigma = 2) ,
                       DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 6.5, s = 1.1), sigma = 2))
models         <- c("exponential", "linear")
dose_levels    <- c(0, 1, 2, 4, 8)
fit            <- getModelFits(models      = models,
                               posterior   = posterior_list,
                               dose_levels = dose_levels,
                               simple      = TRUE)

getBootstrapQuantiles(model_fits = fit,
                    quantiles  = c(0.025, 0.5, 0.975),
                    n_samples  = 10, # speeding up example run time
                    doses      = c(0, 6, 8))

getContr

Description

This function calculates contrast vectors that are optimal for detecting certain alternatives via applying the function optContr() of the DoseFinding package. Hereby 4 different options can be distinguished that are automatically executed based on the input that is provided

  1. Bayesian approach: If dose_weights and a prior_list are provided an optimized contrasts for the posterior sample size is calculated. In detail, in a first step the dose_weights (typically the number of patients per dose group) and the prior information is combined by calculating for each dose group a posterior effective sample. Based on this posterior effective sample sizes the allocation ratio is derived, which allows for a calculation on pseudo-optimal contrasts via regular MCPMod are calculated from the regular MCPMod for these specific weights

  2. Frequentist approach: If only dose_weights are provided optimal contrast vectors are calculated from the regular MCPMod for these specific weights

  3. Bayesian approach + re-estimation: If only a sd_posterior (i.e. variability of the posterior distribution) is provided, pseudo-optimal contrasts based on these posterior weights will be calculated

  4. Frequentist approach+re-estimation:If only a se_new_trial (i.e. the estimated variability per dose group of a new trial) is provided, optimal contrast vectors are calculated from the regular MCPMod for this specific vector of standard errors. For the actual evaluation this vector of standard errors is translated into a (diagonal) matrix of variances

Usage

getContr(
  mods,
  dose_levels,
  dose_weights = NULL,
  prior_list = NULL,
  sd_posterior = NULL,
  se_new_trial = NULL
)

Arguments

mods

An object of class 'Mods' as created by the function 'DoseFinding::Mods()'

dose_levels

Vector containing the different dosage levels.

dose_weights

Vector specifying weights for the different doses. Please note that in case this information is provided together with a prior (i.e. Option 1) is planned these two inputs should be provided on the same scale (e.g. patient numbers). Default NULL

prior_list

A list of objects of class 'normMix' as created with 'RBesT::mixnorm()'. Only required as input for Option 1. Default NULL

sd_posterior

A vector of positive values with information about the variability of the posterior distribution, only required for Option 3. Default NULL

se_new_trial

A vector of positive values with information about the observed variability, only required for Option 4. Default NULL

Value

An object of class 'optContr' as provided by the function 'DoseFinding::optContr()'.

Examples

dose_levels  <- c(0, 0.5, 2, 4, 8)
mods <- DoseFinding::Mods(
  linear      = NULL,
  linlog      = NULL,
  emax        = c(0.5, 1.2),
  exponential = 2,
  doses       = dose_levels,
  maxEff      = 6)
sd_posterior <- c(2.8, 3, 2.5, 3.5, 4)

contr_mat <- getContr(
  mods         = mods,
  dose_levels  = dose_levels,
  sd_posterior = sd_posterior)

getCritProb

Description

This function calculates multiplicity adjusted critical values. The critical values are calculated in such a way that when using non-informative priors the actual error level for falsely declaring a significant trial in the Bayesian MCPMod is controlled (by the specified alpha level). Hereby optimal contrasts of the frequentist MCPMod are applied and two options can be distinguished

  1. Frequentist approach: If only dose_weights are provided optimal contrast vectors are calculated from the regular MCPMod for these specific weights and the corresponding critical value for this set of contrasts is calculated via the critVal() function of the DoseFinding package.

  2. Frequentist approach + re-estimation: If only a se_new_trial (i.e. the estimated variability per dose group of a new trial) is provided, optimal contrast vectors are calculated from the regular MCPMod for this specific vector of standard errors. Here as well the critical value for this set of contrasts is calculated via the critVal() function of the DoseFinding package.

Usage

getCritProb(
  mods,
  dose_levels,
  dose_weights = NULL,
  se_new_trial = NULL,
  alpha_crit_val = 0.025
)

Arguments

mods

An object of class "Mods" as specified in the DoseFinding package.

dose_levels

Vector containing the different dosage levels.

dose_weights

Vector specifying weights for the different doses, only required for Option i). Default NULL

se_new_trial

A vector of positive values, only required for Option ii). Default NULL

alpha_crit_val

Significance level. Default set to 0.025.

Value

Multiplicity adjusted critical value on the probability scale.

Examples

mods <- DoseFinding::Mods(linear      = NULL,
                          linlog      = NULL,
                          emax        = c(0.5, 1.2),
                          exponential = 2,
                          doses       = c(0, 0.5, 2,4, 8))
dose_levels <- c(0, 0.5, 2, 4, 8)
critVal <- getCritProb(
  mods           = mods,
  dose_weights   = c(50,50,50,50,50), #reflecting the planned sample size
  dose_levels    = dose_levels,
  alpha_crit_val = 0.05)

getESS

Description

This function calculates the effective sample size for every dose group via the RBesT function ess().

Usage

getESS(post_list)

Arguments

post_list

A posterior list object, for which the effective sample size for each dose group should be calculated

Value

A vector of the effective sample sizes for each dose group


getModelFits

Description

Fits dose-response curves for the specified dose-response models, based on the posterior distributions. For the simplified fit, multivariate normal distributions will be approximated and reduced by one-dimensional normal distributions. For the default case, the Nelder-Mead algorithm is used. In detail, for both approaches the mean vector θY\theta^{Y} and the covariance Σ\Sigma of the (mixture) posterior distributions and the corresponding posterior weights ω~l\tilde{\omega}_{l} for l1,...,Ll \in {1,...,L} are used as basis For the full fit a GLS estimator is used to minimize the following expression for the respective dose-response models mm

θ^m=argminθml=1Lω~l(θliYf(dosei,θ^m))Σl1(θliYf(dosei,θ^m))\hat{\theta}_{m}=argmin_{\theta_{m}} \sum_{l=1}^{L} \tilde{\omega}_{l}(\theta_{l_{i}}^{Y}-f(dose_{i},\hat{\theta}_{m}))'\Sigma_{l}^{-1}(\theta_{l_{i}}^{Y}-f(dose_{i},\hat{\theta}_{m}))

Therefore the function nloptr of the nloptr package is utilized. In the simplified case L=1L=1, as the dimension of the posterior is reduced to 1 first. The generalized AIC values are calculated via the formula

gAICm=l=1Lω~li=0K1Σli,i(θliYf(dosei,θ^m))2+2pgAIC_{m} = \sum_{l=1}^{L} \tilde{\omega}_{l} \sum_{i=0}^{K} \frac{1}{\Sigma_{l_{i,i}}} (\theta_{l_i}^Y - f(dose_{i},\hat{\theta}_{m}))^2 + 2p

where pp denotes the number of estimated parameters and KK the number of active dose levels. Here as well for the simplified case the formula reduces to one summand as L=1L=1. Corresponding gAIC based weights for model MM are calculated as outlined in Schorning et al. (2016)

ΩI(M)=exp(0.5gAICM)m=1Qexp(0.5gAICm)\Omega_I (M) = \frac{\exp(-0.5 gAIC_{M})}{\sum_{m=1}^{Q} \exp(-0.5 gAIC_{m})}

where QQ denotes the number of models included in the averaging procedure.

Usage

getModelFits(models, dose_levels, posterior, simple = FALSE)

Arguments

models

List of model names for which a fit will be performed.

dose_levels

A vector containing the different dosage levels.

posterior

A getPosterior object, containing the (multivariate) posterior distribution per dosage level.

simple

Boolean variable, defining whether simplified fit will be applied. Default FALSE.

Value

An object of class modelFits. A list containing information about the fitted model coefficients, the prediction per dose group as well as maximum effect and generalized AIC (and corresponding weight) per model.

References

Schorning K, Bornkamp B, Bretz F, Dette H. 2016. Model selection versus model averaging in dose finding studies. Stat Med; 35; 4021-4040.

Examples

posterior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 1), sigma = 2),
                       DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 3, s = 1.2), sigma = 2),
                       DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 4, s = 1.5), sigma = 2) ,
                       DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 6, s = 1.2), sigma = 2) ,
                       DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 6.5, s = 1.1), sigma = 2))
models         <- c("emax", "exponential", "sigEmax", "linear")
dose_levels    <- c(0, 1, 2, 4, 8)

fit        <- getModelFits(models      = models,
                           posterior   = posterior_list,
                           dose_levels = dose_levels)
fit_simple <- getModelFits(models      = models,
                           posterior   = posterior_list,
                           dose_levels = dose_levels,
                           simple      = TRUE)

getPosterior

Description

Either the patient level data or both mu_hat as well as S_hat must to be provided. If patient level data is provided mu_hat and S_hat are calculated within the function using a linear model. This function calculates the posterior distribution. Depending on the input for S_hat this step is either performed for every dose group independently via the RBesT function postmix() or the mvpostmix() function of the DoseFinding package is utilized. In the latter case conjugate posterior mixture of multivariate normals are calculated (DeGroot 1970, Bernardo and Smith 1994)

Usage

getPosterior(
  prior_list,
  data = NULL,
  mu_hat = NULL,
  S_hat = NULL,
  calc_ess = FALSE
)

Arguments

prior_list

a prior list with information about the prior to be used for every dose group

data

dataframe containing the information of dose and response. Default NULL Also a simulateData object can be provided.

mu_hat

vector of estimated mean values (per dose group).

S_hat

Either a vector or a covariance matrix specifying the (estimated) variability can be specified. The length of the vector (resp. the dimension of the matrix) needs to match the number of dose groups. Please note that for a vector input the numbers should reflect the standard error per dose group (i.e. square root of variance), while for a matrix input the variance-covariance matrix should be provided.

calc_ess

boolean variable, indicating whether effective sample size should be calculated. Default FALSE

Value

posterior_list, a posterior list object is returned with information about (mixture) posterior distribution per dose group (more detailed information about the conjugate posterior in case of covariance input for S_hat is provided in the attributes)

References

BERNARDO, Jl. M., and Smith, AFM (1994). Bayesian Theory. 81.

Examples

prior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 5), sigma = 2),
                   DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 1, s = 12), sigma = 2),
                   DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.2, s = 11), sigma = 2) ,
                   DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.3, s = 11), sigma = 2) ,
                   DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 2, s = 13), sigma = 2))
mu <- c(0, 1, 1.5, 2, 2.5)
S_hat <- c(5, 4, 6, 7, 8)

posterior_list <- getPosterior(
   prior_list = prior_list,
   mu_hat     = mu,
   S_hat     = S_hat)

summary(posterior_list)

performBayesianMCP

Description

Performs Bayesian MCP Test step, as described in Fleischer et al. (2022). Tests for a dose-response effect using a model-based multiple contrast test based on the (provided) posterior distribution. In particular for every dose-response candidate the posterior probability is calculated that the contrast is bigger than 0 (based on the posterior distribution of the dose groups). In order to obtain significant test decision we consider the maximum of the posterior probabilities across the different models. This maximum is compared with a (multiplicity adjusted) critical value (on the probability scale).

Usage

performBayesianMCP(posterior_list, contr, crit_prob_adj)

Arguments

posterior_list

An object derived with getPosterior with information about the (mixture) posterior distribution per dose group

contr

An object of class 'optContr' as created by the getContr() function. It contains the contrast matrix to be used for the testing step.

crit_prob_adj

A getCritProb object, specifying the critical value to be used for the testing (on the probability scale)

Value

Bayesian MCP test result, with information about p-values for the individual dose-response shapes and overall significance

References

Fleischer F, Bossert S, Deng Q, Loley C, Gierse J. 2022. Bayesian MCPMod. Pharmaceutical Statistics. 21(3): 654-670. doi:10.1002/pst.2193

Examples

mods <- DoseFinding::Mods(linear      = NULL,
                          linlog      = NULL,
                          emax        = c(0.5, 1.2),
                          exponential = 2,
                          doses       = c(0, 0.5, 2,4, 8))
dose_levels  <- c(0, 0.5, 2, 4, 8)
sd_posterior <- c(2.8,3,2.5,3.5,4)
contr_mat <- getContr(
  mods         = mods,
  dose_levels  = dose_levels,
  sd_posterior = sd_posterior)
critVal <- getCritProb(
  mods           = mods,
  dose_weights   = c(50, 50, 50, 50, 50), #reflecting the planned sample size
  dose_levels    = dose_levels,
  alpha_crit_val = 0.05)
prior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 5), sigma = 2),
                   DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 1, s = 12), sigma = 2),
                   DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.2, s = 11), sigma = 2) ,
                   DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.3, s = 11), sigma = 2) ,
                   DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 2, s = 13), sigma = 2))
mu <- c(0, 1, 1.5, 2, 2.5)
S_hat <- c(5, 4, 6, 7, 8)
posterior_list <- getPosterior(
  prior_list = prior_list,
  mu_hat     = mu,
  S_hat     = S_hat)

performBayesianMCP(posterior_list = posterior_list,
                   contr          = contr_mat,
                   crit_prob_adj  = critVal)

performBayesianMCPMod

Description

Performs Bayesian MCP Test step and modeling in a combined fashion. See performBayesianMCP() function for MCP Test step and getModelFits() for the modeling step

Usage

performBayesianMCPMod(posterior_list, contr, crit_prob_adj, simple = FALSE)

Arguments

posterior_list

An object of class 'postList' as created by getPosterior() containing information about the (mixture) posterior distribution per dose group

contr

An object of class 'optContr' as created by the getContr() function. It contains the contrast matrix to be used for the testing step.

crit_prob_adj

A getCritProb object, specifying the critical value to be used for the testing (on the probability scale).

simple

Boolean variable, defining whether simplified fit will be applied. Passed to the getModelFits() function. Default FALSE.

Value

Bayesian MCP test result as well as modeling result.

Examples

mods <- DoseFinding::Mods(linear      = NULL,
                          linlog      = NULL,
                          emax        = c(0.5, 1.2),
                          exponential = 2,
                          doses       = c(0, 0.5, 2,4, 8))
dose_levels  <- c(0, 0.5, 2, 4, 8)
sd_posterior <- c(2.8, 3, 2.5, 3.5, 4)
contr_mat <- getContr(
  mods         = mods,
  dose_levels  = dose_levels,
  sd_posterior = sd_posterior)
critVal <- getCritProb(
  mods           = mods,
  dose_weights   = c(50, 50, 50, 50, 50), #reflecting the planned sample size
  dose_levels    = dose_levels,
  alpha_crit_val = 0.05)
prior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 5), sigma = 2),
                   DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 1, s = 12), sigma = 2),
                   DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.2, s = 11), sigma = 2) ,
                   DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 1.3, s = 11), sigma = 2) ,
                   DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 2, s = 13), sigma = 2))
mu <- c(0, 1, 1.5, 2, 2.5)
S_hat <- c(5, 4, 6, 7, 8)
posterior_list <- getPosterior(
  prior_list = prior_list,
  mu_hat     = mu,
  S_hat     = S_hat)
performBayesianMCPMod(posterior_list = posterior_list,
                      contr          = contr_mat,
                      crit_prob_adj  = critVal,
                      simple         = FALSE)

plot.modelFits

Description

Plot function based on the ggplot2 package. Providing visualizations for each model and a average Fit. Black lines show the fitted dose response models and an AIC based average model. Dots indicate the posterior median and vertical lines show corresponding credible intervals (i.e. the variability of the posterior distribution of the respective dose group). To assess the uncertainty of the model fit one can in addition visualize credible bands (default coloring as orange shaded areas). The calculation of these bands is performed via the getBootstrapQuantiles() function. The default setting is that these credible bands are not calculated.

Usage

## S3 method for class 'modelFits'
plot(
  x,
  gAIC = TRUE,
  avg_fit = TRUE,
  cr_intv = TRUE,
  alpha_CrI = 0.05,
  cr_bands = FALSE,
  alpha_CrB = c(0.05, 0.5),
  n_bs_smpl = 1000,
  acc_color = "orange",
  ...
)

Arguments

x

An object of type modelFits

gAIC

Logical value indicating whether gAIC values are shown in the plot. Default TRUE

avg_fit

Logical value indicating whether average fit is presented in the plot. Default TRUE

cr_intv

Logical value indicating whether credible intervals are included in the plot. Default TRUE

alpha_CrI

Numerical value of the width of the credible intervals. Default is set to 0.05 (i.e 95% CI are shown).

cr_bands

Logical value indicating whether bootstrapped based credible bands are shown in the plot. Default FALSE

alpha_CrB

Numerical vector of the width of the credible bands. Default is set to 0.05 and 0.5 (i.e 95% CB and median are shown).

n_bs_smpl

Number of bootstrap samples being used. Default set to 1000.

acc_color

Color of the credible bands. Default set to "orange"

...

optional parameter to be passed.

Value

A ggplot2 object

Examples

posterior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 1), sigma = 2),
                       DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 3, s = 1.2), sigma = 2),
                       DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 4, s = 1.5), sigma = 2) ,
                       DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 6, s = 1.2), sigma = 2) ,
                       DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 6.5, s = 1.1), sigma = 2))
models <- c("exponential", "linear")
dose_levels <- c(0, 1, 2, 4, 8)
fit <- getModelFits(models      = models,
                    posterior   = posterior_list,
                    dose_levels = dose_levels,
                    simple      = TRUE)

plot(fit)

predict.modelFits

Description

This function performs model predictions based on the provided model and dose specifications

Usage

## S3 method for class 'modelFits'
predict(object, doses = NULL, ...)

Arguments

object

A modelFits object containing information about the fitted model coefficients

doses

A vector specifying the doses for which a prediction should be done

...

Currently without function

Value

a list with the model predictions for the specified models and doses

Examples

posterior_list <- list(Ctrl = RBesT::mixnorm(comp1 = c(w = 1, m = 0, s = 1), sigma = 2),
                       DG_1 = RBesT::mixnorm(comp1 = c(w = 1, m = 3, s = 1.2), sigma = 2),
                       DG_2 = RBesT::mixnorm(comp1 = c(w = 1, m = 4, s = 1.5), sigma = 2) ,
                       DG_3 = RBesT::mixnorm(comp1 = c(w = 1, m = 6, s = 1.2), sigma = 2) ,
                       DG_4 = RBesT::mixnorm(comp1 = c(w = 1, m = 6.5, s = 1.1), sigma = 2))
models         <- c("emax", "exponential", "sigEmax", "linear")
dose_levels    <- c(0, 1, 2, 4, 8)
fit            <- getModelFits(models      = models,
                               posterior   = posterior_list,
                               dose_levels = dose_levels)

predict(fit, doses = c(0, 1, 3, 4, 6, 8))

simulateData

Description

Function to simulate patient level data for a normally distributed endpoint

Usage

simulateData(
  n_patients,
  dose_levels,
  sd,
  mods,
  n_sim = 1000,
  true_model = NULL,
  dr_means = NULL
)

Arguments

n_patients

Vector containing number of patients as a numerical value per dose-group.

dose_levels

Vector containing the different dosage levels.

sd

Standard deviation on patient level.

mods

An object of class "Mods" as specified in the DoseFinding package.

n_sim

Number of simulations to be performed, Default is 1000

true_model

Default value is NULL. Assumed true underlying model. Provided via a String. e.g. "emax". In case of NULL, all dose-response models, included in the mods input parameter will be used.

dr_means

a vector, with information about assumed effects per dose group. Default NULL.

Value

A list object, containing patient level simulated data for all assumed true models. Also providing information about simulation iteration, patient number as well as dosage levels.

Examples

models <- DoseFinding::Mods(linear      = NULL,
                            linlog      = NULL,
                            emax        = c(0.5, 1.2),
                            exponential = 2, 
                            doses       = c(0, 0.5, 2,4, 8),
                            maxEff      = 6)
dose_levels <- c(0, 0.5, 2,4, 8)
sd          <- 12
n_patients  <- c(40, 60, 60, 60, 60)

sim_data <- simulateData(n_patients  = n_patients,
                         dose_levels = dose_levels,
                         sd          = sd,
                         mods        = models,
                         n_sim       = 100)

sim_data