Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to confirm that wlr() uses new argument ratio #285

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/testthat/test-unvalidated-wlr.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ test_that("wlr() rejects input object without proper class", {
x <- mtcars
expect_error(wlr(x), "no applicable method")
})

test_that("wlr() uses argument ratio", {
x <- data.frame(treatment = ifelse(ex1_delayed_effect$trt == 1, "experimental", "control"),
stratum = rep("All", nrow(ex1_delayed_effect)),
tte = ex1_delayed_effect$month,
event = ex1_delayed_effect$evntd)
class(x) <- c("tte_data", class(x))
wlr_w_ratio <- x |> wlr(weight = fh(rho = 0, gamma = 0.5), ratio = 2)
wlr_wo_ratio <- x |> wlr(weight = fh(rho = 0, gamma = 0.5))
expect_false(isTRUE(all.equal(wlr_w_ratio, wlr_wo_ratio)))
})