Skip to content

Commit

Permalink
Move details into @details and improve formula
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Jan 12, 2024
1 parent 2485da1 commit 9ca5578
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
34 changes: 20 additions & 14 deletions R/define.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@

#' Define enrollment rate
#'
#' Define the enrollment rate of subjects for a study as following a piecewise exponential distribution.
#' The `duration` are ordered piecewise for a duration equal to \eqn{t_i - t_{i-1}}.
#' where \eqn{0=t_0<t_i\ldots,t_M=\infty}.
#' Define the enrollment rate of subjects for a study as following a piecewise
#' exponential distribution.
#'
#' @details
#' The `duration` are ordered piecewise for a duration equal to
#' \eqn{t_i - t_{i-1}}, where \eqn{0 = t_0 < t_i < \cdots < t_M = \infty}.
#' The enrollment rates are defined in each duration with the same length.
#'
#' For a study with multiple strata, different duration and rate can be specified in each stratum.
#' For a study with multiple strata, different duration and rate can be
#' specified in each stratum.
#'
#' @param duration A numeric vector of ordered piecewise study duration interval.
#' @param rate A numeric vector of enrollment rate in each `duration`.
Expand All @@ -46,7 +50,6 @@
#' rate = c((1:4) / 3, (1:4) / 2, (1:4) / 6),
#' stratum = c(array("High", 4), array("Moderate", 4), array("Low", 4))
#' )
#'
define_enroll_rate <- function(
duration,
rate,
Expand Down Expand Up @@ -84,22 +87,25 @@ define_enroll_rate <- function(

#' Define failure rate
#'
#' The function define subject failure rate for a study with two treatment groups.
#' It also supports stratified design that have different failure rate in
#' Define subject failure rate for a study with two treatment groups.
#' Also supports stratified designs that have different failure rate in
#' each stratum.
#'
#' Define the failure and dropout rate of subjects for a study as following a piecewise exponential distribution.
#' The `duration` are ordered piecewise for a duration equal to \eqn{t_i - t_{i-1}}.
#' where \eqn{0=t_0<t_i\ldots,t_M=\infty}.
#' The failure rate, dropout rate, and hazard ratio in a study duration can be specified.
#' @details
#' Define the failure and dropout rate of subjects for a study as following
#' a piecewise exponential distribution.
#' The `duration` are ordered piecewise for a duration equal to
#' \eqn{t_i - t_{i-1}}, where \eqn{0 = t_0 < t_i < \cdots < t_M = \infty}.
#' The failure rate, dropout rate, and hazard ratio in a study duration
#' can be specified.
#'
#' For a study with multiple strata,
#' different duration, failure rate, dropout rate and hazard ratio can be specified in each stratum.
#' For a study with multiple strata, different duration, failure rate,
#' dropout rate, and hazard ratio can be specified in each stratum.
#'
#' @param duration A numeric vector of ordered piecewise study duration interval.
#' @param fail_rate A numeric vector of failure rate in each `duration` in the control group.
#' @param dropout_rate A numeric vector of dropout rate in each `duration`.
#' @param hr A numeric vector of hazard ratio between case and control group.
#' @param hr A numeric vector of hazard ratio between treatment and control group.
#' @param stratum A character vector of stratum name.
#'
#' @return A `fail_rate` data frame.
Expand Down
14 changes: 8 additions & 6 deletions man/define_enroll_rate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions man/define_fail_rate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ca5578

Please sign in to comment.