Skip to content

Commit c6c3b59

Browse files
committed
update the formula of CP with t_ij = I2/I1
1 parent 991bae2 commit c6c3b59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/gs_cp_npe.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
#' b = x$bound$z[x$bound$bound == "upper" & x$bound$analysis == 3])
124124
gs_cp_npe <- function(theta = NULL,
125125
info = NULL,
126-
max_info = max(info),
127126
a = NULL, b = NULL
128127
) {
129128
# ----------------------------------------- #
@@ -153,9 +152,10 @@ gs_cp_npe <- function(theta = NULL,
153152
# ----------------------------------------- #
154153
# calculate conditional power under theta #
155154
# ----------------------------------------- #
156-
numerator1 <- sqrt(b * info_frac[2]) - a * sqrt(info_frac[1])
157-
numerator2 <- theta[2] * sqrt(info_frac[2] * info[2]) - theta[1] * sqrt(info_frac[1] * info[1])
158-
denominator <- sqrt(info_frac[2] - info_frac[1])
155+
t_ij <- info[2] / info[1]
156+
numerator1 <- b - a * sqrt(t_ij)
157+
numerator2 <- theta[2] * sqrt(info[2]) - theta[1] * sqrt(t_ij * info[1])
158+
denominator <- sqrt(1 - t_ij)
159159
conditional_power <- pnorm((numerator1 - numerator2) / denominator, lower.tail = FALSE)
160160

161161
return(conditional_power)

0 commit comments

Comments
 (0)