Skip to content

Commit f8dfde5

Browse files
committed
Documentation edits.
1 parent 4b00a78 commit f8dfde5

File tree

2 files changed

+39
-30
lines changed

2 files changed

+39
-30
lines changed

R/gs_design_ahr.R

+16-11
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
# You should have received a copy of the GNU General Public License
1717
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818

19-
#' Calculate sample size and bounds given the power in 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
2020
#'
2121
#' @param enroll_rate Enrollment rates defined by \code{define_enroll_rate()}.
2222
#' @param fail_rate Failure and dropout rates defined by \code{define_fail_rate()}.
2323
#' @param ratio Experimental:Control randomization ratio.
2424
#' @param alpha One-sided Type I error.
2525
#' @param beta Type II error.
26-
#' @param info_frac Targeted information fraction at each analysis. See details for properly set it up.
27-
#' @param analysis_time Targeted time of analysis. See details for properly set it up.
26+
#' @param info_frac Targeted information fraction for analyses. See details.
27+
#' @param analysis_time Targeted calendar timing of analyses. See details.
2828
#' @param binding Indicator of whether futility bound is binding;
2929
#' default of `FALSE` is recommended.
3030
#' @param upper Function to compute upper bound.
@@ -36,8 +36,9 @@
3636
#' - `sf` for the spending function family.
3737
#' - `total_spend` for total alpha spend.
3838
#' - `param` for the parameter of the spending function.
39-
#' - `timing` (not required for information-based spending) for the spending time if different from information-based spending.
40-
#' @param lower Function to compute lower bound, which can be set up similarly as `upper`. More details can be find in [this vignette](https://merck.github.io/gsDesign2/articles/story-seven-test-types.html).
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).
4142
#' @param lpar Parameters passed to `lower`, which can be set up similarly as `upar.`
4243
#' @param info_scale Information scale for calculation. Options are:
4344
#' - `"h0_h1_info"` (default): variance under both null and alternative hypotheses is used.
@@ -46,6 +47,9 @@
4647
#' @param h1_spending Indicator that lower bound to be set by spending
4748
#' under alternate hypothesis (input `fail_rate`)
4849
#' 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).
4953
#' @param test_upper Indicator of which analyses should include an upper
5054
#' (efficacy) bound; single value of `TRUE` (default) indicates all analyses;
5155
#' otherwise, a logical vector of the same length as `info` should indicate
@@ -59,9 +63,10 @@
5963
#' Jennison and Turnbull (2000); default is 18, range is 1 to 80.
6064
#' Larger values provide larger number of grid points and greater accuracy.
6165
#' Normally, `r` will not be changed by the user.
62-
#' @param tol Tolerance parameter for boundary convergence (on Z-scale).
63-
#' @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
6468
#' 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)`.
6570
#'
6671
#' @return A list with input parameters, enrollment rate, analysis, and bound.
6772
#' - The `$input` is a list including `alpha`, `beta`, `ratio`, etc.
@@ -73,14 +78,14 @@
7378
#'
7479
#' @details
7580
#' The parameters `info_frac` and `analysis_time` are used to determine the timing for interim and final analyses.
76-
#' - If the interim analysis is decided by targeted information fraction and the study duration is known,
81+
#' - If the interim analysis is determined by targeted information fraction and the study duration is known,
7782
#' then `info_frac` is a numerical vector where each element (greater than 0 and less than or equal to 1)
7883
#' represents the information fraction for each analysis.
7984
#' The `analysis_time`, which defaults to 36, indicates the time for the final analysis.
80-
#' - If the interim analysis is determined solely by the targeted analysis timing,
85+
#' - If interim analyses are determined solely by the targeted calendar analysis timing from start of study,
8186
#' then `analysis_time` will be a vector specifying the time for each analysis.
82-
#' - If both the targeted analysis time and the targeted information fraction are utilized, which arrives latter,
83-
#' then both `info_frac` and `analysis_time` should be provided as vectors.
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.
8489
#'
8590
#' @examples
8691
#' library(gsDesign)

