Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14 oc post prob #16

Merged
merged 103 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
50ef5b1
cleaning up dbetabinom
audreyyeoCH Aug 14, 2023
4342b5a
removed rounding, not needed
audreyyeoCH Aug 14, 2023
b095ae6
rmarkdown language and assert for dbetabinom
audreyyeoCH Aug 22, 2023
889e97d
changed x and m to number instead of numeric
audreyyeoCH Aug 22, 2023
2eafdc5
test
audreyyeoCH Aug 22, 2023
9dc428b
pbetaMix function and test
audreyyeoCH Aug 23, 2023
dd1d8c4
added new tests and changed documentation
audreyyeoCH Aug 24, 2023
6d7f478
upper case for test_that comments and more tests for qbeta
audreyyeoCH Aug 24, 2023
d520ff0
Merge branch 'main' into 9_pbeta
audreyyeoCH Aug 25, 2023
0b361e3
test_thats for pbetaMix and qbetaMix
audreyyeoCH Aug 27, 2023
8b20f72
tidy syntax and last checks
audreyyeoCH Aug 28, 2023
b0c2218
tidy syntax and last checks
audreyyeoCH Aug 28, 2023
9f53521
Merge remote-tracking branch 'origin/9_pbeta' into 9_pbeta
audreyyeoCH Aug 28, 2023
5384c3d
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
f5403fa
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Aug 28, 2023
0dd2bab
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
ca0236f
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
9cf54d0
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
2eb3bd2
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
c08435f
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
e36facd
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
f45d2f0
Update R/dbetabinom.R
audreyyeoCH Aug 28, 2023
0505982
Update examples/pbetaMix.R
audreyyeoCH Aug 28, 2023
469ed6e
p and q inputs
audreyyeoCH Aug 29, 2023
1abea50
q,p changes
audreyyeoCH Aug 29, 2023
b7b523c
Update R/dbetabinom.R
audreyyeoCH Aug 29, 2023
34a663b
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Aug 29, 2023
f384100
documentation to reflect p and q changes
audreyyeoCH Aug 29, 2023
f0d5d00
Merge remote-tracking branch 'origin/9_pbeta' into 9_pbeta
audreyyeoCH Aug 29, 2023
b9e50b2
amending qt
audreyyeoCH Aug 29, 2023
0ab047d
intro x-> q
audreyyeoCH Aug 29, 2023
4164b46
amented postprob file
audreyyeoCH Aug 29, 2023
5d98627
amended postprob file
audreyyeoCH Aug 29, 2023
205e574
fixed mistake on x
audreyyeoCH Aug 29, 2023
01bd1bf
Merge remote-tracking branch 'origin/9_pbeta' into 9_pbeta
audreyyeoCH Aug 29, 2023
2d093ba
qbetaMix was in postprobDist
audreyyeoCH Aug 29, 2023
c7dbbf9
trying to find R CMD check error
audreyyeoCH Aug 30, 2023
640f9f3
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Aug 30, 2023
3f01c97
manual of ocPostprobDist
audreyyeoCH Aug 30, 2023
99d6eb5
Merge remote-tracking branch 'origin/9_pbeta' into 9_pbeta
audreyyeoCH Aug 30, 2023
cc069c3
fixing roxygen type to p
audreyyeoCH Aug 30, 2023
626345c
see if this fixes the CMD check
audreyyeoCH Aug 30, 2023
3882982
see if fixes CMD check error
audreyyeoCH Aug 30, 2023
f6c7df2
xi removed
audreyyeoCH Aug 30, 2023
80eee89
example post prob works
audreyyeoCH Aug 30, 2023
1d115b4
clean
audreyyeoCH Aug 30, 2023
2185dea
Merge branch 'tmp' into 9_pbeta
audreyyeoCH Aug 30, 2023
5bb074e
assert_number
audreyyeoCH Aug 30, 2023
9d4b62c
in postprobDist, I changed p-> q
audreyyeoCH Aug 30, 2023
db8fb65
change p to q
audreyyeoCH Aug 30, 2023
51ed0c9
Merge remote-tracking branch 'origin/9_pbeta' into 9_pbeta
audreyyeoCH Aug 30, 2023
8470616
postprobold
audreyyeoCH Aug 30, 2023
3c86a99
postprobOld
audreyyeoCH Aug 31, 2023
80606cf
Merge remote-tracking branch 'origin/main' into 11_postprob
audreyyeoCH Aug 31, 2023
2f9b831
clean post prob
audreyyeoCH Sep 7, 2023
5d553ee
nice titles
audreyyeoCH Sep 7, 2023
c475186
documentations
audreyyeoCH Sep 8, 2023
0dd9c8a
clean
audreyyeoCH Sep 8, 2023
9ddd5df
clean
audreyyeoCH Sep 21, 2023
476ad27
clean
audreyyeoCH Sep 22, 2023
5397930
clean
audreyyeoCH Sep 22, 2023
6fd620f
Merge remote-tracking branch 'origin/main' into 14_ocPostProb
audreyyeoCH Sep 22, 2023
2dd0a44
clean
audreyyeoCH Sep 26, 2023
0af15cd
clean
audreyyeoCH Sep 27, 2023
63de68a
some examples and tests
audreyyeoCH Sep 28, 2023
7eba969
clean
audreyyeoCH Sep 29, 2023
8135abd
fix R CMD check errors
audreyyeoCH Oct 2, 2023
c79982c
fix R CMD check errors for PR
audreyyeoCH Oct 2, 2023
cf0ace7
Update R/ocPostprob.R
audreyyeoCH Oct 3, 2023
3b1ed09
Update R/ocPostprob.R
audreyyeoCH Oct 3, 2023
271edd4
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 3, 2023
7f2c01b
Update R/ocPostprob.R
audreyyeoCH Oct 3, 2023
027e432
Update R/ocPostprob.R
audreyyeoCH Oct 3, 2023
459dac9
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 3, 2023
7964767
Update R/ocPostprob.R
audreyyeoCH Oct 3, 2023
c3ab3ea
PR feedback
audreyyeoCH Oct 3, 2023
71f797e
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 3, 2023
645024c
Merge remote-tracking branch 'origin/14_ocPostProb' into 14_ocPostProb
audreyyeoCH Oct 3, 2023
7724a7a
clean
audreyyeoCH Oct 5, 2023
f436dbb
Merge remote-tracking branch 'origin/14_ocPostProb' into 14_ocPostProb
audreyyeoCH Oct 5, 2023
35126ab
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 5, 2023
55939e9
clean
audreyyeoCH Oct 11, 2023
a9c991f
Revert "[skip actions] Roxygen Man Pages Auto Update"
audreyyeoCH Oct 11, 2023
147146c
Revert "clean"
audreyyeoCH Oct 11, 2023
ac6cb69
clean
audreyyeoCH Oct 11, 2023
bd78bbe
clean
audreyyeoCH Oct 12, 2023
971264f
Update R/ocPostprob.R
audreyyeoCH Oct 12, 2023
ff8aa37
Update R/ocPostprob.R
audreyyeoCH Oct 12, 2023
6f3a999
Update R/ocPostprob.R
audreyyeoCH Oct 12, 2023
8990c36
Update R/ocPostprob.R
audreyyeoCH Oct 12, 2023
8923010
Update R/postprob.R
audreyyeoCH Oct 12, 2023
3820c91
Update R/postprob.R
audreyyeoCH Oct 12, 2023
ec14b6d
Update tests/testthat/test-ocPostprob.R
audreyyeoCH Oct 12, 2023
0c5202e
clean
audreyyeoCH Oct 12, 2023
f94c6e4
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 12, 2023
cb5d150
clean
audreyyeoCH Oct 12, 2023
7b29dc0
Merge remote-tracking branch 'origin/14_ocPostProb' into 14_ocPostProb
audreyyeoCH Oct 12, 2023
5c332e4
clean
audreyyeoCH Oct 12, 2023
6d0b952
clean
audreyyeoCH Oct 12, 2023
096b8bb
Update tests/testthat/test-ocPostprob.R
audreyyeoCH Oct 13, 2023
993dad4
clean
audreyyeoCH Oct 13, 2023
ee111a6
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 13, 2023
9c1ada1
clean
audreyyeoCH Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
345 changes: 247 additions & 98 deletions R/ocPostprob.R
Original file line number Diff line number Diff line change
@@ -1,114 +1,263 @@
#' @include postprob.R
NULL

