Skip to content

Commit

Permalink
Apply styler:::style_active_pkg()
Browse files Browse the repository at this point in the history
  • Loading branch information
jdblischak committed May 6, 2024
1 parent 73b29d1 commit 0b03e6c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
3 changes: 1 addition & 2 deletions R/milestone.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#' cut_data |>
#' milestone(10, test_type = "naive")
milestone <- function(data, ms_time, test_type = c("log-log", "naive")) {

test_type <- match.arg(test_type)

# Fit into KM curves
Expand Down Expand Up @@ -83,7 +82,7 @@ milestone <- function(data, ms_time, test_type = c("log-log", "naive")) {
if (na_ctrl + na_exp == 2) {
z <- -Inf
} else {
if (test_type == "naive"){
if (test_type == "naive") {
z_numerator <- surv_diff
z_denominator <- surv_exp * sqrt(sigma2_exp) + surv_ctrl * sqrt(sigma2_ctrl)
} else if (test_type == "log-log") {
Expand Down
20 changes: 13 additions & 7 deletions R/sim_gs_n.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,19 @@
#' # Example 8: At IA1, we conduct 3 tests, LR, WLR with fh(0, 0.5), and RMST test.
#' # At IA2, we conduct 2 tests, LR and WLR with early zero (6).
#' # At FA, we conduct 2 tests, LR and milestone test.
#' ia1_test <- list(test1 = create_test(wlr, weight = fh(rho = 0, gamma = 0)),
#' test2 = create_test(wlr, weight = fh(rho = 0, gamma = 0.5)),
#' test3 = create_test(rmst, tau = 20))
#' ia2_test <- list(test1 = create_test(wlr, weight = fh(rho = 0, gamma = 0)),
#' test2 = create_test(wlr, weight = early_zero(6)))
#' fa_test <- list(test1 = create_test(wlr, weight = fh(rho = 0, gamma = 0)),
#' test3 = create_test(milestone, ms_time = 20))
#' ia1_test <- list(
#' test1 = create_test(wlr, weight = fh(rho = 0, gamma = 0)),
#' test2 = create_test(wlr, weight = fh(rho = 0, gamma = 0.5)),
#' test3 = create_test(rmst, tau = 20)
#' )
#' ia2_test <- list(
#' test1 = create_test(wlr, weight = fh(rho = 0, gamma = 0)),
#' test2 = create_test(wlr, weight = early_zero(6))
#' )
#' fa_test <- list(
#' test1 = create_test(wlr, weight = fh(rho = 0, gamma = 0)),
#' test3 = create_test(milestone, ms_time = 20)
#' )
#' \dontrun{
#' sim_gs_n(
#' n_sim = 3,
Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/test-unvalidated-sim_gs_n.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ test_that("WLR with fh(0, 0.5) test at IA1, WLR with mb(6, Inf) at IA2, and mile
fa_test <- create_test(milestone, ms_time = 10, test_type = "naive")

observed <- sim_gs_n(
n_sim = 3,
sample_size = 400,
enroll_rate = test_enroll_rate(),
fail_rate = test_fail_rate(),
test = list(ia1 = ia1_test, ia2 = ia2_test, fa = fa_test),
cut = test_cutting(),
seed = 2024
n_sim = 3,
sample_size = 400,
enroll_rate = test_enroll_rate(),
fail_rate = test_fail_rate(),
test = list(ia1 = ia1_test, ia2 = ia2_test, fa = fa_test),
cut = test_cutting(),
seed = 2024
)
expected <- data.frame(
sim_id = rep(1:3, each = 3L),
Expand Down

0 comments on commit 0b03e6c

Please sign in to comment.