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.
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))
#> doses models 2.5% 50% 97.5%
#> 1 0 exponential 0.21294574 1.469906 2.901673
#> 2 6 exponential 4.85969091 5.537853 7.140552
#> 3 8 exponential 5.89278063 7.630167 9.079677
#> 4 0 linear -0.05792699 1.237644 2.671199
#> 5 6 linear 5.08611032 5.819201 7.410529
#> 6 8 linear 6.02743520 7.634307 9.098889
#> 7 0 avgFit -0.05792699 1.237644 2.671199
#> 8 6 avgFit 5.08611032 5.819201 7.410529
#> 9 8 avgFit 6.02743520 7.634307 9.098889