#' Calculate operating characteristics for posterior probability method
#' Generating random distance in given looks for sample sizes for Efficacy and Futility.
#'
#' The trial is stopped for efficacy if the posterior probability to be
#' above p1 is larger than tU, and stopped for futility if the posterior
#' probability to be below p0 is larger than tL.
#' A helper function for `ocPostprob` to generate random distance's wiggle room around looks `nn`.
#' Numeric looks `nn` must be of minimum two elements and will generate `length(nn)-1` distances.
#'
#' Returned operating characteristics in a matrix include:
#' ExpectedN: expected number of patients in the trials
#' PrStopEarly: probability to stop the trial early (before reaching the
#' @typed nn : number or numeric
#' the union of `nnE` and `nnF` (if futility analysis or looks exists) supplied.
#'
#' @return A numeric with `length(nn)-1` elements.
#'
#' @keywords internal
#'
h_get_distance <- function(nn) {
assert_numeric(nn, unique = TRUE, sorted = TRUE, min.len = 1)
dist0 <- floor(min(nn - c(0, nn[-length(nn)])) / 2)
assert_numeric(dist0, sorted = TRUE)
sample(-dist0:dist0,
size = length(nn) - 1,
replace = TRUE,
prob = 2^(-abs(-dist0:dist0) / 2)
)
}

