Skip to content

Commit

Permalink
First updates around documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbossert committed Dec 15, 2023
1 parent 24ef42d commit a289dff
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 28 deletions.
21 changes: 13 additions & 8 deletions R/BMCPMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ getContr <- function (

#' @title getCritProb
#'
#' @description This function calculates multiplicity adjusted
#'
#' @param mods An object of class "Mods" as specified in the Dosefinding package.
#' @param dose_levels vector containing the different dosage levels.
#' @param dose_weights Vector specifying weights for the different doses
Expand All @@ -197,15 +199,17 @@ getCritProb <- function (

mods,
dose_levels,
dose_weights,
dose_weights =NULL,
se_new_trial = NULL,
alpha_crit_val = 0.025

) {

contr <- DoseFinding::optContr(
models = mods,
doses = dose_levels,
w = dose_weights)
contr <- getContr(mods = mods,
dose_levels = dose_levels ,
dose_weights = dose_weights,
se_new_trial = se_new_trial,
alpha_crit_val = alpha_crit_val)

crit_prob <- stats::pnorm(DoseFinding::critVal(
corMat = contr$corMat,
Expand Down Expand Up @@ -317,13 +321,14 @@ addSignificance <- function (

#' @title performBayesianMCP
#'
#' @description performs bayesian MCP Test step.
#' @description performs bayesian MCP Test step, as described in Fleischer et al. (Bayesian MCPMod. Pharmaceutical Statistics. 2022; 21(3): 654-670.)
#' 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 is calculated that the contrast is bigger than 0 given the data observed
#'
#' @param posterior_list a getPosterior object
#' @param posterior_list a getPosterior object with information about the (mixture) posterior distribution per dose group
#' @param contr a getContrMat object, contrast matrix to be used for the testing step.
#' @param crit_prob_adj a getCritProb object, specifying the critical value to be used for the testing (on the probability scale)
#'
#' @return b_mcp test result
#' @return b_mcp test result, with information about p-values for the individual dose-response shapes
#'
#' @export
performBayesianMCP <- function(
Expand Down
16 changes: 9 additions & 7 deletions R/posterior.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

#' @title getPosterior
#'
#' @description Either the patient level data or both the mu_hat as well as the sd_hat must to be provided.
#' @description Either the patient level data or both mu_hat as well as sd_hat must to be provided. If patient level data is provided mu_hat and se_hat are calculated within the function using a linear model.
#' This function calculates the posterior for every dose group independently via the RBesT function postmix.
#'
#' @param prior_list prior_list object
#' @param data dataframe containing the information of dose and response. Default NULL
#' Also a simulateData object can be provided.
#' @param mu_hat vector of estimated mean values
#' @param se_hat vector of estimated standard deviations.
#' @param calc_ess tbd. Default NULL
#'
#' @param mu_hat vector of estimated mean values (per dose group).
#' @param se_hat vector of estimated standard deviations (per dose group).
#' @param calc_ess boolean variable, indicating whether effective sample size should be calculated. Default FALSE
#' @return posterior_list, a posterior list object is returned with information about (mixture) posterior distribution per dose group
#' @export
getPosterior <- function(
prior_list,
Expand Down Expand Up @@ -99,10 +100,11 @@ getPosteriorI <- function(

#' @title getESS
#'
#' @description blubber
#' @description This function calculates the effective sample size for every dose group via the RBesT function ess.
#'
#' @param post_list blubb
#' @param post_list a posterior list object, for which the effective sample size (per dose group) should be calculated
#'
#' @return a vector of the effective sample sizes (per dose group)
#' @export
getESS <- function (

Expand Down
4 changes: 2 additions & 2 deletions man/getContr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions man/getCritProb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions man/getESS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/getPosterior.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/performBayesianMCP.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a289dff

Please sign in to comment.