-
Notifications
You must be signed in to change notification settings - Fork 8
Add the h1_spending
argument to gs_power_wlr
#561
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,7 @@ gs_power_wlr <- function(enroll_rate = define_enroll_rate(duration = c(2, 2, 10) | |
event = c(30, 40, 50), | ||
analysis_time = NULL, | ||
binding = FALSE, | ||
h1_spending = TRUE, | ||
upper = gs_spending_bound, | ||
lower = gs_spending_bound, | ||
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025), | ||
|
@@ -208,12 +209,21 @@ gs_power_wlr <- function(enroll_rate = define_enroll_rate(duration = c(2, 2, 10) | |
interval = interval | ||
) | ||
|
||
# set up H1 spending | ||
if (h1_spending) { | ||
theta1 <- x$theta | ||
info1 <- x$info | ||
} else { | ||
theta1 <- 0 | ||
info1 <- x$info0 | ||
} | ||
|
||
# Given the above statistical information calculate the power ---- | ||
y_h1 <- gs_power_npe( | ||
theta = x$theta, | ||
theta = x$theta, theta0 = 0, theta1 = theta1, | ||
info = x$info, | ||
info0 = x$info0, | ||
info1 = x$info, | ||
info1 = info1, | ||
info_scale = info_scale, | ||
binding = binding, | ||
upper = upper, | ||
|
@@ -227,12 +237,10 @@ gs_power_wlr <- function(enroll_rate = define_enroll_rate(duration = c(2, 2, 10) | |
) | ||
|
||
y_h0 <- gs_power_npe( | ||
theta = 0, | ||
theta0 = 0, | ||
theta1 = x$theta, | ||
theta = 0, theta0 = 0, theta1 = theta1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto above comment |
||
info = x$info0, | ||
info0 = x$info0, | ||
info1 = x$info, | ||
info1 = info1, | ||
info_scale = info_scale, | ||
binding = binding, | ||
upper = upper, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
test_that("Validate 2-sided symetric design", { | ||
x <- gs_power_wlr(enroll_rate = define_enroll_rate(duration = 12, rate = 50), | ||
analysis_time = NULL, event = c(100, 200, 300), | ||
upper = gs_spending_bound, | ||
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025), | ||
lower = gs_spending_bound, | ||
lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.025), | ||
binding = TRUE, h1_spending = FALSE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love the test! For completeness, would it also make sense to have a test with |
||
|
||
expect_equal(x$bound$z[x$bound$bound == "upper"], | ||
-x$bound$z[x$bound$bound == "lower"]) | ||
|
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all the other arguments are on their own line, I recommend keeping this consistent with the surrounding code and moving
theta0
andtheta1
to new lines