Skip to content

Commit

Permalink
Merge pull request #286 from jdblischak/fix-sign-z
Browse files Browse the repository at this point in the history
Fix sign of z when passing explicit design to summary.simtrial_gs_wlr()
  • Loading branch information
LittleBeannie authored Sep 25, 2024
2 parents 58db5df + aadeadb commit 2ee0250
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down
6 changes: 3 additions & 3 deletions R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
)
}

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-unvalidated-summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 2ee0250

Please sign in to comment.