#' Generating looks from random distance
#'
#' A helper function for `ocPostprob` that applies the numeric element of `dist` to looks `nn`.
#'
#' @typed dist : numeric or logical
#' distance for random looks around the look locations in `nn`,
#' where `dist`is generated from `h_get_distance` in a numeric of at least one element.
#' If `NULL`, only one location look will be set at `nnE` or `nnF`.
#' @typed nnE : numeric
#' sample size or sizes where study can be stopped for Efficacy decision. If different for Futility decision,
#' specify in `nnF`.
#' @typed nnF : numeric
#' sample size or sizes where study can be stopped for Futility decision if different from Efficacy decision.
#'
#' @return Uses distance from `h_get_distance` to add to looks, creating wiggled looks:
#' - `nnrE` is the result for Efficacy looks with random distance added.
#' - `nnrF` is the result for Futility looks with random distance added.
#'
#' @keywords internal
#'
h_get_looks <- function(dist, nnE, nnF) {
assert_numeric(nnE)
assert_numeric(nnF)
nn <- unique(c(nnE, nnF))
assert_numeric(nn)
assert_numeric(dist)
nnr <- nn + c(dist, 0)
list(
nnrE = nnr[nn %in% nnE],
nnrF = nnr[nn %in% nnF]
)
}

#' Generating random decision and sample size looks.
#'
#' A helper function for `ocPostprob` to generate numeric of decisions `decisions` and random looks `all_sizes`.
#'
#' @inheritParams h_get_looks
#' @typed nnr : numeric
#' union of `nnE`and `nnF`.
#' @typed response : numeric
#' a numeric of Bernoulli successes based on `size_look`.
#' @typed truep : number
#' assumed true response rate or true rate (scenario).
#' @typed p0 : number
#' lower Futility threshold of response rate.
#' @typed p1 : number
#' upper Efficacy threshold of response rate.
#' @typed tL : number
#' posterior probability threshold for being below `p0`.
#' @typed tU : number
#' posterior probability threshold for being above `p1`.
#' @typed parE : numeric
#' alpha and beta parameters for the prior on the treatment proportion.
#' Default set at alpha = 1, beta = 1, or uniform prior.
#'
#' @return A list of the following objects :
#' - `decision` : resulting numeric of decision, one of `TRUE` for Go, `FALSE` for Stop, `NA` for Gray zone.
#' - `all_sizes` : resulting numeric of look size, anything below maximum
#' look size is an indicated interim, Futility or Efficacy or both.
#'
#' @keywords internal
#'
h_get_decision <- function(nnr, response, truep, p0, p1, parE = c(1, 1), nnE, nnF, tL, tU) {
index_look <- 1
assert_numeric(nnr)
size_look <- nnr[index_look]
all_sizes <- decision <- NA
response <- stats::rbinom(max(nnr), size = 1, truep)
assert_numeric(response, lower = 0, upper = 1)
while (is.na(decision) && index_look <= length(nnr)) {
if (size_look %in% nnF) {
qL <- 1 - postprob(x = sum(response[1:size_look]), n = size_look, p = p0, parE = parE)
assert_number(qL, lower = 0, upper = 1)
decision <- ifelse(qL >= tL, FALSE, NA)
}
if (size_look %in% nnE) {
qU <- postprob(x = sum(response[1:size_look]), n = size_look, p = p1, parE = parE)
assert_number(qU, lower = 0, upper = 1)
decision <- ifelse(qU < tU, decision, TRUE)
}
all_sizes <- size_look
index_look <- index_look + 1
size_look <- nnr[index_look]
}
list(
decision = decision,
all_sizes = all_sizes
)
}

