Skip to content

Commit 7c8e218

Browse files
committed
update gs_power_ahr to elaborate the info0 and info when both sample size and events are integers
1 parent 65356f8 commit 7c8e218

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

R/gs_power_ahr.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,20 @@ gs_power_ahr <- function(
197197
interval = interval
198198
)
199199

200+
# if both events and sample size are integers, then elaborate the info and info0
201+
sample_size <- sum(enroll_rate$duration * enroll_rate$rate)
202+
if (abs(sample_size - round(sample_size)) < 1e-5 && all(abs(event - round(event)) < 1e-5)) {
203+
204+
# elaborate info0
205+
q_e <- ratio / (1 + ratio)
206+
q_c <- 1 - q_e
207+
x$info0 <- event * q_e * q_c
208+
209+
# elaborate info
210+
q <- event / x$event
211+
x$info <- x$info * q
212+
}
213+
200214
# Given the above statistical information, calculate the power ----
201215
y_h1 <- gs_power_npe(
202216
theta = x$theta,

0 commit comments

Comments
 (0)