Skip to content

Commit

Permalink
Add library in early_zero_weight testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenjuan Zhang committed Apr 26, 2024
1 parent f0933fd commit dec0504
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/testthat/test-independent_test_early_zero_weight.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
library(dplyr)
library(gsDesign2)
library(tibble)


test_that("early_zero_weight() with unstratified data", {
set.seed(123456)
early_period = 2
Expand Down Expand Up @@ -25,7 +30,7 @@ test_that("early_zero_weight() with stratified data when fail_rate is not provid
duration = c(2, 10, 2, 10),
rate = c(c(1, 4) * prevalence_ratio[1], c(1, 4) * prevalence_ratio[2])
)
enroll_rate$rate <- enroll_rate$rate * n / sum(enroll_rate$duration * enroll_rate$rate) #??
enroll_rate$rate <- enroll_rate$rate * n / sum(enroll_rate$duration * enroll_rate$rate)
# Failure rate
med_pos <- 10 # Median of the biomarker positive population
med_neg <- 8 # Median of the biomarker negative population
Expand Down Expand Up @@ -68,7 +73,7 @@ test_that("early_zero_weight() with stratified data when fail_rate is not correc
duration = c(2, 10, 2, 10),
rate = c(c(1, 4) * prevalence_ratio[1], c(1, 4) * prevalence_ratio[2])
)
enroll_rate$rate <- enroll_rate$rate * n / sum(enroll_rate$duration * enroll_rate$rate) #??
enroll_rate$rate <- enroll_rate$rate * n / sum(enroll_rate$duration * enroll_rate$rate)
# Failure rate
med_pos <- 10 # Median of the biomarker positive population
med_neg <- 8 # Median of the biomarker negative population
Expand Down Expand Up @@ -118,7 +123,7 @@ test_that("early_zero_weight() with stratified data when fail_rate is correctly
duration = c(2, 10, 2, 10),
rate = c(c(1, 4) * prevalence_ratio[1], c(1, 4) * prevalence_ratio[2])
)
enroll_rate$rate <- enroll_rate$rate * n / sum(enroll_rate$duration * enroll_rate$rate) #??
enroll_rate$rate <- enroll_rate$rate * n / sum(enroll_rate$duration * enroll_rate$rate)
# Failure rate
med_pos <- 10 # Median of the biomarker positive population
med_neg <- 8 # Median of the biomarker negative population
Expand Down

0 comments on commit dec0504

Please sign in to comment.