Skip to content

Commit

Permalink
Return the poped.db (and update for shrinkage)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Oct 17, 2024
1 parent 28d30c0 commit fb3a8cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 5 additions & 3 deletions R/poped.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ rxUiGet.popedFfFun <- function(x, ...) {
# be in the right order
if (.lu <= .(.poped$maxn)) {
# only check for time reset if it is specified in the model
poped.db <- .popedRxRunSetup(poped.db)
.p <- babelmixr2::popedMultipleEndpointParam(p, .u, model_switch,
.(.poped$maxn),
poped.db$babelmixr2$optTime)
.popedRxRunSetup(poped.db)
.ret <- .popedSolveIdME(.p, .u, .xt, model_switch, .(length(.predDf$cond)),
.id-1, .totn)
} else if (.lu > .(.poped$maxn)) {
.p <- p[-1]
.popedRxRunFullSetupMe(poped.db, .xt, model_switch)
poped.db <- .popedRxRunFullSetupMe(poped.db, .xt, model_switch)
.ret <- .popedSolveIdME2(.p, .u, .xt, model_switch, .(length(.predDf$cond)),
.id-1, .totn)
}
Expand Down Expand Up @@ -423,7 +423,7 @@ attr(rxUiGet.popedFfFun, "desc") <- "PopED parameter model (ff_fun)"
.poped$setup <- 1L
.poped$fullXt <- NULL
}
invisible()
invisible(popedDb)
}
#' Setup a full solve for a multiple-endpoint model
#'
Expand Down Expand Up @@ -493,6 +493,7 @@ attr(rxUiGet.popedFfFun, "desc") <- "PopED parameter model (ff_fun)"
.poped$curNumber <- popedDb$babelmixr2$modelNumber
.poped$setup <- 2L
}
popedDb
}
#' Setup for a full solve with a single endpoint model
#'
Expand Down Expand Up @@ -559,6 +560,7 @@ attr(rxUiGet.popedFfFun, "desc") <- "PopED parameter model (ff_fun)"
.poped$curNumber <- popedDb$babelmixr2$modelNumber
.poped$setup <- 2L
}
popedDb
}

#' This gets the epsi associated with the nlmixr2/rxode2 model specification
Expand Down
4 changes: 0 additions & 4 deletions tests/testthat/test-poped.R
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,11 @@ if (requireNamespace("PopED", quietly=TRUE)) {
tKa <- 0.25
tCl <- 3.75
tF <- fix(0.9)

eta.v ~ 0.09
eta.ka ~ 0.09
eta.cl ~0.25^2

prop.sd <- fix(sqrt(0.04))
add.sd <- fix(sqrt(5e-6))

})
model({
V<-tV*exp(eta.v)
Expand All @@ -343,7 +340,6 @@ if (requireNamespace("PopED", quietly=TRUE)) {
(exp(-CL/V * (time - (N - 1) * TAU)) *
(1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) -
exp(-KA * (time - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))

y ~ prop(prop.sd) + add(add.sd)
})
}
Expand Down

0 comments on commit fb3a8cc

Please sign in to comment.