Skip to content

Commit

Permalink
make sure helper functions are written with all input arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyyeoCH committed Oct 19, 2024
1 parent 2d1ed94 commit 09a3744
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/boundsPostprob.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ boundsPostprob <- function(looks, p0, p1 = p0, tL, tU, parE = c(1, 1), weights)
xL <- NA
xU <- NA
for (x in 0:n) {
postp_fut <- 1 - postprob(x, n, p0, parE, weights) # futility look
postp_fut <- 1 - postprob(x = x, n = x, p = p0, parE = parE, weights = weights) # futility look
if (postp_fut >= tL) { # Rule is P(RR < p0) > tL
postL <- postp_fut
xL <- x
}
postp_eff <- postprob(x, n, p1, parE, weights) # efficacy look
postp_eff <- postprob(x = x, n = n, p1 = p1, parE = parE, weights = weights) # efficacy look
if (postp_eff >= tU) { # Rule is P(RR > p1) > tU
postU <- postp_eff
xU <- x
Expand Down
4 changes: 2 additions & 2 deletions R/boundsPredprob.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ boundsPredprob <- function(looks, Nmax = max(looks), p0, tT, phiL, phiU, parE =
xU <- NA
}
# calculate predictive and posterior probabilities at boundaries
postL <- postprob(xL, n, p0, parE = parE)
postU <- postprob(xU, n, p0, parE = parE)
postL <- postprob(x = xL, n = n, p = p0, parE = parE, weights = weights, log.p = FALSE)
postU <- postprob(x = xU, n = n, p = p0, parE = parE, weights = weights, log.p = FALSE)
# calculate lower CI at boundaries
pL_upper_ci <- ifelse(!is.na(xL), stats::binom.test(xL, n, alt = "less")$conf.int[2], NA)
pU_lower_ci <- ifelse(!is.na(xU), stats::binom.test(xU, n, alt = "greater")$conf.int[1], NA)
Expand Down

0 comments on commit 09a3744

Please sign in to comment.