S3 methods for lt() that convert fixed or group sequential design
summaries into formatted lt tables.
Usage
# S3 method for class 'fixed_design_summary'
lt(data, title = NULL, footnote = NULL, ...)
# S3 method for class 'gs_design_summary'
lt(
data,
title = NULL,
subtitle = NULL,
colname_spanner = "Cumulative boundary crossing probability",
colname_spannersub = c("Alternate hypothesis", "Null hypothesis"),
footnote = NULL,
display_bound = c("Efficacy", "Futility", "Harm"),
display_columns = NULL,
display_inf_bound = FALSE,
...
)Arguments
- data
A summary object of a fixed or group sequential design.
- title
A string to specify the title of the table.
- footnote
A list containing
content,location, andattr.contentis a vector of string to specify the footnote text;locationis a vector of string to specify the locations to put the superscript of the footnote index;attris a vector of string to specify the attributes of the footnotes, for example,c("colname", "title", "subtitle", "analysis", "spanner"). To disable footnotes, usefootnote = FALSE.- ...
Additional arguments (not used).
- subtitle
A string to specify the subtitle of the table.
- colname_spanner
A string to specify the spanner of the table.
- colname_spannersub
A vector of strings to specify the spanner details of the table.
- display_bound
A vector of strings specifying the label of the bounds. The default is
c("Efficacy", "Futility", "Harm").- display_columns
A vector of strings specifying the variables to be displayed in the summary table.
- display_inf_bound
Logical, whether to display the +/-inf bound.
Examples
# Fixed design examples ----
# Enrollment rate
enroll_rate <- define_enroll_rate(
duration = 18,
rate = 20
)
# Failure rates
fail_rate <- define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
dropout_rate = .001,
hr = c(1, .6)
)
# Study duration in months
study_duration <- 36
# Experimental / Control randomization ratio
ratio <- 1
# 1-sided Type I error
alpha <- 0.025
# Type II error (1 - power)
beta <- 0.1
# Example 1 ----
fixed_design_ahr(
alpha = alpha, power = 1 - beta,
enroll_rate = enroll_rate, fail_rate = fail_rate,
study_duration = study_duration, ratio = ratio
) |>
summary() |>
lt()
# Example 2 ----
fixed_design_fh(
alpha = alpha, power = 1 - beta,
enroll_rate = enroll_rate, fail_rate = fail_rate,
study_duration = study_duration, ratio = ratio
) |>
summary() |>
lt()
# \donttest{
# Group sequential design examples ---
# Example 1 ----
# The default output
gs_design_ahr() |>
summary() |>
lt()
gs_power_ahr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt()
gs_design_wlr() |>
summary() |>
lt()
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt()
gs_power_combo() |>
summary() |>
lt()
gs_design_rd() |>
summary() |>
lt()
gs_power_rd() |>
summary() |>
lt()
# Example 2 ----
# Usage of title = ..., subtitle = ...
# to edit the title/subtitle
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt(
title = "Bound Summary",
subtitle = "from gs_power_wlr"
)
# Example 3 ----
# Usage of colname_spanner = ..., colname_spannersub = ...
# to edit the spanner and its sub-spanner
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt(
colname_spanner = "Cumulative probability to cross boundaries",
colname_spannersub = c("under H1", "under H0")
)
# Example 4 ----
# Usage of footnote = ...
# to edit the footnote
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt(
footnote = list(
content = c(
"approximate weighted hazard ratio to cross bound.",
"wAHR is the weighted AHR.",
"the crossing probability.",
"this table is generated by gs_power_wlr."
),
location = c("~wHR at bound", NA, NA, NA),
attr = c("colname", "analysis", "spanner", "title")
)
)
# Example 5 ----
# Usage of display_bound = ...
# to either show efficacy bound or futility bound, or both(default)
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt(display_bound = "Efficacy")
# Example 6 ----
# Usage of display_columns = ...
# to select the columns to display in the summary table
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
summary() |>
lt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability"))
# }
