diff --git a/DESCRIPTION b/DESCRIPTION index 7171daaf..8b8216c2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: simtrial Type: Package Title: Clinical Trial Simulation -Version: 0.4.1.11 +Version: 0.4.1.12 Authors@R: c( person("Keaven", "Anderson", email = "keaven_anderson@merck.com", role = c("aut")), person("Yujie", "Zhao", email = "yujie.zhao@merck.com", role = c("ctb","cre")), diff --git a/R/summary.R b/R/summary.R index ce685151..e71a3be1 100644 --- a/R/summary.R +++ b/R/summary.R @@ -131,7 +131,7 @@ summary.simtrial_gs_wlr <- function(object, dplyr::select(analysis, z, bound) |> dplyr::rename(upper_bound = z) ) |> - dplyr::mutate(cross_upper = -z >= upper_bound) + dplyr::mutate(cross_upper = z >= upper_bound) ) } else { suppressMessages( @@ -142,8 +142,8 @@ summary.simtrial_gs_wlr <- function(object, tidyr::pivot_wider(values_from = z, names_from = bound) |> dplyr::rename(lower_bound = lower, upper_bound = upper) ) |> - dplyr::mutate(cross_lower = -z <= lower_bound, - cross_upper = -z >= upper_bound) + dplyr::mutate(cross_lower = z <= lower_bound, + cross_upper = z >= upper_bound) ) } diff --git a/tests/testthat/test-unvalidated-summary.R b/tests/testthat/test-unvalidated-summary.R index d637e5a7..77225db7 100644 --- a/tests/testthat/test-unvalidated-summary.R +++ b/tests/testthat/test-unvalidated-summary.R @@ -73,7 +73,7 @@ test_that("summary.simtrial_gs_wlr() returns consistent results for one-sided de expected <- data.frame( analysis = c(1, 2, 3), asy_upper_prob = c(0.00014865936645545522, 0.5723215057363614, 0.9000000002116888), - sim_upper_prob = rep(NA_real_, 3L), + sim_upper_prob = c(NA, 1, NA), sim_event = c(97, 305, 405), sim_n = c(369.3333333333333, 505, 505), sim_time = c(12.877359569828519, 24.990283397668506, 37.20491262038222), @@ -164,8 +164,8 @@ test_that("summary.simtrial_gs_wlr() returns consistent results for two-sided de analysis = c(1, 2, 3), asy_upper_prob = c(0.00016250401737420353, 0.6011019363189855, 0.9000000001924918), asy_lower_prob = c(0.0007883883873094952, 0.05707064419933058, 0.10004018006137042), - sim_upper_prob = rep(NA_real_, 3L), - sim_lower_prob = c(NA, 1, NA), + sim_upper_prob = c(NA, 0.6666666666666666, 1), + sim_lower_prob = rep(NA_real_, 3L), sim_event = c(103, 323, 429), sim_n = c(366.6666666666667, 535, 535), sim_time = c(12.363838412468121, 24.374413483785986, 36.116791896100885),