#' Creating list for operating characteristics.
#'
#' Generates operating characteristics.
#'
#' @inheritParams h_get_looks
#' @inheritParams h_get_decision
#' @typed nnrE : numeric
#' looks with random distance, if applied on `nnE`.
#' @typed nnrF : numeric
#' looks with random distance, if applied on `nnF`.
#' @typed all_sizes : numeric
#' sample sizes of all looks simulated `length(sim)` times if `dist` applied.
#' @typed decision : numeric
#' Go, Stop or Gray Zone decisions of all looks simulated `length(sim)` times.
#'
#' @return A list of results containing :
#'
#' - `ExpectedN`: expected number of patients in the trials
#' - `PrStopEarly`: probability to stop the trial early (before reaching the
#' maximum sample size)
#' PrEarlyEff: probability to decide for efficacy early
#' PrEarlyFut: probability to decide for futility early
#' PrEfficacy: probability to decide for efficacy
#' PrFutility: probability to decide for futility
#' PrGrayZone: probability of no decision at the end ("gray zone")
#'
#' @param nn vector of look locations for efficacy
#' (if futility looks should be different, please specify also \code{nnF})
#' @param p true rate (scenario)
#' @param p0 lower efficacy threshold
#' @param p1 upper efficacy threshold
#' @param tL probability threshold for being below p0
#' @param tU probability threshold for being above p1
#' @param parE beta parameters for the prior on the treatment proportion
#' @param ns number of simulations
#' @param nr generate random look locations? (not default)
#' @param d distance for random looks around the look locations in \code{nn}
#' @param nnF vector of look locations for futility
#' (default: same as efficacy)
#' - `PrEarlyEff`: probability of Early Go decision
#' - `PrEarlyFut`: probability of for Early Stop decision
#' - `PrEfficacy`: probability of Go decision
#' - `PrFutility`: probability of Stop decision
#' - `PrGrayZone`: probability between Go and Stop ,"Evaluate" or Gray decision zone
#'
#' @keywords internal
#'
h_get_oc <- function(all_sizes, nnr, decision, nnrE, nnrF) {
sim <- length(all_sizes)
assert_logical(decision, len = sim)
assert_numeric(all_sizes)
assert_numeric(nnrE, lower = 0, upper = max(nnrE))
assert_numeric(nnrF, lower = 0, upper = max(nnrF))
data.frame(
ExpectedN = mean(all_sizes, na.rm = TRUE),
PrStopEarly = mean(all_sizes < max(nnrF), na.rm = TRUE),
PrEarlyEff = sum(decision * (all_sizes < max(nnrE)), na.rm = TRUE) / sim,
PrEarlyFut = sum((1 - decision) * (all_sizes < max(nnrF)), na.rm = TRUE) / sim,
PrEfficacy = sum(decision, na.rm = TRUE) / sim,
PrFutility = sum(1 - decision, na.rm = TRUE) / sim,
PrGrayZone = sum(is.na(decision)) / sim
)
}

