Skip to content

Commit

Permalink
Additional updates (e.g. to fix bug around print of BayesianMCPMod)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbossert committed Dec 18, 2023
1 parent 1700b38 commit 44ccf9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
19 changes: 10 additions & 9 deletions R/bootstrapping.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#' @title getBootstrapQuantiles
#'
#' @description A function to Calculate credible intervals to assess the uncertainty for the model fit. one can in addition visualize credible intervals (yellow shaded areas, the default is set to 50% and 95%). These credible intervals are calculated as follows.
#' Samples from the posterior distribution are drawn and for every sample the simplified fitting step and a prediction is performed. These fits are then used to identify and visualize the specified quantiles.
#' The bootstrap based quantiles can also directly be calculated and displayed via the gotbootstrapQuantiles function.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.
#' @description A function for the calculation of credible intervals to assess the uncertainty for the model fit.
#' Hereby the credible intervals are calculated as follows.
#' 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, Iasonos, J., and B. Bornkamp. 2017. Handbook of Methods for Designing, Monitoring, and Analyzing Dose-Finding Trials. Boca Raton: CRC Press.
#' 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.
#'
#'
#' @param 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
#' @param quantiles a vector of quantiles that should be evaluated
#' @param n_samples tbd
#' @param doses tbd
#' @param avg_fit tbd
#' @param n_samples number of samples that should be drawn as basis for the
#' @param doses a vector of doses for which a prediction should be performed
#' @param 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.
#'
#' @return tbd
#' @return A data frame with entries doses, models, and quantiles
#' @export
getBootstrapQuantiles <- function (

Expand Down
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @title plot.modelFits
#'
#' @description plot function based on the ggplot2 package. Providing visualizations for each model and a average Fit.
#' More details to be added, as well as references.
#' Black line shows the fitted dose response models and an AIC based average model (black lines). To assess the uncertainty one can in addition visualize credible intervals (yellow shaded areas, the default is set to 50% and 95%). These credible intervals are calculated as follows.
#' @param x an object of type getModelFits
#' @param gAIC logical value indicating whether gAIC values are shown in the plot. Default TRUE
#' @param avg_fit logical value indicating whether average fit is presented in the plot. Default TRUE
Expand Down
8 changes: 4 additions & 4 deletions R/s3methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ print.BayesianMCPMod <- function (
cat("Model Significance Frequencies\n")
print(model_success, ...)

# if (!is.na(attr(x$BayesianMCP, "ess_avg"))) {#Note SB: I have taken this out, as vignettes didn't work
if (any(!is.na(attr(x$BayesianMCP, "ess_avg")))) {

# cat("Average Posterior ESS\n")
# print(attr(x$BayesianMCP, "ess_avg"), ...)
cat("Average Posterior ESS\n")
print(attr(x$BayesianMCP, "ess_avg"), ...)

# }
}

}

Expand Down

0 comments on commit 44ccf9e

Please sign in to comment.