Skip to content

Commit

Permalink
fix and test for ci=xxx
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Aug 30, 2023
1 parent 65177cc commit 4b90b2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions R/confint.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ confint.rxSolve <- function(object, parm = NULL, level = 0.95, ...) {
.p2 <- c(.c, 0.5, 1 - .c)
.lst <- list(
lvl = paste0("p", .p * 100),
ci = paste0("p", .c * 100),
ci = paste0("p", .p2 * 100),
parm = levels(.stk$trt),
by = .by
)
Expand Down Expand Up @@ -81,12 +81,12 @@ confint.rxSolve <- function(object, parm = NULL, level = 0.95, ...) {
.n <- object$env$.args$nStud
}
message("summarizing data...", appendLF = FALSE)
.ret <- .stk[, id := sim.id %% .n
][, list(p1 = .p, eff = stats::quantile(.SD$value, probs = .p, na.rm = TRUE)), by = c("id", "time", "trt", .by)][
, setNames(as.list(stats::quantile(.SD$eff, probs = .c, na.rm = TRUE)),
sprintf("p%s", .c * 100)),
by = c("p1", "time", "trt", .by)
]
.ret <- .stk[, id := sim.id %% .n]
.ret <- .ret[, list(p1 = .p, eff = stats::quantile(.SD$value, probs = .p, na.rm = TRUE)), by = c("id", "time", "trt", .by)]
.ret <- .ret[, setNames(as.list(stats::quantile(.SD$eff, probs = .p2, na.rm = TRUE)),
sprintf("p%s", .p2 * 100)),
by = c("p1", "time", "trt", .by)
]
.ret$Percentile <- factor(sprintf("%s%%", .ret$p1 * 100))
if (requireNamespace("tibble", quietly = TRUE)) {
.ret <- tibble::as_tibble(.ret)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-zzzz-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ rxTest({

.rxWithOptions(list(rxode2.theme = TRUE), {

ci1.C2 <- confint(sim, "C2")
ci1.C2 <- confint(sim, "C2", ci=0.99)

ci1.C2.e <- confint(sim, "C2", by="extra")

Expand Down

0 comments on commit 4b90b2e

Please sign in to comment.