#' Operating Characteristics for Posterior Probability method
#'
#' @description `r lifecycle::badge("experimental")`
#'
#' Calculate operating characteristics for posterior probability method.
#'
#' It is assumed that the true response rate is `truep`.
#' The trial is stopped for Efficacy if the posterior probability to be
#' above `p1` is larger than `tU`, and stopped for Futility if the posterior
#' probability to be below `p0` is larger than `tL`:
#'
#' Stop criteria for Efficacy :
#'
#' `P_E(p > p1) > tU`
#'
#' Stop criteria for Futility :
#'
#' `P_E(p < p0) > tL`
#'
#' Resulting operating characteristics include the following:
#'
#' - `ExpectedN`: expected number of patients in the trials
#' - `PrStopEarly`: probability to stop the trial early (before reaching the
#' maximum sample size)
#' - `PrEarlyEff`: probability of Early Go decision
#' - `PrEarlyFut`: probability of for Early Stop decision
#' - `PrEfficacy`: probability of Go decision
#' - `PrFutility`: probability of Stop decision
#' - `PrGrayZone`: probability between Go and Stop ,"Evaluate" or Gray decision zone
audreyyeoCH marked this conversation as resolved.
Show resolved Hide resolved
#'
#' @inheritParams h_get_looks
#' @inheritParams h_get_decision
#' @typed sim : number
#' number of simulations.
#' @typed wiggle : logical
#' generate random look locations (not default).
#' if `TRUE`, optional to specify `dist` (see @details).
#' @typed randomdist : logical
#' Random distance added to looks. if `NULL`, and `wiggle = TRUE`, function will
#' generate and add a random distance within range of the closest looks.
#'
#' @return A list with the following elements:
#' oc: matrix with operating characteristics (see Details section)
#' Decision: vector of the decisions made in the simulated trials
#' (\code{TRUE} for success, \code{FALSE} for failure, \code{NA} for no
#' decision)
#' SampleSize: vector of the sample sizes in the simulated trials
#' nn: vector of look locations that was supplied
#' nnE: vector of efficacy look locations
#' nnF: vector of futility look locations
#' params: multiple parameters
#'
#' - `oc`: matrix with operating characteristics (see @details section)
#' - `nn`: vector of look locations that was supplied
#' - `nnE`: vector of Efficacy look locations
#' - `nnF`: vector of Futility look locations
#' - `params`: multiple parameters
#'
#' @details
#' `ExpectedN` is an average of the simulated sample sizes.
#' If `wiggle = TRUE`, one can specify `dist`, though the algorithm will generate it if `dist = NULL`.
#' If `nnF = NULL`, no Futility or decision to Stop will be analysed. Note that `nnF = c(0)` is equivalent.
#' As default, `nnF` is set to the identical looks of `nnE`, and if `wiggle = TRUE`, all looks are the same, e.g.
#' `nnE = nnF` when wiggle and distance is applied.
#'
#' @example examples/ocPostprob.R
#' @export
ocPostprob <- function(nn, p, p0, p1, tL, tU, parE = c(1, 1),
ns = 10000, nr = FALSE, d = NULL, nnF = nn) {
# Calculate operating characteristics via simulation
# nn: vector of look locations
# s: decision reject H0 (TRUE) or fail to reject (FALSE)
# during trial if continuing (NA)

## copy nn to nnE:
nnE <- sort(nn)
nnF <- sort(nnF)
s <- rep(NA, ns)
n <- s
ocPostprob <- function(nnE, truep, p0, p1, tL, tU, parE = c(1, 1),
sim = 50000, wiggle = FALSE, randomdist = NULL, nnF = nnE) {
nn <- sort(unique(c(nnF, nnE)))
nL <- length(nn)
Nstart <- nn[1]
Nmax <- nn[nL]
if (nr && is.null(d)) {
# set parameter d for randomly generating look locations
d <- floor(min(nn - c(0, nn[-nL])) / 2)
assert_number(sim, lower = 1, finite = TRUE)
if (sim < 50000) {
warning("Advise to use sim >= 50000 to achieve convergence")
}
nnr <- nn
nnrE <- nnE
nnrF <- nnF
for (k in 1:ns) {
# simulate a clinical trial ns times
if (nr && (d > 0)) {
# randomly generate look locations
dd <- sample(-d:d,
size = nL - 1, replace = TRUE,
prob = 2^(c(-d:0, rev(-d:(-1))) / 2)
)
nnr <- nn + c(dd, 0)

nnrE <- nnr[nn %in% nnE]
nnrF <- nnr[nn %in% nnF]
}
x <- stats::rbinom(Nmax, 1, p)
j <- 1
i <- nnr[j]
while (is.na(s[k]) && (j <= length(nnr))) {
if (i %in% nnrF) {
qL <- 1 - postprob(x = sum(x[1:i]), n = i, p = p0, parE = parE)
s[k] <- ifelse(qL >= tL, FALSE, NA)
}

if (i %in% nnrE) {
qU <- postprob(x = sum(x[1:i]), n = i, p = p1, parE = parE)
s[k] <- ifelse(qU < tU, s[k], TRUE)
}

n[k] <- i
j <- j + 1
i <- nnr[j]
decision <- vector(length = sim)
audreyyeoCH marked this conversation as resolved.
Show resolved Hide resolved
all_sizes <- vector(length = sim)
for (k in seq_len(sim)) {
if (length(nn) != 1 && wiggle && is.null(randomdist)) {
dist <- h_get_distance(nn = nn)
nnr <- h_get_looks(dist = dist, nnE = nnE, nnF = nnF)
nnrE <- nnr$nnrE
nnrF <- nnr$nnrF
} else {
nnrE <- nnE
nnrF <- nnF
}
nnr <- unique(c(nnrE, nnrF))
tmp <- h_get_decision(
nnr = nnr, response = response,
truep = truep, p0 = p0, p1 = p1,
parE = c(1, 1), nnE = nnrE,
nnF = nnrF, tL = tL, tU = tU
)
decision[k] <- tmp$decision
all_sizes[k] <- tmp$all_sizes
}
oc <- cbind(
ExpectedN = mean(n), PrStopEarly = mean(n < Nmax),
PrEarlyEff = sum(s * (n < Nmax), na.rm = TRUE) / ns,
PrEarlyFut = sum((1 - s) * (n < Nmax), na.rm = TRUE) / ns,
PrEfficacy = sum(s, na.rm = TRUE) / ns,
PrFutility = sum(1 - s, na.rm = TRUE) / ns,
PrGrayZone = sum(is.na(s) / ns)
)
return(list(
oc = oc, Decision = s, SampleSize = n,
nn = nn, nnE = nnE, nnF = nnF,
oc <- h_get_oc(all_sizes = all_sizes, nnr = nnr, decision = decision, nnrE = nnrE, nnrF = nnrF)
list(
oc = oc,
Decision = decision,
SampleSize = all_sizes,
union_nn = nnr,
input_nnE = nnE,
input_nnF = nnF,
wiggled_Eff_n = nnrE,
wiggled_Fut_n = nnrF,
wiggle_dist = dist,
params = as.list(match.call(expand.dots = FALSE))
))
)
}
2 changes: 1 addition & 1 deletion R/plotOc.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @keywords graphics
plotOc <- function(z) {
## plot function for oc.predprob or oc.postprob, or the dist versions of them
graphics::barplot(table(z$Decision, z$SampleSize) / z$params$ns, beside = TRUE)
graphics::barplot(table(z$Decision, z$SampleSize) / z$params$sim, beside = TRUE)

## get the parameter
parDat <- lapply(z$params, deparse)
Expand Down
Loading