Skip to content

Commit

Permalink
- fixed bug in getCritProb
Browse files Browse the repository at this point in the history
- fixed a bug in getPosteriorI regarding ESS attribute. fyi: ifelse seems to have a bug so that it only assignes only the first value of a vector
- rounded ESS in assessDesign
  • Loading branch information
wojcieko committed Dec 15, 2023
1 parent cb4cf39 commit 6d52c2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
15 changes: 7 additions & 8 deletions R/BMCPMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ assessDesign <- function (
attr(eval_design, "placEff") <- attr(mods, "placEff")
attr(eval_design, "maxEff") <- attr(mods, "maxEff")
attr(eval_design, "sampleSize") <- n_patients
attr(eval_design, "priorESS") <- getESS(prior_list)
attr(eval_design, "priorESS") <- round(getESS(prior_list), 1)

return (eval_design)

Expand Down Expand Up @@ -210,17 +210,16 @@ getCritProb <- function (

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

) {

contr <- getContr(mods = mods,
dose_levels = dose_levels ,
dose_weights = dose_weights,
se_new_trial = se_new_trial,
alpha_crit_val = alpha_crit_val)
contr <- getContr(mods = mods,
dose_levels = dose_levels ,
dose_weights = dose_weights,
se_new_trial = se_new_trial)

crit_prob <- stats::pnorm(DoseFinding::critVal(
corMat = contr$corMat,
Expand Down
18 changes: 12 additions & 6 deletions R/posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ getPosteriorI <- function(

}

names(post_list) <- names(prior_list)
class(post_list) <- "postList"
attr(post_list, "ess") <- ifelse(
test = calc_ess,
yes = getESS(post_list),
no = numeric(0))
names(post_list) <- names(prior_list)
class(post_list) <- "postList"

if (calc_ess) {

attr(post_list, "ess") <- getESS(post_list)

} else {

attr(post_list, "ess") <- numeric(0)

}

return (post_list)

Expand Down

0 comments on commit 6d52c2a

Please sign in to comment.