Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyyeoCH committed Dec 31, 2024
1 parent c661bdf commit 5083088
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion R/boundsPostprob.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Decision cutpoints for boundary (based on posterior probability)
#'
#' @description `r lifecycle::badge("experimental")`
#'
#' This function is used to identify the efficacy and futility
#' boundaries based on the following rules:
#' Efficacy boundary: find minimum x (xU) where Pr(RR > p1 | x, n, a, b) >= tU and
Expand All @@ -24,7 +26,7 @@
#' @example examples/boundsPostprob.R
#' @export
boundsPostprob <- function(looks, p0, p1 = p0, tL, tU, parE = c(1, 1), weights) {
assert_numeric(looks)
assert_numeric(looks, any.missing = FALSE)
assert_number(p0, lower = 0, upper = 1)
assert_number(p1, lower = 0, upper = 1)
assert_number(tL, lower = 0, upper = 1)
Expand Down
11 changes: 7 additions & 4 deletions R/boundsPredprob.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Decision cutpoints for boundary (based on predictive probability) for Decision 1 rule.
#'
#' @description `r lifecycle::badge("experimental")`
#'
#' This function is used to identify the efficacy boundary and futility
#' boundary based on rules in @details.
#'
Expand All @@ -8,15 +10,15 @@
#' @inheritParams boundsPostprob
#' @return A matrix for each same size in `looks`. For each sample size, the following is returned:
#' - `xL` : the maximum number of responses that meet the futility
#' threshold
#' threshold.
#' - `pL` : response rate corresponding to `xL`.
#' - `predL` : predictive probability corresponding to `xL`
#' - `postL`: posterior probability corresponding to `xL`.
#' - `pL_upper_ci` : upper bound of one sided 95% CI for the response rate based on an
#' exact binomial test.
#' - `xU` : the minimal number of responses that meet the efficacy threshold.
#' - `pU` : response rate corresponding to `xU`.
#' - `predU` : predictive probability corresponding to `xU`
#' - `predU` : predictive probability corresponding to `xU`.
#' - `postU`: posterior probability corresponding to `xU`.
#' - `pU_lower_ci` : lower bound of one sided 95% CI for the response rate based on exact
#' binomial test.
Expand All @@ -34,11 +36,11 @@
#' @export
#' @keywords graphics
boundsPredprob <- function(looks, Nmax = max(looks), p0, tT, phiL, phiU, parE = c(1, 1), weights) {
assert_numeric(looks)
assert_numeric(looks, any.missing = FALSE)
assert_number(p0, lower = 0, upper = 1)
assert_number(tT, lower = 0, upper = 1)
assert_number(phiU, lower = 0, upper = 1)
assert_number(phiL, lower = 0, upper = 1)
assert_number(phiU, lower = 0, upper = 1)
assert_numeric(parE, min.len = 2, any.missing = FALSE)
znames <- c(
"xL", "pL", "predL", "postL", "UciL",
Expand All @@ -47,6 +49,7 @@ boundsPredprob <- function(looks, Nmax = max(looks), p0, tT, phiL, phiU, parE =
z <- matrix(NA, length(looks), length(znames))
dimnames(z) <- list(looks, znames)
k <- 0
assert_numeric(weights, min.len = 0, len = nrow(par), finite = TRUE)
for (n in looks) {
k <- k + 1
# initialize so will return NA if 0 or n in "continue" region
Expand Down
2 changes: 2 additions & 0 deletions man/boundsPostprob.Rd

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

6 changes: 4 additions & 2 deletions man/boundsPredprob.Rd

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

0 comments on commit 5083088

Please sign in to comment.