| predict.nlmixr2FitCore | R Documentation |
Generates population- or individual-level predictions from an 'nlmixr2FitCore' object.
## S3 method for class 'nlmixr2FitCore'
predict(object, ..., level = c("population", "individual"))
object |
nlmixr2 fit core object to predict |
... |
additional arguments passed to rxode2::rxSolve or nlmixr2; matching other 'predict' methods, these can include 'newdata' and 'rxControl' settings |
level |
the prediction level; one of '"population"' (default) or '"individual"'; numeric values '0' and '1' are also accepted |
A data frame with predictions
one.compartment <- function() {
ini({
tka <- log(1)
tcl <- log(10)
tv <- log(35)
eta.ka ~ 0.1
eta.cl ~ 0.1
eta.v ~ 0.1
add.sd <- 0.1
})
model({
ka <- exp(tka + eta.ka)
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) = -ka * depot
d/dt(center) = ka * depot - cl / v * center
cp = center / v
cp ~ add(add.sd)
})
}
# The fit is performed by the function nlmixr/nlmix2 specifying
# the model, data and estimate
fit <- nlmixr2(one.compartment, theo_sd, est = "focei",
foceiControl(maxOuterIterations = 0L))
# Population predictions
ppred <- predict(fit, theo_sd, level="population")
# Individual predictions
ipred <- predict(fit, theo_sd, level="individual")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.