R/gs_power_ahr.R

+23-19
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,42 @@
1919
#' Group sequential design power using average hazard ratio under
2020
#' non-proportional hazards
2121
#'
22-
#' Calculate the power given the sample size in group sequential design power using average hazard ratio under
22+
#' Calculate power given the sample size in group sequential design power using average hazard ratio under
2323
#' non-proportional hazards.
2424
#'
2525
#' @inheritParams gs_design_ahr
26-
#' @param event A numerical vector specifying the targeted event at each analysis. See details for properly set it up.
27-
#' @param integer Logical value integer whether it is an integer design
28-
#' (i.e., integer sample size and events) or not. This argument is commonly
29-
#' used when creating integer design via [to_integer()].
26+
#' @param event A numerical vector specifying the targeted events at each analysis. See details.
27+
#' @param integer Indicator of whether integer sample size and events are intended. This argument is
28+
#' used when using [to_integer()].
3029
#'
3130
#' @return A list with input parameters, enrollment rate, analysis, and bound.
32-
#' - The `$input` is a list including `alpha`, `beta`, `ratio`, etc.
33-
#' - The `$enroll_rate` is a table showing the enrollment, which is the same as input.
34-
#' - The `$fail_rate` is a table showing the failure and dropout rates, which is the same as input.
35-
#' - The `$bound` is a table summarizing the efficacy and futility bound per analysis.
36-
#' - The `analysis` is a table summarizing the analysis time, sample size, events, average HR, treatment effect and statistical information per analysis.
31+
#' - `$input` a list including `alpha`, `beta`, `ratio`, etc.
32+
#' - `$enroll_rate` a table showing the enrollment, which is the same as input.
33+
#' - `$fail_rate` a table showing the failure and dropout rates, which is the same as input.
34+
#' - `$bound` a table summarizing the efficacy and futility bound at each analysis.
35+
#' - `analysis` a table summarizing the analysis time, sample size, events, average HR, treatment effect and statistical information at each analysis.
3736
#'
3837
#' @details
39-
#' Bound satisfy input upper bound specification in
38+
#' Note that time units are arbitrary, but should be the same for all rate parameters in `enroll_rate`, `fail_rate`, and `analysis_time`.
39+
#'
40+
#' Computed bounds satisfy input upper bound specification in
4041
#' `upper`, `upar`, and lower bound specification in `lower`, `lpar`.
4142
#' [ahr()] computes statistical information at targeted event times.
4243
#' The [expected_time()] function is used to get events and average HR at
4344
#' targeted `analysis_time`.
4445
#'
45-
#' @export
46-
#' @details
4746
#' The parameters `event` and `analysis_time` are used to determine the timing for interim and final analyses.
48-
#' - If the interim analysis is decided by targeted event,
49-
#' then `event` is a numerical vector where each element represents the targeted events for each analysis.
50-
#' - If the interim analysis is determined solely by the targeted analysis timing,
51-
#' then `analysis_time` will be a vector specifying the time for each analysis.
52-
#' - If both the targeted analysis time and the targeted event are utilized, which arrives latter,
53-
#' then both `event` and `analysis_time` should be provided as vectors.
47+
#' - If analysis timing is to be determined by targeted events,
48+
#' then `event` is a numerical vector specifying the targeted events for each analysis;
49+
#' note that this can be NULL.
50+
#' - If interim analysis is determined by targeted calendar timing relative to start of enrollment,
51+
#' then `analysis_time` will be a vector specifying the calendar time from start of study for each analysis;
52+
#' note that this can be NULL.
53+
#' - A corresponding element of `event` or `analysis_time` should be provided for each analysis.
54+
#' - If both `event[i]` and `analysis[i]` are provided for analysis `i`, then the time corresponding to the
55+
#' later of these is used for analysis `i`.
56+
#'
57+
#' @export
5458
#'
5559
#' @examples
5660
#' library(gsDesign2)

0 commit comments

Comments
 (0)