Skip to content

Commit

Permalink
use closed-form method for SCASp when bcf=F
Browse files Browse the repository at this point in the history
  • Loading branch information
petelaud committed Feb 14, 2025
1 parent 96126db commit e9768d4
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions R/pairbinci.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,20 @@ if (FALSE) {
trans_th0 <- NULL
if (is.null(theta0)) theta0 <- 1
trans_th0 <- theta0 / (1 + theta0)
# To be reinstated when bcf argument is added to scaspi
# OR_ci <- scaspci(
# x = b, n = b + c, distrib = "bin",
# level = level, cc = cc
# )
# the trick here is to use the n2 argument, which is usually redundant
# for contrast = "p".
OR_ci <- scoreci(
x1 = b, n1 = b + c, n2 = x[1] + x[4], contrast = "p", distrib = "bin",
level = level, cc = cc, bcf = bcf, skew = TRUE
)$estimates[, 1:3, drop = FALSE]
# To be consolidated when bcf argument is added to closed form function scaspi
if (bcf == FALSE) {
OR_ci <- scaspci(
x = b, n = b + c, distrib = "bin",
level = level, cc = cc
)
} else {
# the trick here is to use the n2 argument, which is usually redundant
# for contrast = "p".
OR_ci <- scoreci(
x1 = b, n1 = b + c, n2 = x[1] + x[4], contrast = "p", distrib = "bin",
level = level, cc = cc, bcf = bcf, skew = TRUE
)$estimates[, 1:3, drop = FALSE]
}
estimates <- OR_ci / (1 - OR_ci)
scorezero <- scoretheta(
theta = 0.5, x1 = b, n1 = b + c, n2 = x[1] + x[4],
Expand Down

0 comments on commit e9768d4

Please sign in to comment.