| foceiLikLoad | R Documentation |
Compiles the inner (FOCEi sensitivity) model from an rxode2 UI model, preprocesses the data, and sets up the FOCEi inner problem in memory so that individual log-likelihoods can be evaluated repeatedly (in parallel per subject) at supplied etas without recompiling – the setup used internally by 'est="emvi"'/'est="fbvi"', 'est="vae"' and the f-SAEM fast kernel, exposed here for MCMC/SAMBA-style callers (issue #414).
foceiLikLoad(
object,
data,
likelihood = c("focei", "focep", "foce"),
rxControl = rxode2::rxControl(),
...
)
object |
An 'rxode2'/'nlmixr2' UI model (a model function or its compiled UI). |
data |
The estimation data (a data frame with the usual nlmixr2 columns). |
likelihood |
The individual likelihood type: '"focei"' (FOCE with interaction), '"focep"' (FOCE+, interaction off with the residual variance at the conditional eta) or '"foce"' (NONMEM-style FOCE, residual variance frozen at eta=0). |
rxControl |
An [rxode2::rxControl()] object for the ODE solving options. |
... |
Additional solving/model options passed to '.foceiLikControl' (e.g. 'optExpression', 'addProp', 'eventSens'). |
Only one likelihood system may be loaded at a time; loading errors if one is already loaded. Use [foceiLikRun()] to evaluate and [foceiLikUnload()] to free.
Invisibly, a handle list with the loaded system's dimensions: ‘initPar' (the estimation-scale parameter vector at the model’s initial estimates, a ready 'theta' for [foceiLikRun()]), 'npars', 'ntheta', 'neta', 'nid', 'thetaNames', 'etaNames', 'idLvl' and 'likelihood'.
Matthew L. Fidler
[foceiLikRun()], [foceiLikUnload()]
one.cmt <- function() {
ini({
tka <- 0.45
tcl <- 1
tv <- 3.45
add.sd <- 0.7
eta.ka ~ 0.6
eta.cl ~ 0.3
eta.v ~ 0.1
})
model({
ka <- exp(tka + eta.ka)
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
linCmt() ~ add(add.sd)
})
}
# Set the likelihood up in memory once; only one may be loaded at a time
h <- foceiLikLoad(one.cmt, theo_sd, "focei")
# The handle carries the dimensions and a ready starting parameter vector
h$nid
h$neta
h$initPar
# Individual joint log-likelihood at eta = 0, one value per subject
eta <- matrix(0, h$nid, h$neta)
foceiLikRun(h$initPar, eta)
# Free it when done (loading again before this errors)
foceiLikUnload()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.