Skip to content

Commit

Permalink
Merge pull request #22 from Boehringer-Ingelheim/update-analysis-vign…
Browse files Browse the repository at this point in the history
…ette

Update analysis vignette
  • Loading branch information
Xyarz authored Jul 30, 2024
2 parents 500a67d + 5e4bf58 commit f0d3524
Show file tree
Hide file tree
Showing 7 changed files with 3,351 additions and 340 deletions.
8 changes: 7 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Authors@R: c(
person("Lars", "Andersen", , "[email protected]", role = "aut"),
person("Sebastian", "Bossert", , "[email protected]", role = "aut"),
person("Steven", "Brooks", , "[email protected]", role = "ctb"),
person("Jonas", "Schick", , "[email protected]", role = "ctb")
person("Jonas", "Schick", , "[email protected]", role = "ctb"),
person("Gina", "Kleibrink", , "[email protected]", role = "ctb")
)
Description: Bayesian MCPMod (Fleischer et al. (2022)
<doi:10.1002/pst.2193>) is an innovative method that improves the
Expand Down Expand Up @@ -46,6 +47,11 @@ Suggests:
dplyr,
knitr,
rmarkdown,
MCPModPack,
data.table,
doFuture,
doRNG,
kableExtra,
spelling,
testthat (>= 3.0.0)
VignetteBuilder: quarto
Expand Down
44 changes: 21 additions & 23 deletions R/s3methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,37 @@ print.BayesianMCPMod <- function (

#' @export
print.BayesianMCP <- function(x, ...) {
cat("Bayesian Multiple Comparison Procedure\n\n")

cat("Summary:\n")
cat(" Sign:", x[1, "sign"], "\n")
cat(" Critical Probability:", x[1, "crit_prob_adj"], "\n")
cat(" Maximum Posterior Probability:", x[1, "max_post_prob"], "\n\n")
#cat("Bayesian Multiple Comparison Procedure\n\n")
n_sim <- nrow(x)
cat("Effective Sample Size (ESS) per Dose Group:\n")
print(attr(x, "ess_avg"), row.names = FALSE)
cat("\n")

cat("Posterior Probabilities for Model Shapes:\n")
model_probs <- x[1, grep("^post_probs\\.", colnames(x))]
model_names <- gsub("post_probs\\.", "", names(model_probs))
model_df <- data.frame(Model = model_names, Probability = unlist(model_probs))
print(model_df, row.names = FALSE)

#cat("Effective Sample Size (ESS) per Dose Group:\n")
#print(attr(x, "ess_avg"), row.names = FALSE)
#cat("\n")
cat("Bayesian Multiple Comparison Procedure\n")

if (n_sim == 1L) {

cat("Summary:\n")
cat(" Sign:", x[1, "sign"], "\n")
cat(" Critical Probability:", x[1, "crit_prob_adj"], "\n")
cat(" Maximum Posterior Probability:", x[1, "max_post_prob"], "\n\n")

attr(x, "critProbAdj") <- NULL
attr(x, "successRate") <- NULL
class(x) <- NULL
cat("Posterior Probabilities for Model Shapes:\n")
model_probs <- x[1, grep("^post_probs\\.", colnames(x))]
model_names <- gsub("post_probs\\.", "", names(model_probs))
model_df <- data.frame(Model = model_names, Probability = unlist(model_probs))
print(model_df, row.names = FALSE)

# print.default(x, ...)

print.default(x, ...)
if (any(!is.na(attr(x, "essAvg")))) {

# if (any(!is.na(attr(x, "essAvg")))) {
#
# cat("Average Posterior ESS\n")
# print(attr(x, "essAvg"), ...)
#
# }
cat("Average Posterior ESS\n")
print(attr(x, "essAvg"), ...)

}

} else {

Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ articles:
navbar: ~
contents:
- analysis_normal
- analysis_normal_noninformative
- Simulation_Example
- Comparison_vignette
Loading

0 comments on commit f0d3524

Please sign in to comment.