Skip to content

Commit

Permalink
update document and example
Browse files Browse the repository at this point in the history
  • Loading branch information
elong0527 committed Jan 12, 2024
1 parent 21c623e commit 2485da1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
27 changes: 19 additions & 8 deletions R/define.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@

#' Define enrollment rate
#'
#' The function define subject enrollment rate for a study.
#' It also supports stratified design that have different enrollment rate in
#' each stratum.
#' 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}.
#' 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.
#'
#' @param duration A numeric vector of piecewise study duration interval.
#' @param duration A numeric vector of ordered piecewise study duration interval.
#' @param rate A numeric vector of enrollment rate in each `duration`.
#' @param stratum A character vector of stratum name.
#'
Expand All @@ -39,10 +42,11 @@
#'
#' # Define enroll rate with stratum
#' define_enroll_rate(
#' stratum = c("low", "low", "high"),
#' duration = c(2, 2, 10),
#' rate = c(3, 6, 9)
#' duration = rep(c(2, 2, 2, 18), 3),
#' 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,8 +88,15 @@ define_enroll_rate <- function(
#' It also supports stratified design 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.
#'
#' 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 piecewise study duration interval.
#' @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.
Expand Down
19 changes: 12 additions & 7 deletions man/define_enroll_rate.Rd

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

11 changes: 10 additions & 1 deletion 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 2485da1

Please sign in to comment.