@@ -153,15 +153,11 @@ sat_betabinom_power <- function(B, p_t, n_t, M, threshold, prior = "flat", a_bas
153153# '
154154# ' @param B Integer. Number of simulations.
155155# ' @param n_t Integer. Sample size of the treatment arm.
156+ # ' @param p_null True response probability under H₀. Used to simulate Binomial outcomes.
156157# ' @param M Numeric. Decision threshold for θ (on probability scale, e.g., 0.6).
157158# ' @param threshold Posterior probability threshold γ (e.g., 0.95).
158- # ' @param prior Character string specifying the prior distribution.
159- # ' Options are:
160- # ' "flat" for a non-informative Beta(1,1) prior;
161- # ' "jeffreys" for the Jeffreys prior (Beta(0.5, 0.5));
162- # ' "beta" for a custom Beta(\code{a_base}, \code{b_base}) prior (user must provide \code{a_base} and \code{b_base}).
163- # ' @param a_base Alpha parameter for Beta prior (if prior = "beta").
164- # ' @param b_base Beta parameter for Beta prior (if prior = "beta").
159+ # ' @param a_base Alpha parameter for Beta prior.
160+ # ' @param b_base Beta parameter for Beta prior.
165161# ' @param show_progress Logical. Show progress in console?
166162# '
167163# ' @return A list with \code{estimate} (type-I error), \code{mc_se}, \code{B}, and \code{rejections}.
@@ -174,8 +170,8 @@ sat_betabinom_power <- function(B, p_t, n_t, M, threshold, prior = "flat", a_bas
174170# '
175171# ' @author Thomas Debray \email{[email protected] }176172# ' @export
177- sat_betabinom_type1 <- function (B , n_t , M , threshold , prior = " flat " , a_base = 1 , b_base = 1 , show_progress = TRUE ) {
178- .Call(`_bcts_sat_betabinom_type1` , B , n_t , M , threshold , prior , a_base , b_base , show_progress )
173+ sat_betabinom_type1 <- function (B , n_t , p_null , M , threshold , a_base = 1 , b_base = 1 , show_progress = TRUE ) {
174+ .Call(`_bcts_sat_betabinom_type1` , B , n_t , p_null , M , threshold , a_base , b_base , show_progress )
179175}
180176
181177# ' @title Exact Type-I Error for Single-Arm Trial (Beta-Binomial)
@@ -192,37 +188,27 @@ sat_betabinom_type1 <- function(B, n_t, M, threshold, prior = "flat", a_base = 1
192188# ' @param M Numeric in \[0, 1\]. Decision threshold on the response rate, e.g., \code{M = 0.6}.
193189# ' @param threshold Numeric in \[0, 1\]. Posterior probability cutoff for declaring success,
194190# ' e.g., \code{threshold = 0.95}.
195- # ' @param prior Character string specifying the prior distribution.
196- # ' Options are:
197- # ' "flat" for a non-informative Beta(1,1) prior;
198- # ' "jeffreys" for the Jeffreys prior (Beta(0.5, 0.5));
199- # ' "beta" for a custom Beta(\code{a_base}, \code{b_base}) prior (user must provide \code{a_base} and \code{b_base})..
200- # ' @param a_base Numeric. Alpha parameter for the Beta prior (only used if \code{prior = "beta"}).
201- # ' @param b_base Numeric. Beta parameter for the Beta prior (only used if \code{prior = "beta"}).
191+ # ' @param a_base Numeric. Alpha parameter for the Beta prior.
192+ # ' @param b_base Numeric. Beta parameter for the Beta prior.
202193# ' @param p_null Optional. True response probability under the null hypothesis (e.g., \code{p_null = 0.6}).
203194# ' If not specified, defaults to \code{p_null = M} (boundary case).
204195# '
205196# ' @return A named list with:
206197# ' \describe{
207198# ' \item{\code{estimate}}{Exact Type-I error (a number between 0 and 1).}
208199# ' \item{\code{mc_se}}{\code{NA_real_}, included for compatibility.}
209- # ' \item{\code{B}}{\code{NA_integer_ }, included for compatibility.}
200+ # ' \item{\code{B}}{\code{NA_real_ }, included for compatibility.}
210201# ' \item{\code{rejections}}{\code{NA_integer_}, included for compatibility.}
211202# ' }
212203# '
213204# ' @examples
214- # ' # Type-I error under flat prior at boundary
215- # ' sat_betabinom_type1_exact(n_t = 40, M = 0.65, threshold = 0.9, prior = "flat")
216- # '
217- # ' # Type-I error under true p < M (frequentist view)
218- # ' sat_betabinom_type1_exact(n_t = 40, M = 0.65, threshold = 0.9,
219- # ' prior = "flat", p_null = 0.60)
205+ # ' sat_betabinom_type1_exact(n_t = 40, M = 0.65, threshold = 0.9)
220206# '
221207# ' @seealso \code{\link{sat_betabinom_type1}} for the simulation-based version.
222208# '
223209# ' @author Thomas Debray \email{[email protected] }224210# ' @export
225- sat_betabinom_type1_exact <- function (n_t , M , threshold , prior = " flat " , a_base = 1 , b_base = 1 , p_null = - 1.0 ) {
226- .Call(`_bcts_sat_betabinom_type1_exact` , n_t , M , threshold , prior , a_base , b_base , p_null )
211+ sat_betabinom_type1_exact <- function (n_t , M , threshold , a_base = 1 , b_base = 1 , p_null = - 1.0 ) {
212+ .Call(`_bcts_sat_betabinom_type1_exact` , n_t , M , threshold , a_base , b_base , p_null )
227213}
228214
0 commit comments