|
53 | 53 | #' @param tol Tolerance parameter for boundary convergence (on Z-scale).
|
54 | 54 | #' @param interval An interval that is presumed to include the time at which
|
55 | 55 | #' expected event count is equal to targeted event.
|
| 56 | +#' @param integer Logical value integer whether it is an integer design |
| 57 | +#' (i.e., integer sample size and events) or not. This argument is commonly |
| 58 | +#' used when creating integer design via [to_integer()]. |
56 | 59 | #'
|
57 |
| -#' @return A tibble with columns `Analysis`, `Bound`, `Z`, `Probability`, |
58 |
| -#' `theta`, `Time`, `AHR`, `Events`. |
| 60 | +#' @return A tibble with columns `analysis`, `bound`, `z`, `probability`, |
| 61 | +#' `theta`, `time`, `ahr`, `event`. |
59 | 62 | #' Contains a row for each analysis and each bound.
|
60 | 63 | #'
|
61 | 64 | #' @details
|
@@ -159,7 +162,8 @@ gs_power_ahr <- function(
|
159 | 162 | info_scale = c("h0_h1_info", "h0_info", "h1_info"),
|
160 | 163 | r = 18,
|
161 | 164 | tol = 1e-6,
|
162 |
| - interval = c(.01, 1000)) { |
| 165 | + interval = c(.01, 1000), |
| 166 | + integer = FALSE) { |
163 | 167 | # Get the number of analysis
|
164 | 168 | n_analysis <- max(length(event), length(analysis_time), na.rm = TRUE)
|
165 | 169 |
|
@@ -198,8 +202,7 @@ gs_power_ahr <- function(
|
198 | 202 | )
|
199 | 203 |
|
200 | 204 | # if both events and sample size are integers, then elaborate the info and info0
|
201 |
| - sample_size <- sum(enroll_rate$duration * enroll_rate$rate) |
202 |
| - if (abs(sample_size - round(sample_size)) < 1e-5 && all(abs(event - round(event)) < 1e-5)) { |
| 205 | + if (integer) { |
203 | 206 |
|
204 | 207 | # elaborate info0
|
205 | 208 | q_e <- ratio / (1 + ratio)
|
|
0 commit comments