Skip to content

Commit

Permalink
Merge pull request Merck#233 from Merck/232-early_zero_weight-for-str…
Browse files Browse the repository at this point in the history
…atified-design

hr -> log(hr)
  • Loading branch information
LittleBeannie authored Apr 25, 2024
2 parents 5cdb5c5 + 1d013fa commit 182e51f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/early_zero_weight.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ early_zero_weight <- function(x, early_period = 4, fail_rate = NULL) {

ans <- merge.data.table(ans, late_hr, by = "stratum", all.x = TRUE)
ans <- merge.data.table(ans, delay_change_time, by = "stratum", all.x = TRUE)
ans[, weight := fifelse(tte < duration, 0, hr)]
ans[, weight := fifelse(tte < duration, 0, log(hr))]
}

setDF(ans)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-unvalidated-early_zero_weight.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test_that("early_zero_weight() with stratified data", {
output <- early_zero_weight(input, early_period = 2, fail_rate = fail_rate)

observed <- output$weight
expected <- rep(c(0, 0.8, 0, 0.7), c(43L, 20L, 29L, 33L))
expected <- rep(c(0, log(0.8), 0, log(0.7)), c(43L, 20L, 29L, 33L))
expect_equal(observed, expected)
})

Expand Down

0 comments on commit 182e51f

Please sign in to comment.