|
16 | 16 | # You should have received a copy of the GNU General Public License
|
17 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 | 18 |
|
19 |
| -#' Group sequential design using average hazard ratio under non-proportional hazards |
| 19 | +#' Calculate sample size and bounds given targeted power and Type I error in group sequential design using average hazard ratio under non-proportional hazards |
20 | 20 | #'
|
21 |
| -#' @param enroll_rate Enrollment rates. |
22 |
| -#' @param fail_rate Failure and dropout rates. |
23 |
| -#' @param ratio Experimental:Control randomization ratio (not yet implemented). |
| 21 | +#' @param enroll_rate Enrollment rates defined by \code{define_enroll_rate()}. |
| 22 | +#' @param fail_rate Failure and dropout rates defined by \code{define_fail_rate()}. |
| 23 | +#' @param ratio Experimental:Control randomization ratio. |
24 | 24 | #' @param alpha One-sided Type I error.
|
25 | 25 | #' @param beta Type II error.
|
26 |
| -#' @param info_frac Targeted information fraction at each analysis. |
27 |
| -#' @param analysis_time Minimum time of analysis. |
| 26 | +#' @param info_frac Targeted information fraction for analyses. See details. |
| 27 | +#' @param analysis_time Targeted calendar timing of analyses. See details. |
28 | 28 | #' @param binding Indicator of whether futility bound is binding;
|
29 | 29 | #' default of `FALSE` is recommended.
|
30 | 30 | #' @param upper Function to compute upper bound.
|
| 31 | +#' - \code{gs_spending_bound()}: alpha-spending efficacy bounds. |
| 32 | +#' - \code{gs_b()}: fixed efficacy bounds. |
31 | 33 | #' @param upar Parameters passed to `upper`.
|
32 |
| -#' @param lower Function to compute lower bound. |
33 |
| -#' @param lpar Parameters passed to `lower`. |
| 34 | +#' - If `upper = gs_b`, then `upar` is a numerical vector specifying the fixed efficacy bounds per analysis. |
| 35 | +#' - If `upper = gs_spending_bound`, then `upar` is a list including |
| 36 | +#' - `sf` for the spending function family. |
| 37 | +#' - `total_spend` for total alpha spend. |
| 38 | +#' - `param` for the parameter of the spending function. |
| 39 | +#' - `timing` specifies spending time if different from information-based spending; see details. |
| 40 | +#' @param lower Function to compute lower bound, which can be set up similarly as `upper`. |
| 41 | +#' See [this vignette](https://merck.github.io/gsDesign2/articles/story-seven-test-types.html). |
| 42 | +#' @param lpar Parameters passed to `lower`, which can be set up similarly as `upar.` |
34 | 43 | #' @param info_scale Information scale for calculation. Options are:
|
35 | 44 | #' - `"h0_h1_info"` (default): variance under both null and alternative hypotheses is used.
|
36 | 45 | #' - `"h0_info"`: variance under null hypothesis is used.
|
37 | 46 | #' - `"h1_info"`: variance under alternative hypothesis is used.
|
38 | 47 | #' @param h1_spending Indicator that lower bound to be set by spending
|
39 | 48 | #' under alternate hypothesis (input `fail_rate`)
|
40 | 49 | #' if spending is used for lower bound.
|
| 50 | +#' If this is `FALSE`, then the lower bound spending is under the null hypothesis. |
| 51 | +#' This is for two-sided symmetric or asymmetric testing under the null hypothesis; |
| 52 | +#' See [this vignette](https://merck.github.io/gsDesign2/articles/story-seven-test-types.html). |
41 | 53 | #' @param test_upper Indicator of which analyses should include an upper
|
42 | 54 | #' (efficacy) bound; single value of `TRUE` (default) indicates all analyses;
|
43 | 55 | #' otherwise, a logical vector of the same length as `info` should indicate
|
|
51 | 63 | #' Jennison and Turnbull (2000); default is 18, range is 1 to 80.
|
52 | 64 | #' Larger values provide larger number of grid points and greater accuracy.
|
53 | 65 | #' Normally, `r` will not be changed by the user.
|
54 |
| -#' @param tol Tolerance parameter for boundary convergence (on Z-scale). |
55 |
| -#' @param interval An interval that is presumed to include the time at which |
| 66 | +#' @param tol Tolerance parameter for boundary convergence (on Z-scale); normally not changed by the user. |
| 67 | +#' @param interval An interval presumed to include the times at which |
56 | 68 | #' expected event count is equal to targeted event.
|
| 69 | +#' Normally, this can be ignored by the user as it is set to `c(.01, 1000)`. |
57 | 70 | #'
|
58 | 71 | #' @return A list with input parameters, enrollment rate, analysis, and bound.
|
59 |
| -#' |
60 |
| -#' @section Specification: |
61 |
| -#' \if{latex}{ |
62 |
| -#' \itemize{ |
63 |
| -#' \item Validate if input analysis_time is a positive number or positive |
64 |
| -#' increasing sequence. |
65 |
| -#' \item Validate if input info_frac is a positive number or positive |
66 |
| -#' increasing sequence |
67 |
| -#' on (0, 1] with final value of 1. |
68 |
| -#' \item Validate if input info_frac and analysis_time have the same |
69 |
| -#' length if both have length > 1. |
70 |
| -#' \item Get information at input analysis_time |
71 |
| -#' \itemize{ |
72 |
| -#' \item Use \code{gs_info_ahr()} to get the information and effect size |
73 |
| -#' based on AHR approximation. |
74 |
| -#' \item Extract the final event. |
75 |
| -#' \item Check if input If needed for (any) interim analysis timing. |
76 |
| -#' } |
77 |
| -#' \item Add the analysis column to the information at input analysis_time. |
78 |
| -#' \item Add the sample size column to the information at input analysis_time |
79 |
| -#' using \code{expected_accural()}. |
80 |
| -#' \item Get sample size and bounds using \code{gs_design_npe()} and |
81 |
| -#' save them to bounds. |
82 |
| -#' \item Add Time, Events, AHR, N that have already been calculated |
83 |
| -#' to the bounds. |
84 |
| -#' \item Return a list of design enrollment, failure rates, and bounds. |
85 |
| -#' } |
86 |
| -#' } |
87 |
| -#' \if{html}{The contents of this section are shown in PDF user manual only.} |
| 72 | +#' - The `$input` is a list including `alpha`, `beta`, `ratio`, etc. |
| 73 | +#' - The `$enroll_rate` is a table showing the enrollment for arriving the targeted power (`1 - beta`). |
| 74 | +#' - The `$fail_rate` is a table showing the failure and dropout rates, which is the same as input. |
| 75 | +#' - The `$bound` is a table summarizing the efficacy and futility bound per analysis. |
| 76 | +#' - The `analysis` is a table summarizing the analysis time, sample size, events, average HR, treatment effect and statistical information per analysis. |
| 77 | +#' @export |
88 | 78 | #'
|
89 | 79 | #' @details
|
90 |
| -#' To be added. |
91 |
| -#' |
92 |
| -#' @export |
| 80 | +#' The parameters `info_frac` and `analysis_time` are used to determine the timing for interim and final analyses. |
| 81 | +#' - If the interim analysis is determined by targeted information fraction and the study duration is known, |
| 82 | +#' then `info_frac` is a numerical vector where each element (greater than 0 and less than or equal to 1) |
| 83 | +#' represents the information fraction for each analysis. |
| 84 | +#' The `analysis_time`, which defaults to 36, indicates the time for the final analysis. |
| 85 | +#' - If interim analyses are determined solely by the targeted calendar analysis timing from start of study, |
| 86 | +#' then `analysis_time` will be a vector specifying the time for each analysis. |
| 87 | +#' - If both the targeted analysis time and the targeted information fraction are utilized for a given analysis, |
| 88 | +#' then timing will be the maximum of the two with both `info_frac` and `analysis_time` provided as vectors. |
93 | 89 | #'
|
94 | 90 | #' @examples
|
95 | 91 | #' library(gsDesign)
|
|
0 commit comments