Skip to content

Commit

Permalink
Merge pull request #342 from Merck/341-re-organize-the-pkgdown-website
Browse files Browse the repository at this point in the history
re-org vignettes and references
  • Loading branch information
nanxstats authored Feb 22, 2024
2 parents 81c9545 + ac3131e commit 3dae6b1
Show file tree
Hide file tree
Showing 20 changed files with 443 additions and 634 deletions.
2 changes: 1 addition & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exclusions:
list(
"inst/",
"tests/testthat/old_function/",
"vignettes/articles/usage-gs-spending-bound.Rmd" = list(
"vignettes/articles/story-seven-test-types.Rmd" = list(
object_name_linter = Inf
),
"data-raw/simu_test_gs_design_combo.R" = list(
Expand Down
27 changes: 21 additions & 6 deletions R/fixed_design_ahr.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,39 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using average hazard ratio under non-proportional hazards
#' Fixed design under non-proportional hazards
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for AHR method.
#' Returns a list with a basic summary.
#' @description
#' Computes fixed design sample size (given power)
#' or power (given sample size) by:
#' - [fixed_design_ahr()] - Average hazard ratio method.
#' - [fixed_design_fh()] - Weighted logrank test with Fleming-Harrington
#' weights (Farrington and Manning, 1990).
#' - [fixed_design_mb()] - Weighted logrank test with Magirr-Burman weights.
#' - [fixed_design_lf()] - Lachin-Foulkes method (Lachin and Foulkes, 1986).
#' - [fixed_design_maxcombo()] - MaxCombo method.
#' - [fixed_design_rmst()] - RMST method.
#' - [fixed_design_milestone()] - Milestone method.
#'
#' Additionally, [fixed_design_rd()] provides fixed design for binary endpoint
#' with treatment effect measuring in risk difference.
#'
#' @inheritParams gs_design_ahr
#' @inheritParams gs_power_ahr
#' @param power Power (`NULL` to compute power or strictly between 0
#' and `1 - alpha` otherwise).
#' @param study_duration Study duration.
#'
#' @return A table.
#'
#' @importFrom dplyr filter
#'
#' @returns A list of design characteristic summary.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # AHR method ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down Expand Up @@ -64,6 +78,7 @@
#' study_duration = 36
#' )
#' x %>% summary()
#'
fixed_design_ahr <- function(
enroll_rate,
fail_rate,
Expand Down
12 changes: 4 additions & 8 deletions R/fixed_design_fh.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using Fleming-Harrington method
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for Fleming-Harrington method (Farrington and Manning, 1990).
#' Returns a list with a basic summary.
#'
#' @inheritParams gs_design_wlr
#' @inheritParams gs_power_wlr
#' @param power Power (`NULL` to compute power or strictly between 0
Expand All @@ -30,13 +24,14 @@
#' @param rho test parameter in Fleming-Harrington method.
#' @param gamma test parameter in Fleming-Harrington method.
#'
#' @return A table.
#'
#' @importFrom dplyr filter
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # WLR test with FH weights ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down Expand Up @@ -68,6 +63,7 @@
#' rho = 1, gamma = 1
#' )
#' x %>% summary()
#'
fixed_design_fh <- function(
alpha = 0.025,
power = NULL,
Expand Down
12 changes: 4 additions & 8 deletions R/fixed_design_lf.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using Lachin-Foulkes method
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for Lachin-Foulkes method (Lachin and Foulkes, 1986).
#' Returns a list with a basic summary.
#'
#' @param alpha One-sided Type I error (strictly between 0 and 1).
#' @param power Power (`NULL` to compute power or strictly between 0
#' and `1 - alpha` otherwise).
#' @param ratio Experimental:Control randomization ratio.
#' @param study_duration Study duration.
#' @inheritParams gs_design_ahr
#'
#' @return A table.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # LF method ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down Expand Up @@ -63,6 +58,7 @@
#' study_duration = 36
#' )
#' x %>% summary()
#'
fixed_design_lf <- function(
alpha = 0.025,
power = NULL,
Expand Down
12 changes: 4 additions & 8 deletions R/fixed_design_maxcombo.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using MaxCombo method
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for MaxCombo method.
#' Returns a list with a basic summary.
#'
#' @param alpha One-sided Type I error (strictly between 0 and 1).
#' @param power Power (`NULL` to compute power or strictly between 0
#' and `1 - alpha` otherwise).
Expand All @@ -32,11 +26,12 @@
#' @param tau A vector of numbers paring with gamma and rho for maxcombo test.
#' @inheritParams gs_design_combo
#'
#' @return A table.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # MaxCombo test ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down Expand Up @@ -68,6 +63,7 @@
#' rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1)
#' )
#' x %>% summary()
#'
fixed_design_maxcombo <- function(
alpha = 0.025,
power = NULL,
Expand Down
12 changes: 4 additions & 8 deletions R/fixed_design_mb.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using Magirr-Burman method
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for Magirr-Burman method.
#' Returns a list with a basic summary.
#'
#' @inheritParams gs_design_wlr
#' @inheritParams gs_power_wlr
#' @param power Power (`NULL` to compute power or strictly between 0
Expand All @@ -30,11 +24,12 @@
#' @param study_duration Study duration.
#' @param tau Test parameter of Magirr-Burman method.
#'
#' @return A table.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # WLR test with MB weights ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down Expand Up @@ -66,6 +61,7 @@
#' tau = 4
#' )
#' x %>% summary()
#'
fixed_design_mb <- function(
alpha = 0.025,
power = NULL,
Expand Down
12 changes: 4 additions & 8 deletions R/fixed_design_milestone.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using milestone method
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for milestone method (Yung and Liu, 2020).
#' Returns a list with a basic summary.
#'
#' @inheritParams gs_design_ahr
#' @param alpha One-sided Type I error (strictly between 0 and 1).
#' @param power Power (`NULL` to compute power or strictly between 0
Expand All @@ -30,11 +24,12 @@
#' @param study_duration Study duration.
#' @param tau Test parameter of milestone method.
#'
#' @return A table.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # Milestone method ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down Expand Up @@ -66,6 +61,7 @@
#' tau = 18
#' )
#' x %>% summary()
#'
fixed_design_milestone <- function(
alpha = 0.025,
power = NULL,
Expand Down
12 changes: 4 additions & 8 deletions R/fixed_design_rd.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design for binary outcome measuring in risk difference
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for binary outcome measuring in risk difference (Mehrotra and Railkar, 2000).
#' Returns a list with a basic summary.
#'
#' @param alpha One-sided Type I error (strictly between 0 and 1).
#' @param power Power (`NULL` to compute power or strictly between 0
#' and `1 - alpha` otherwise).
Expand All @@ -32,11 +26,12 @@
#' computed to achieve the targeted power
#' @param ratio Experimental:Control randomization ratio.
#'
#' @return A table.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # Binary endpoint with risk differences ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand All @@ -52,6 +47,7 @@
#' rd0 = 0, n = 2000, ratio = 1
#' )
#' x %>% summary()
#'
fixed_design_rd <- function(
alpha = 0.025,
power = NULL,
Expand Down
11 changes: 3 additions & 8 deletions R/fixed_design_rmst.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#' Fixed design using RMST method
#'
#' Computes fixed design sample size (given power) or power (given sample size)
#' for RMST methods (Yung and Liu, 2020).
#' Returns a list with a basic summary.
#'
#' @inheritParams gs_design_ahr
#' @param alpha One-sided Type I error (strictly between 0 and 1).
#' @param power Power (`NULL` to compute power or strictly between 0
Expand All @@ -30,11 +24,12 @@
#' @param study_duration Study duration.
#' @param tau Test parameter in RMST.
#'
#' @return A table.
#'
#' @export
#'
#' @rdname fixed_design
#'
#' @examples
#' # RMST method ----
#' library(dplyr)
#'
#' # Example 1: given power and compute sample size
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ articles:
- articles/story-design-with-spending
- articles/story-spending-time-example
- articles/story-power-evaluation-with-spending-bound
- articles/story-seven-test-types

- title: "Design by AHR"
desc: >
Expand Down
Loading

0 comments on commit 3dae6b1

Please sign in to comment.