From 92ea7cfdf66acfc974b42077fab03ce46ac02f9d Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Feb 2024 14:25:05 -0500 Subject: [PATCH 1/8] re-org vignettes and references --- R/fixed_design_ahr.R | 2 +- R/fixed_design_fh.R | 2 +- R/fixed_design_lf.R | 2 +- R/fixed_design_maxcombo.R | 2 +- R/fixed_design_mb.R | 2 +- R/fixed_design_milestone.R | 2 +- R/fixed_design_rd.R | 2 +- R/fixed_design_rmst.R | 2 +- _pkgdown.yml | 1 + man/fixed_design.Rd | 408 ++++++++++++++++++ man/fixed_design_ahr.Rd | 71 --- man/fixed_design_fh.Rd | 76 ---- man/fixed_design_lf.Rd | 68 --- man/fixed_design_maxcombo.Rd | 79 ---- man/fixed_design_mb.Rd | 73 ---- man/fixed_design_milestone.Rd | 73 ---- man/fixed_design_rd.Rd | 58 --- man/fixed_design_rmst.Rd | 73 ---- ...ng-bound.Rmd => story-seven-test-type.Rmd} | 0 19 files changed, 417 insertions(+), 579 deletions(-) create mode 100644 man/fixed_design.Rd delete mode 100644 man/fixed_design_ahr.Rd delete mode 100644 man/fixed_design_fh.Rd delete mode 100644 man/fixed_design_lf.Rd delete mode 100644 man/fixed_design_maxcombo.Rd delete mode 100644 man/fixed_design_mb.Rd delete mode 100644 man/fixed_design_milestone.Rd delete mode 100644 man/fixed_design_rd.Rd delete mode 100644 man/fixed_design_rmst.Rd rename vignettes/articles/{usage-gs-spending-bound.Rmd => story-seven-test-type.Rmd} (100%) diff --git a/R/fixed_design_ahr.R b/R/fixed_design_ahr.R index bc64e8cb..9393750a 100644 --- a/R/fixed_design_ahr.R +++ b/R/fixed_design_ahr.R @@ -33,7 +33,7 @@ #' @importFrom dplyr filter #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_fh.R b/R/fixed_design_fh.R index 28f0742f..a2cbb9b4 100644 --- a/R/fixed_design_fh.R +++ b/R/fixed_design_fh.R @@ -35,7 +35,7 @@ #' @importFrom dplyr filter #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_lf.R b/R/fixed_design_lf.R index 99775af7..13a0fc35 100644 --- a/R/fixed_design_lf.R +++ b/R/fixed_design_lf.R @@ -32,7 +32,7 @@ #' @return A table. #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_maxcombo.R b/R/fixed_design_maxcombo.R index ae498fa8..5ad09e97 100644 --- a/R/fixed_design_maxcombo.R +++ b/R/fixed_design_maxcombo.R @@ -35,7 +35,7 @@ #' @return A table. #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_mb.R b/R/fixed_design_mb.R index bb0b55d0..94808c79 100644 --- a/R/fixed_design_mb.R +++ b/R/fixed_design_mb.R @@ -33,7 +33,7 @@ #' @return A table. #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_milestone.R b/R/fixed_design_milestone.R index 79d3f6b9..850db2a9 100644 --- a/R/fixed_design_milestone.R +++ b/R/fixed_design_milestone.R @@ -33,7 +33,7 @@ #' @return A table. #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_rd.R b/R/fixed_design_rd.R index 871ec556..b7ed7ef8 100644 --- a/R/fixed_design_rd.R +++ b/R/fixed_design_rd.R @@ -35,7 +35,7 @@ #' @return A table. #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/R/fixed_design_rmst.R b/R/fixed_design_rmst.R index a9f1fee5..255dd718 100644 --- a/R/fixed_design_rmst.R +++ b/R/fixed_design_rmst.R @@ -33,7 +33,7 @@ #' @return A table. #' #' @export -#' +#' @rdname fixed_design #' @examples #' library(dplyr) #' diff --git a/_pkgdown.yml b/_pkgdown.yml index db61dae5..61e40928 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -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-type - title: "Design by AHR" desc: > diff --git a/man/fixed_design.Rd b/man/fixed_design.Rd new file mode 100644 index 00000000..af9d8d71 --- /dev/null +++ b/man/fixed_design.Rd @@ -0,0 +1,408 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/fixed_design_ahr.R, R/fixed_design_fh.R, +% R/fixed_design_lf.R, R/fixed_design_maxcombo.R, R/fixed_design_mb.R, +% R/fixed_design_milestone.R, R/fixed_design_rd.R, R/fixed_design_rmst.R +\name{fixed_design_ahr} +\alias{fixed_design_ahr} +\alias{fixed_design_fh} +\alias{fixed_design_lf} +\alias{fixed_design_maxcombo} +\alias{fixed_design_mb} +\alias{fixed_design_milestone} +\alias{fixed_design_rd} +\alias{fixed_design_rmst} +\title{Fixed design using average hazard ratio under non-proportional hazards} +\usage{ +fixed_design_ahr( + enroll_rate, + fail_rate, + alpha = 0.025, + power = NULL, + ratio = 1, + study_duration = 36, + event = NULL +) + +fixed_design_fh( + alpha = 0.025, + power = NULL, + ratio = 1, + study_duration = 36, + enroll_rate, + fail_rate, + rho = 0, + gamma = 0 +) + +fixed_design_lf( + alpha = 0.025, + power = NULL, + ratio = 1, + study_duration = 36, + enroll_rate, + fail_rate +) + +fixed_design_maxcombo( + alpha = 0.025, + power = NULL, + ratio = 1, + study_duration = 36, + enroll_rate, + fail_rate, + rho = c(0, 0, 1), + gamma = c(0, 1, 0), + tau = rep(-1, 3) +) + +fixed_design_mb( + alpha = 0.025, + power = NULL, + ratio = 1, + study_duration = 36, + enroll_rate, + fail_rate, + tau = 6 +) + +fixed_design_milestone( + alpha = 0.025, + power = NULL, + ratio = 1, + enroll_rate, + fail_rate, + study_duration = 36, + tau = NULL +) + +fixed_design_rd( + alpha = 0.025, + power = NULL, + ratio = 1, + p_c, + p_e, + rd0 = 0, + n = NULL +) + +fixed_design_rmst( + alpha = 0.025, + power = NULL, + ratio = 1, + study_duration = 36, + enroll_rate, + fail_rate, + tau = NULL +) +} +\arguments{ +\item{enroll_rate}{Enrollment rates.} + +\item{fail_rate}{Failure and dropout rates.} + +\item{alpha}{One-sided Type I error (strictly between 0 and 1).} + +\item{power}{Power (\code{NULL} to compute power or strictly between 0 +and \code{1 - alpha} otherwise).} + +\item{ratio}{Experimental:Control randomization ratio.} + +\item{study_duration}{Study duration.} + +\item{event}{Targeted event at each analysis.} + +\item{rho}{A vector of numbers paring with gamma and tau for maxcombo test.} + +\item{gamma}{A vector of numbers paring with rho and tau for maxcombo test.} + +\item{tau}{Test parameter in RMST.} + +\item{p_c}{A numerical value of the control arm rate.} + +\item{p_e}{A numerical value of the experimental arm rate.} + +\item{rd0}{Risk difference under null hypothesis, default is 0.} + +\item{n}{Sample size. If NULL with power input, the sample size will be +computed to achieve the targeted power} +} +\value{ +A table. + +A table. + +A table. + +A table. + +A table. + +A table. + +A table. + +A table. +} +\description{ +Computes fixed design sample size (given power) or power (given sample size) +for AHR method. +Returns a list with a basic summary. + +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. + +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. + +Computes fixed design sample size (given power) or power (given sample size) +for MaxCombo method. +Returns a list with a basic summary. + +Computes fixed design sample size (given power) or power (given sample size) +for Magirr-Burman method. +Returns a list with a basic summary. + +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. + +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. + +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. +} +\examples{ +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_ahr( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_ahr( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36 +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_fh( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36, + rho = 1, gamma = 1 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_fh( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36, + rho = 1, gamma = 1 +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_lf( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = 100, + fail_rate = log(2) / 12, + hr = .7, + dropout_rate = .001 + ), + study_duration = 36 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_fh( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = 100, + fail_rate = log(2) / 12, + hr = .7, + dropout_rate = .001 + ), + study_duration = 36 +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_maxcombo( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36, + rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1) +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_maxcombo( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36, + rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1) +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_mb( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36, + tau = 4 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_mb( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = c(4, 100), + fail_rate = log(2) / 12, + hr = c(1, .6), + dropout_rate = .001 + ), + study_duration = 36, + tau = 4 +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_milestone( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = 100, + fail_rate = log(2) / 12, + hr = .7, + dropout_rate = .001 + ), + study_duration = 36, + tau = 18 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_milestone( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = 100, + fail_rate = log(2) / 12, + hr = .7, + dropout_rate = .001 + ), + study_duration = 36, + tau = 18 +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_rd( + alpha = 0.025, power = 0.9, p_c = .15, p_e = .1, + rd0 = 0, ratio = 1 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_rd( + alpha = 0.025, power = NULL, p_c = .15, p_e = .1, + rd0 = 0, n = 2000, ratio = 1 +) +x \%>\% summary() +library(dplyr) + +# Example 1: given power and compute sample size +x <- fixed_design_rmst( + alpha = .025, power = .9, + enroll_rate = define_enroll_rate(duration = 18, rate = 1), + fail_rate = define_fail_rate( + duration = 100, + fail_rate = log(2) / 12, + hr = .7, + dropout_rate = .001 + ), + study_duration = 36, + tau = 18 +) +x \%>\% summary() + +# Example 2: given sample size and compute power +x <- fixed_design_rmst( + alpha = .025, + enroll_rate = define_enroll_rate(duration = 18, rate = 20), + fail_rate = define_fail_rate( + duration = 100, + fail_rate = log(2) / 12, + hr = .7, + dropout_rate = .001 + ), + study_duration = 36, + tau = 18 +) +x \%>\% summary() +} diff --git a/man/fixed_design_ahr.Rd b/man/fixed_design_ahr.Rd deleted file mode 100644 index 534cb3ae..00000000 --- a/man/fixed_design_ahr.Rd +++ /dev/null @@ -1,71 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_ahr.R -\name{fixed_design_ahr} -\alias{fixed_design_ahr} -\title{Fixed design using average hazard ratio under non-proportional hazards} -\usage{ -fixed_design_ahr( - enroll_rate, - fail_rate, - alpha = 0.025, - power = NULL, - ratio = 1, - study_duration = 36, - event = NULL -) -} -\arguments{ -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} - -\item{alpha}{One-sided Type I error.} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio (not yet implemented).} - -\item{study_duration}{Study duration.} - -\item{event}{Targeted event at each analysis.} -} -\value{ -A table. -} -\description{ -Computes fixed design sample size (given power) or power (given sample size) -for AHR method. -Returns a list with a basic summary. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_ahr( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_ahr( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36 -) -x \%>\% summary() -} diff --git a/man/fixed_design_fh.Rd b/man/fixed_design_fh.Rd deleted file mode 100644 index 28b41497..00000000 --- a/man/fixed_design_fh.Rd +++ /dev/null @@ -1,76 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_fh.R -\name{fixed_design_fh} -\alias{fixed_design_fh} -\title{Fixed design using Fleming-Harrington method} -\usage{ -fixed_design_fh( - alpha = 0.025, - power = NULL, - ratio = 1, - study_duration = 36, - enroll_rate, - fail_rate, - rho = 0, - gamma = 0 -) -} -\arguments{ -\item{alpha}{One-sided Type I error.} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio (not yet implemented).} - -\item{study_duration}{Study duration.} - -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} - -\item{rho}{test parameter in Fleming-Harrington method.} - -\item{gamma}{test parameter in Fleming-Harrington method.} -} -\value{ -A table. -} -\description{ -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. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_fh( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36, - rho = 1, gamma = 1 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_fh( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36, - rho = 1, gamma = 1 -) -x \%>\% summary() -} diff --git a/man/fixed_design_lf.Rd b/man/fixed_design_lf.Rd deleted file mode 100644 index 1b81a48b..00000000 --- a/man/fixed_design_lf.Rd +++ /dev/null @@ -1,68 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_lf.R -\name{fixed_design_lf} -\alias{fixed_design_lf} -\title{Fixed design using Lachin-Foulkes method} -\usage{ -fixed_design_lf( - alpha = 0.025, - power = NULL, - ratio = 1, - study_duration = 36, - enroll_rate, - fail_rate -) -} -\arguments{ -\item{alpha}{One-sided Type I error (strictly between 0 and 1).} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio.} - -\item{study_duration}{Study duration.} - -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} -} -\value{ -A table. -} -\description{ -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. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_lf( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = 100, - fail_rate = log(2) / 12, - hr = .7, - dropout_rate = .001 - ), - study_duration = 36 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_fh( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = 100, - fail_rate = log(2) / 12, - hr = .7, - dropout_rate = .001 - ), - study_duration = 36 -) -x \%>\% summary() -} diff --git a/man/fixed_design_maxcombo.Rd b/man/fixed_design_maxcombo.Rd deleted file mode 100644 index cde514fc..00000000 --- a/man/fixed_design_maxcombo.Rd +++ /dev/null @@ -1,79 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_maxcombo.R -\name{fixed_design_maxcombo} -\alias{fixed_design_maxcombo} -\title{Fixed design using MaxCombo method} -\usage{ -fixed_design_maxcombo( - alpha = 0.025, - power = NULL, - ratio = 1, - study_duration = 36, - enroll_rate, - fail_rate, - rho = c(0, 0, 1), - gamma = c(0, 1, 0), - tau = rep(-1, 3) -) -} -\arguments{ -\item{alpha}{One-sided Type I error (strictly between 0 and 1).} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio.} - -\item{study_duration}{Study duration.} - -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} - -\item{rho}{A vector of numbers paring with gamma and tau for maxcombo test.} - -\item{gamma}{A vector of numbers paring with rho and tau for maxcombo test.} - -\item{tau}{A vector of numbers paring with gamma and rho for maxcombo test.} -} -\value{ -A table. -} -\description{ -Computes fixed design sample size (given power) or power (given sample size) -for MaxCombo method. -Returns a list with a basic summary. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_maxcombo( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36, - rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1) -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_maxcombo( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36, - rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1) -) -x \%>\% summary() -} diff --git a/man/fixed_design_mb.Rd b/man/fixed_design_mb.Rd deleted file mode 100644 index 0308d65a..00000000 --- a/man/fixed_design_mb.Rd +++ /dev/null @@ -1,73 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_mb.R -\name{fixed_design_mb} -\alias{fixed_design_mb} -\title{Fixed design using Magirr-Burman method} -\usage{ -fixed_design_mb( - alpha = 0.025, - power = NULL, - ratio = 1, - study_duration = 36, - enroll_rate, - fail_rate, - tau = 6 -) -} -\arguments{ -\item{alpha}{One-sided Type I error.} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio.} - -\item{study_duration}{Study duration.} - -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} - -\item{tau}{Test parameter of Magirr-Burman method.} -} -\value{ -A table. -} -\description{ -Computes fixed design sample size (given power) or power (given sample size) -for Magirr-Burman method. -Returns a list with a basic summary. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_mb( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36, - tau = 4 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_mb( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = c(4, 100), - fail_rate = log(2) / 12, - hr = c(1, .6), - dropout_rate = .001 - ), - study_duration = 36, - tau = 4 -) -x \%>\% summary() -} diff --git a/man/fixed_design_milestone.Rd b/man/fixed_design_milestone.Rd deleted file mode 100644 index 22820140..00000000 --- a/man/fixed_design_milestone.Rd +++ /dev/null @@ -1,73 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_milestone.R -\name{fixed_design_milestone} -\alias{fixed_design_milestone} -\title{Fixed design using milestone method} -\usage{ -fixed_design_milestone( - alpha = 0.025, - power = NULL, - ratio = 1, - enroll_rate, - fail_rate, - study_duration = 36, - tau = NULL -) -} -\arguments{ -\item{alpha}{One-sided Type I error (strictly between 0 and 1).} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio.} - -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} - -\item{study_duration}{Study duration.} - -\item{tau}{Test parameter of milestone method.} -} -\value{ -A table. -} -\description{ -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. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_milestone( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = 100, - fail_rate = log(2) / 12, - hr = .7, - dropout_rate = .001 - ), - study_duration = 36, - tau = 18 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_milestone( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = 100, - fail_rate = log(2) / 12, - hr = .7, - dropout_rate = .001 - ), - study_duration = 36, - tau = 18 -) -x \%>\% summary() -} diff --git a/man/fixed_design_rd.Rd b/man/fixed_design_rd.Rd deleted file mode 100644 index 464f3b98..00000000 --- a/man/fixed_design_rd.Rd +++ /dev/null @@ -1,58 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_rd.R -\name{fixed_design_rd} -\alias{fixed_design_rd} -\title{Fixed design for binary outcome measuring in risk difference} -\usage{ -fixed_design_rd( - alpha = 0.025, - power = NULL, - ratio = 1, - p_c, - p_e, - rd0 = 0, - n = NULL -) -} -\arguments{ -\item{alpha}{One-sided Type I error (strictly between 0 and 1).} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio.} - -\item{p_c}{A numerical value of the control arm rate.} - -\item{p_e}{A numerical value of the experimental arm rate.} - -\item{rd0}{Risk difference under null hypothesis, default is 0.} - -\item{n}{Sample size. If NULL with power input, the sample size will be -computed to achieve the targeted power} -} -\value{ -A table. -} -\description{ -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. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_rd( - alpha = 0.025, power = 0.9, p_c = .15, p_e = .1, - rd0 = 0, ratio = 1 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_rd( - alpha = 0.025, power = NULL, p_c = .15, p_e = .1, - rd0 = 0, n = 2000, ratio = 1 -) -x \%>\% summary() -} diff --git a/man/fixed_design_rmst.Rd b/man/fixed_design_rmst.Rd deleted file mode 100644 index 553d1fc4..00000000 --- a/man/fixed_design_rmst.Rd +++ /dev/null @@ -1,73 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fixed_design_rmst.R -\name{fixed_design_rmst} -\alias{fixed_design_rmst} -\title{Fixed design using RMST method} -\usage{ -fixed_design_rmst( - alpha = 0.025, - power = NULL, - ratio = 1, - study_duration = 36, - enroll_rate, - fail_rate, - tau = NULL -) -} -\arguments{ -\item{alpha}{One-sided Type I error (strictly between 0 and 1).} - -\item{power}{Power (\code{NULL} to compute power or strictly between 0 -and \code{1 - alpha} otherwise).} - -\item{ratio}{Experimental:Control randomization ratio.} - -\item{study_duration}{Study duration.} - -\item{enroll_rate}{Enrollment rates.} - -\item{fail_rate}{Failure and dropout rates.} - -\item{tau}{Test parameter in RMST.} -} -\value{ -A table. -} -\description{ -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. -} -\examples{ -library(dplyr) - -# Example 1: given power and compute sample size -x <- fixed_design_rmst( - alpha = .025, power = .9, - enroll_rate = define_enroll_rate(duration = 18, rate = 1), - fail_rate = define_fail_rate( - duration = 100, - fail_rate = log(2) / 12, - hr = .7, - dropout_rate = .001 - ), - study_duration = 36, - tau = 18 -) -x \%>\% summary() - -# Example 2: given sample size and compute power -x <- fixed_design_rmst( - alpha = .025, - enroll_rate = define_enroll_rate(duration = 18, rate = 20), - fail_rate = define_fail_rate( - duration = 100, - fail_rate = log(2) / 12, - hr = .7, - dropout_rate = .001 - ), - study_duration = 36, - tau = 18 -) -x \%>\% summary() -} diff --git a/vignettes/articles/usage-gs-spending-bound.Rmd b/vignettes/articles/story-seven-test-type.Rmd similarity index 100% rename from vignettes/articles/usage-gs-spending-bound.Rmd rename to vignettes/articles/story-seven-test-type.Rmd From 18117f31f2a6bc0e89fc9fd778bbf08ad8c142aa Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Feb 2024 14:38:14 -0500 Subject: [PATCH 2/8] modify .lintr to pass the lintr check for the spending vignette --- .lintr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.lintr b/.lintr index def6353f..d7168226 100644 --- a/.lintr +++ b/.lintr @@ -11,7 +11,7 @@ exclusions: list( "inst/", "tests/testthat/old_function/", - "vignettes/articles/usage-gs-spending-bound.Rmd" = list( + "vignettes/articles/story-seven-test-type.Rmd" = list( object_name_linter = Inf ), "data-raw/simu_test_gs_design_combo.R" = list( From 30b6c6a622f50a2dbad74602bf724630c35b01a7 Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Feb 2024 15:35:32 -0500 Subject: [PATCH 3/8] rename the vignette --- .lintr | 2 +- .../{story-seven-test-type.Rmd => story-seven-test-types.Rmd} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename vignettes/articles/{story-seven-test-type.Rmd => story-seven-test-types.Rmd} (100%) diff --git a/.lintr b/.lintr index d7168226..a7920457 100644 --- a/.lintr +++ b/.lintr @@ -11,7 +11,7 @@ exclusions: list( "inst/", "tests/testthat/old_function/", - "vignettes/articles/story-seven-test-type.Rmd" = list( + "vignettes/articles/story-seven-test-types.Rmd" = list( object_name_linter = Inf ), "data-raw/simu_test_gs_design_combo.R" = list( diff --git a/vignettes/articles/story-seven-test-type.Rmd b/vignettes/articles/story-seven-test-types.Rmd similarity index 100% rename from vignettes/articles/story-seven-test-type.Rmd rename to vignettes/articles/story-seven-test-types.Rmd From 4920f8086b79c116787fcbf2c29638068acc77a7 Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Feb 2024 15:36:06 -0500 Subject: [PATCH 4/8] edit the summary text of fixed design section in the reference page --- R/fixed_design_ahr.R | 5 ++++- man/fixed_design.Rd | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/fixed_design_ahr.R b/R/fixed_design_ahr.R index 9393750a..b4b4cac4 100644 --- a/R/fixed_design_ahr.R +++ b/R/fixed_design_ahr.R @@ -16,7 +16,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' Fixed design using average hazard ratio under non-proportional hazards +#' Fixed design under non-proportional hazards, by multiple tests, +#' such as logrank test, weighted logrank test, modetsly weighted logrank +#' test, MaxCombo test, milestone test, RMST test and risk difference for +#' binary outcome. #' #' Computes fixed design sample size (given power) or power (given sample size) #' for AHR method. diff --git a/man/fixed_design.Rd b/man/fixed_design.Rd index af9d8d71..967c4142 100644 --- a/man/fixed_design.Rd +++ b/man/fixed_design.Rd @@ -11,7 +11,10 @@ \alias{fixed_design_milestone} \alias{fixed_design_rd} \alias{fixed_design_rmst} -\title{Fixed design using average hazard ratio under non-proportional hazards} +\title{Fixed design under non-proportional hazards, by multiple tests, +such as logrank test, weighted logrank test, modetsly weighted logrank +test, MaxCombo test, milestone test, RMST test and risk difference for +binary outcome.} \usage{ fixed_design_ahr( enroll_rate, From 03d07894ec1ef31d8b27e91267137018c169bc5f Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Feb 2024 15:46:29 -0500 Subject: [PATCH 5/8] correct pkgdown.yml --- _pkgdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 61e40928..cd627fbb 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -147,7 +147,7 @@ articles: - articles/story-design-with-spending - articles/story-spending-time-example - articles/story-power-evaluation-with-spending-bound - - articles/story-seven-test-type + - articles/story-seven-test-types - title: "Design by AHR" desc: > From 1c9a01be5364e8aa33fbba807088c6da6f8c5a3e Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Tue, 20 Feb 2024 10:27:52 -0500 Subject: [PATCH 6/8] address Nan's comments --- R/fixed_design_ahr.R | 30 ++++++---- R/fixed_design_fh.R | 15 ++--- R/fixed_design_lf.R | 14 ++--- R/fixed_design_maxcombo.R | 14 ++--- R/fixed_design_mb.R | 14 ++--- R/fixed_design_milestone.R | 14 ++--- R/fixed_design_rd.R | 14 ++--- R/fixed_design_rmst.R | 14 ++--- man/fixed_design.Rd | 112 +++++++++++++++---------------------- 9 files changed, 93 insertions(+), 148 deletions(-) diff --git a/R/fixed_design_ahr.R b/R/fixed_design_ahr.R index b4b4cac4..6511981f 100644 --- a/R/fixed_design_ahr.R +++ b/R/fixed_design_ahr.R @@ -16,14 +16,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' Fixed design under non-proportional hazards, by multiple tests, -#' such as logrank test, weighted logrank test, modetsly weighted logrank -#' test, MaxCombo test, milestone test, RMST test and risk difference for -#' binary outcome. +#' 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. +#' Computes fixed design sample size (given power) +#' or power (given sample size) by either AHR method +#' \code{fixed_design_ahr}, weighted logrank test with +#' Fleming-Harrington weights (Farrington and Manning, 1990) +#' \code{fixed_design_fh}, weighted logrank test with +#' Magirr-Burman weights \code{fixed_design_mb}, +#' Lachin-Foulkes method (Lachin and Foulkes, 1986) +#' \code{fixed_design_lf}, MaxCombo method \code{fixed_design_combo}, +#' RMST method \code{fixed_design_rmst}, or milestone method +#' \code{fixed_design_milestone}. Additionally, we provide the fixed +#' design for binary endpoint with treatment effect measuring in +#' risk difference \code{fixed_design_rd}. #' #' @inheritParams gs_design_ahr #' @inheritParams gs_power_ahr @@ -31,16 +37,14 @@ #' 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 #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # AHR method example 1: given power and compute sample size #' x <- fixed_design_ahr( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -54,7 +58,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # AHR method example 2: given sample size and compute power #' x <- fixed_design_ahr( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -67,6 +71,8 @@ #' study_duration = 36 #' ) #' x %>% summary() +#' +#' # --- fixed_design_ahr <- function( enroll_rate, fail_rate, diff --git a/R/fixed_design_fh.R b/R/fixed_design_fh.R index a2cbb9b4..c90160c4 100644 --- a/R/fixed_design_fh.R +++ b/R/fixed_design_fh.R @@ -16,12 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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 @@ -30,8 +25,6 @@ #' @param rho test parameter in Fleming-Harrington method. #' @param gamma test parameter in Fleming-Harrington method. #' -#' @return A table. -#' #' @importFrom dplyr filter #' #' @export @@ -39,7 +32,7 @@ #' @examples #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # WLR test with FH weights example 1: given power and compute sample size #' x <- fixed_design_fh( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -54,7 +47,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # WLR test with FH weights example 2: given sample size and compute power #' x <- fixed_design_fh( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -68,6 +61,8 @@ #' rho = 1, gamma = 1 #' ) #' x %>% summary() +#' +#' # ---- fixed_design_fh <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_lf.R b/R/fixed_design_lf.R index 13a0fc35..f202268b 100644 --- a/R/fixed_design_lf.R +++ b/R/fixed_design_lf.R @@ -16,12 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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). @@ -29,14 +23,12 @@ #' @param study_duration Study duration. #' @inheritParams gs_design_ahr #' -#' @return A table. -#' #' @export #' @rdname fixed_design #' @examples #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # LF method example 1: given power and compute sample size #' x <- fixed_design_lf( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -50,7 +42,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # LF method example 2: given sample size and compute power #' x <- fixed_design_fh( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -63,6 +55,8 @@ #' study_duration = 36 #' ) #' x %>% summary() +#' +#' # ---- fixed_design_lf <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_maxcombo.R b/R/fixed_design_maxcombo.R index 5ad09e97..eb8e5c77 100644 --- a/R/fixed_design_maxcombo.R +++ b/R/fixed_design_maxcombo.R @@ -16,12 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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). @@ -32,14 +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 #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # Maxcombo test example 1: given power and compute sample size #' x <- fixed_design_maxcombo( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -54,7 +46,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # Maxcombo test example 2: given sample size and compute power #' x <- fixed_design_maxcombo( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -68,6 +60,8 @@ #' rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1) #' ) #' x %>% summary() +#' +#' # ---- fixed_design_maxcombo <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_mb.R b/R/fixed_design_mb.R index 94808c79..21e64e7c 100644 --- a/R/fixed_design_mb.R +++ b/R/fixed_design_mb.R @@ -16,12 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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 @@ -30,14 +24,12 @@ #' @param study_duration Study duration. #' @param tau Test parameter of Magirr-Burman method. #' -#' @return A table. -#' #' @export #' @rdname fixed_design #' @examples #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # WLR test with MB weights example 1: given power and compute sample size #' x <- fixed_design_mb( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -52,7 +44,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # WLR test with MB weights example 2: given sample size and compute power #' x <- fixed_design_mb( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -66,6 +58,8 @@ #' tau = 4 #' ) #' x %>% summary() +#' +#' # ---- fixed_design_mb <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_milestone.R b/R/fixed_design_milestone.R index 850db2a9..38030ba4 100644 --- a/R/fixed_design_milestone.R +++ b/R/fixed_design_milestone.R @@ -16,12 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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 @@ -30,14 +24,12 @@ #' @param study_duration Study duration. #' @param tau Test parameter of milestone method. #' -#' @return A table. -#' #' @export #' @rdname fixed_design #' @examples #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # Milestone method example 1: given power and compute sample size #' x <- fixed_design_milestone( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -52,7 +44,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # Milestone method example 2: given sample size and compute power #' x <- fixed_design_milestone( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -66,6 +58,8 @@ #' tau = 18 #' ) #' x %>% summary() +#' +#' # ---- fixed_design_milestone <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_rd.R b/R/fixed_design_rd.R index b7ed7ef8..2842adf9 100644 --- a/R/fixed_design_rd.R +++ b/R/fixed_design_rd.R @@ -16,12 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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). @@ -32,26 +26,26 @@ #' computed to achieve the targeted power #' @param ratio Experimental:Control randomization ratio. #' -#' @return A table. -#' #' @export #' @rdname fixed_design #' @examples #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # Binary endpoint with risk differences example 1: given power and compute sample size #' x <- fixed_design_rd( #' alpha = 0.025, power = 0.9, p_c = .15, p_e = .1, #' rd0 = 0, ratio = 1 #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # Binary endpoint with risk differences example 2: given sample size and compute power #' x <- fixed_design_rd( #' alpha = 0.025, power = NULL, p_c = .15, p_e = .1, #' rd0 = 0, n = 2000, ratio = 1 #' ) #' x %>% summary() +#' +#' # ---- fixed_design_rd <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_rmst.R b/R/fixed_design_rmst.R index 255dd718..b7c2b5ac 100644 --- a/R/fixed_design_rmst.R +++ b/R/fixed_design_rmst.R @@ -16,12 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' 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 @@ -30,14 +24,12 @@ #' @param study_duration Study duration. #' @param tau Test parameter in RMST. #' -#' @return A table. -#' #' @export #' @rdname fixed_design #' @examples #' library(dplyr) #' -#' # Example 1: given power and compute sample size +#' # RMST method example 1: given power and compute sample size #' x <- fixed_design_rmst( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -52,7 +44,7 @@ #' ) #' x %>% summary() #' -#' # Example 2: given sample size and compute power +#' # RMST method example 2: given sample size and compute power #' x <- fixed_design_rmst( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -66,6 +58,8 @@ #' tau = 18 #' ) #' x %>% summary() +#' +#' # ---- fixed_design_rmst <- function( alpha = 0.025, power = NULL, diff --git a/man/fixed_design.Rd b/man/fixed_design.Rd index 967c4142..99dc5124 100644 --- a/man/fixed_design.Rd +++ b/man/fixed_design.Rd @@ -11,10 +11,7 @@ \alias{fixed_design_milestone} \alias{fixed_design_rd} \alias{fixed_design_rmst} -\title{Fixed design under non-proportional hazards, by multiple tests, -such as logrank test, weighted logrank test, modetsly weighted logrank -test, MaxCombo test, milestone test, RMST test and risk difference for -binary outcome.} +\title{Fixed design under non-proportional hazards.} \usage{ fixed_design_ahr( enroll_rate, @@ -130,59 +127,26 @@ and \code{1 - alpha} otherwise).} computed to achieve the targeted power} } \value{ -A table. - -A table. - -A table. - -A table. - -A table. - -A table. - -A table. - -A table. +A list of design characteristic summary. } \description{ -Computes fixed design sample size (given power) or power (given sample size) -for AHR method. -Returns a list with a basic summary. - -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. - -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. - -Computes fixed design sample size (given power) or power (given sample size) -for MaxCombo method. -Returns a list with a basic summary. - -Computes fixed design sample size (given power) or power (given sample size) -for Magirr-Burman method. -Returns a list with a basic summary. - -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. - -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. - -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. +Computes fixed design sample size (given power) +or power (given sample size) by either AHR method +\code{fixed_design_ahr}, weighted logrank test with +Fleming-Harrington weights (Farrington and Manning, 1990) +\code{fixed_design_fh}, weighted logrank test with +Magirr-Burman weights \code{fixed_design_mb}, +Lachin-Foulkes method (Lachin and Foulkes, 1986) +\code{fixed_design_lf}, MaxCombo method \code{fixed_design_combo}, +RMST method \code{fixed_design_rmst}, milestone method +\code{fixed_design_milestone}. Additionally, we provide the fixed +design for binary endpoint with treatment effect measuring in +risk difference \code{fixed_design_rd}. } \examples{ library(dplyr) -# Example 1: given power and compute sample size +# AHR method example 1: given power and compute sample size x <- fixed_design_ahr( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -196,7 +160,7 @@ x <- fixed_design_ahr( ) x \%>\% summary() -# Example 2: given sample size and compute power +# AHR method example 2: given sample size and compute power x <- fixed_design_ahr( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -209,9 +173,11 @@ x <- fixed_design_ahr( study_duration = 36 ) x \%>\% summary() + +# --- library(dplyr) -# Example 1: given power and compute sample size +# WLR test with FH weights example 1: given power and compute sample size x <- fixed_design_fh( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -226,7 +192,7 @@ x <- fixed_design_fh( ) x \%>\% summary() -# Example 2: given sample size and compute power +# WLR test with FH weights example 2: given sample size and compute power x <- fixed_design_fh( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -240,9 +206,11 @@ x <- fixed_design_fh( rho = 1, gamma = 1 ) x \%>\% summary() + +# ---- library(dplyr) -# Example 1: given power and compute sample size +# LF method example 1: given power and compute sample size x <- fixed_design_lf( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -256,7 +224,7 @@ x <- fixed_design_lf( ) x \%>\% summary() -# Example 2: given sample size and compute power +# LF method example 2: given sample size and compute power x <- fixed_design_fh( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -269,9 +237,11 @@ x <- fixed_design_fh( study_duration = 36 ) x \%>\% summary() + +# ---- library(dplyr) -# Example 1: given power and compute sample size +# Maxcombo test example 1: given power and compute sample size x <- fixed_design_maxcombo( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -286,7 +256,7 @@ x <- fixed_design_maxcombo( ) x \%>\% summary() -# Example 2: given sample size and compute power +# Maxcombo test example 2: given sample size and compute power x <- fixed_design_maxcombo( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -300,9 +270,11 @@ x <- fixed_design_maxcombo( rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1) ) x \%>\% summary() + +# ---- library(dplyr) -# Example 1: given power and compute sample size +# WLR test with MB weights example 1: given power and compute sample size x <- fixed_design_mb( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -317,7 +289,7 @@ x <- fixed_design_mb( ) x \%>\% summary() -# Example 2: given sample size and compute power +# WLR test with MB weights example 2: given sample size and compute power x <- fixed_design_mb( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -331,9 +303,11 @@ x <- fixed_design_mb( tau = 4 ) x \%>\% summary() + +# ---- library(dplyr) -# Example 1: given power and compute sample size +# Milestone method example 1: given power and compute sample size x <- fixed_design_milestone( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -348,7 +322,7 @@ x <- fixed_design_milestone( ) x \%>\% summary() -# Example 2: given sample size and compute power +# Milestone method example 2: given sample size and compute power x <- fixed_design_milestone( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -362,24 +336,28 @@ x <- fixed_design_milestone( tau = 18 ) x \%>\% summary() + +# ---- library(dplyr) -# Example 1: given power and compute sample size +# Binary endpoint with risk differences example 1: given power and compute sample size x <- fixed_design_rd( alpha = 0.025, power = 0.9, p_c = .15, p_e = .1, rd0 = 0, ratio = 1 ) x \%>\% summary() -# Example 2: given sample size and compute power +# Binary endpoint with risk differences example 2: given sample size and compute power x <- fixed_design_rd( alpha = 0.025, power = NULL, p_c = .15, p_e = .1, rd0 = 0, n = 2000, ratio = 1 ) x \%>\% summary() + +# ---- library(dplyr) -# Example 1: given power and compute sample size +# RMST method example 1: given power and compute sample size x <- fixed_design_rmst( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -394,7 +372,7 @@ x <- fixed_design_rmst( ) x \%>\% summary() -# Example 2: given sample size and compute power +# RMST method example 2: given sample size and compute power x <- fixed_design_rmst( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -408,4 +386,6 @@ x <- fixed_design_rmst( tau = 18 ) x \%>\% summary() + +# ---- } From eea069f646ecb92540b501fd4136374926da0091 Mon Sep 17 00:00:00 2001 From: Nan Xiao Date: Thu, 22 Feb 2024 02:31:15 -0500 Subject: [PATCH 7/8] Finetune `fixed_design` documentation format --- R/fixed_design_ahr.R | 36 ++++++++++-------- R/fixed_design_fh.R | 9 +++-- R/fixed_design_lf.R | 8 ++-- R/fixed_design_maxcombo.R | 8 ++-- R/fixed_design_mb.R | 8 ++-- R/fixed_design_milestone.R | 8 ++-- R/fixed_design_rd.R | 8 ++-- R/fixed_design_rmst.R | 9 +++-- man/fixed_design.Rd | 76 +++++++++++++++++++------------------- 9 files changed, 95 insertions(+), 75 deletions(-) diff --git a/R/fixed_design_ahr.R b/R/fixed_design_ahr.R index 6511981f..da4ac754 100644 --- a/R/fixed_design_ahr.R +++ b/R/fixed_design_ahr.R @@ -16,20 +16,22 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -#' Fixed design under non-proportional hazards. +#' Fixed design under non-proportional hazards #' +#' @description #' Computes fixed design sample size (given power) -#' or power (given sample size) by either AHR method -#' \code{fixed_design_ahr}, weighted logrank test with -#' Fleming-Harrington weights (Farrington and Manning, 1990) -#' \code{fixed_design_fh}, weighted logrank test with -#' Magirr-Burman weights \code{fixed_design_mb}, -#' Lachin-Foulkes method (Lachin and Foulkes, 1986) -#' \code{fixed_design_lf}, MaxCombo method \code{fixed_design_combo}, -#' RMST method \code{fixed_design_rmst}, or milestone method -#' \code{fixed_design_milestone}. Additionally, we provide the fixed -#' design for binary endpoint with treatment effect measuring in -#' risk difference \code{fixed_design_rd}. +#' 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_combo()] - 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 @@ -38,13 +40,18 @@ #' @param study_duration Study duration. #' #' @importFrom dplyr filter +#' #' @returns A list of design characteristic summary. +#' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # AHR method ---- #' library(dplyr) #' -#' # AHR method example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_ahr( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -58,7 +65,7 @@ #' ) #' x %>% summary() #' -#' # AHR method example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_ahr( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -72,7 +79,6 @@ #' ) #' x %>% summary() #' -#' # --- fixed_design_ahr <- function( enroll_rate, fail_rate, diff --git a/R/fixed_design_fh.R b/R/fixed_design_fh.R index c90160c4..04ce7538 100644 --- a/R/fixed_design_fh.R +++ b/R/fixed_design_fh.R @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - #' @inheritParams gs_design_wlr #' @inheritParams gs_power_wlr #' @param power Power (`NULL` to compute power or strictly between 0 @@ -28,11 +27,14 @@ #' @importFrom dplyr filter #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # WLR test with FH weights ---- #' library(dplyr) #' -#' # WLR test with FH weights example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_fh( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -47,7 +49,7 @@ #' ) #' x %>% summary() #' -#' # WLR test with FH weights example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_fh( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -62,7 +64,6 @@ #' ) #' x %>% summary() #' -#' # ---- fixed_design_fh <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_lf.R b/R/fixed_design_lf.R index f202268b..23a13240 100644 --- a/R/fixed_design_lf.R +++ b/R/fixed_design_lf.R @@ -24,11 +24,14 @@ #' @inheritParams gs_design_ahr #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # LF method ---- #' library(dplyr) #' -#' # LF method example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_lf( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -42,7 +45,7 @@ #' ) #' x %>% summary() #' -#' # LF method example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_fh( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -56,7 +59,6 @@ #' ) #' x %>% summary() #' -#' # ---- fixed_design_lf <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_maxcombo.R b/R/fixed_design_maxcombo.R index eb8e5c77..197c305f 100644 --- a/R/fixed_design_maxcombo.R +++ b/R/fixed_design_maxcombo.R @@ -27,11 +27,14 @@ #' @inheritParams gs_design_combo #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # MaxCombo test ---- #' library(dplyr) #' -#' # Maxcombo test example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_maxcombo( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -46,7 +49,7 @@ #' ) #' x %>% summary() #' -#' # Maxcombo test example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_maxcombo( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -61,7 +64,6 @@ #' ) #' x %>% summary() #' -#' # ---- fixed_design_maxcombo <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_mb.R b/R/fixed_design_mb.R index 21e64e7c..db90d001 100644 --- a/R/fixed_design_mb.R +++ b/R/fixed_design_mb.R @@ -25,11 +25,14 @@ #' @param tau Test parameter of Magirr-Burman method. #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # WLR test with MB weights ---- #' library(dplyr) #' -#' # WLR test with MB weights example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_mb( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -44,7 +47,7 @@ #' ) #' x %>% summary() #' -#' # WLR test with MB weights example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_mb( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -59,7 +62,6 @@ #' ) #' x %>% summary() #' -#' # ---- fixed_design_mb <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_milestone.R b/R/fixed_design_milestone.R index 38030ba4..263ed627 100644 --- a/R/fixed_design_milestone.R +++ b/R/fixed_design_milestone.R @@ -25,11 +25,14 @@ #' @param tau Test parameter of milestone method. #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # Milestone method ---- #' library(dplyr) #' -#' # Milestone method example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_milestone( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -44,7 +47,7 @@ #' ) #' x %>% summary() #' -#' # Milestone method example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_milestone( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -59,7 +62,6 @@ #' ) #' x %>% summary() #' -#' # ---- fixed_design_milestone <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_rd.R b/R/fixed_design_rd.R index 2842adf9..0048c30f 100644 --- a/R/fixed_design_rd.R +++ b/R/fixed_design_rd.R @@ -27,25 +27,27 @@ #' @param ratio Experimental:Control randomization ratio. #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # Binary endpoint with risk differences ---- #' library(dplyr) #' -#' # Binary endpoint with risk differences example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_rd( #' alpha = 0.025, power = 0.9, p_c = .15, p_e = .1, #' rd0 = 0, ratio = 1 #' ) #' x %>% summary() #' -#' # Binary endpoint with risk differences example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_rd( #' alpha = 0.025, power = NULL, p_c = .15, p_e = .1, #' rd0 = 0, n = 2000, ratio = 1 #' ) #' x %>% summary() #' -#' # ---- fixed_design_rd <- function( alpha = 0.025, power = NULL, diff --git a/R/fixed_design_rmst.R b/R/fixed_design_rmst.R index b7c2b5ac..d0d3070a 100644 --- a/R/fixed_design_rmst.R +++ b/R/fixed_design_rmst.R @@ -25,11 +25,14 @@ #' @param tau Test parameter in RMST. #' #' @export +#' #' @rdname fixed_design +#' #' @examples +#' # RMST method ---- #' library(dplyr) #' -#' # RMST method example 1: given power and compute sample size +#' # Example 1: given power and compute sample size #' x <- fixed_design_rmst( #' alpha = .025, power = .9, #' enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -44,7 +47,7 @@ #' ) #' x %>% summary() #' -#' # RMST method example 2: given sample size and compute power +#' # Example 2: given sample size and compute power #' x <- fixed_design_rmst( #' alpha = .025, #' enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -58,8 +61,6 @@ #' tau = 18 #' ) #' x %>% summary() -#' -#' # ---- fixed_design_rmst <- function( alpha = 0.025, power = NULL, diff --git a/man/fixed_design.Rd b/man/fixed_design.Rd index 99dc5124..3fa620e9 100644 --- a/man/fixed_design.Rd +++ b/man/fixed_design.Rd @@ -11,7 +11,7 @@ \alias{fixed_design_milestone} \alias{fixed_design_rd} \alias{fixed_design_rmst} -\title{Fixed design under non-proportional hazards.} +\title{Fixed design under non-proportional hazards} \usage{ fixed_design_ahr( enroll_rate, @@ -131,22 +131,26 @@ A list of design characteristic summary. } \description{ Computes fixed design sample size (given power) -or power (given sample size) by either AHR method -\code{fixed_design_ahr}, weighted logrank test with -Fleming-Harrington weights (Farrington and Manning, 1990) -\code{fixed_design_fh}, weighted logrank test with -Magirr-Burman weights \code{fixed_design_mb}, -Lachin-Foulkes method (Lachin and Foulkes, 1986) -\code{fixed_design_lf}, MaxCombo method \code{fixed_design_combo}, -RMST method \code{fixed_design_rmst}, milestone method -\code{fixed_design_milestone}. Additionally, we provide the fixed -design for binary endpoint with treatment effect measuring in -risk difference \code{fixed_design_rd}. +or power (given sample size) by: +\itemize{ +\item \code{\link[=fixed_design_ahr]{fixed_design_ahr()}} - Average hazard ratio method. +\item \code{\link[=fixed_design_fh]{fixed_design_fh()}} - Weighted logrank test with Fleming-Harrington +weights (Farrington and Manning, 1990). +\item \code{\link[=fixed_design_mb]{fixed_design_mb()}} - Weighted logrank test with Magirr-Burman weights. +\item \code{\link[=fixed_design_lf]{fixed_design_lf()}} - Lachin-Foulkes method (Lachin and Foulkes, 1986). +\item \code{\link[=fixed_design_combo]{fixed_design_combo()}} - MaxCombo method. +\item \code{\link[=fixed_design_rmst]{fixed_design_rmst()}} - RMST method. +\item \code{\link[=fixed_design_milestone]{fixed_design_milestone()}} - Milestone method. +} + +Additionally, \code{\link[=fixed_design_rd]{fixed_design_rd()}} provides fixed design for binary endpoint +with treatment effect measuring in risk difference. } \examples{ +# AHR method ---- library(dplyr) -# AHR method example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_ahr( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -160,7 +164,7 @@ x <- fixed_design_ahr( ) x \%>\% summary() -# AHR method example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_ahr( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -174,10 +178,10 @@ x <- fixed_design_ahr( ) x \%>\% summary() -# --- +# WLR test with FH weights ---- library(dplyr) -# WLR test with FH weights example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_fh( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -192,7 +196,7 @@ x <- fixed_design_fh( ) x \%>\% summary() -# WLR test with FH weights example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_fh( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -207,10 +211,10 @@ x <- fixed_design_fh( ) x \%>\% summary() -# ---- +# LF method ---- library(dplyr) -# LF method example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_lf( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -224,7 +228,7 @@ x <- fixed_design_lf( ) x \%>\% summary() -# LF method example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_fh( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -238,10 +242,10 @@ x <- fixed_design_fh( ) x \%>\% summary() -# ---- +# MaxCombo test ---- library(dplyr) -# Maxcombo test example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_maxcombo( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -256,7 +260,7 @@ x <- fixed_design_maxcombo( ) x \%>\% summary() -# Maxcombo test example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_maxcombo( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -271,10 +275,10 @@ x <- fixed_design_maxcombo( ) x \%>\% summary() -# ---- +# WLR test with MB weights ---- library(dplyr) -# WLR test with MB weights example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_mb( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -289,7 +293,7 @@ x <- fixed_design_mb( ) x \%>\% summary() -# WLR test with MB weights example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_mb( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -304,10 +308,10 @@ x <- fixed_design_mb( ) x \%>\% summary() -# ---- +# Milestone method ---- library(dplyr) -# Milestone method example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_milestone( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -322,7 +326,7 @@ x <- fixed_design_milestone( ) x \%>\% summary() -# Milestone method example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_milestone( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -337,27 +341,27 @@ x <- fixed_design_milestone( ) x \%>\% summary() -# ---- +# Binary endpoint with risk differences ---- library(dplyr) -# Binary endpoint with risk differences example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_rd( alpha = 0.025, power = 0.9, p_c = .15, p_e = .1, rd0 = 0, ratio = 1 ) x \%>\% summary() -# Binary endpoint with risk differences example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_rd( alpha = 0.025, power = NULL, p_c = .15, p_e = .1, rd0 = 0, n = 2000, ratio = 1 ) x \%>\% summary() -# ---- +# RMST method ---- library(dplyr) -# RMST method example 1: given power and compute sample size +# Example 1: given power and compute sample size x <- fixed_design_rmst( alpha = .025, power = .9, enroll_rate = define_enroll_rate(duration = 18, rate = 1), @@ -372,7 +376,7 @@ x <- fixed_design_rmst( ) x \%>\% summary() -# RMST method example 2: given sample size and compute power +# Example 2: given sample size and compute power x <- fixed_design_rmst( alpha = .025, enroll_rate = define_enroll_rate(duration = 18, rate = 20), @@ -386,6 +390,4 @@ x <- fixed_design_rmst( tau = 18 ) x \%>\% summary() - -# ---- } From ac3131ef12285d6467135cd31714d195c230811d Mon Sep 17 00:00:00 2001 From: Nan Xiao Date: Thu, 22 Feb 2024 02:35:43 -0500 Subject: [PATCH 8/8] Fix function name link --- R/fixed_design_ahr.R | 2 +- man/fixed_design.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/fixed_design_ahr.R b/R/fixed_design_ahr.R index da4ac754..e1b1eb1b 100644 --- a/R/fixed_design_ahr.R +++ b/R/fixed_design_ahr.R @@ -26,7 +26,7 @@ #' 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_combo()] - MaxCombo method. +#' - [fixed_design_maxcombo()] - MaxCombo method. #' - [fixed_design_rmst()] - RMST method. #' - [fixed_design_milestone()] - Milestone method. #' diff --git a/man/fixed_design.Rd b/man/fixed_design.Rd index 3fa620e9..4b773ff5 100644 --- a/man/fixed_design.Rd +++ b/man/fixed_design.Rd @@ -138,7 +138,7 @@ or power (given sample size) by: weights (Farrington and Manning, 1990). \item \code{\link[=fixed_design_mb]{fixed_design_mb()}} - Weighted logrank test with Magirr-Burman weights. \item \code{\link[=fixed_design_lf]{fixed_design_lf()}} - Lachin-Foulkes method (Lachin and Foulkes, 1986). -\item \code{\link[=fixed_design_combo]{fixed_design_combo()}} - MaxCombo method. +\item \code{\link[=fixed_design_maxcombo]{fixed_design_maxcombo()}} - MaxCombo method. \item \code{\link[=fixed_design_rmst]{fixed_design_rmst()}} - RMST method. \item \code{\link[=fixed_design_milestone]{fixed_design_milestone()}} - Milestone method. }