dynmodel | R Documentation |
Fit a non-population dynamic model
dynmodel(
system,
model,
inits,
data,
fixPars = NULL,
nlmixrObject = NULL,
control = list(),
...
)
system |
RxODE object. See |
model |
Error model. |
inits |
Initial values of system parameters. |
data |
Dataset to estimate. Needs to be RxODE compatible in EVIDs. |
fixPars |
Fixed system parameters. Default is NULL. |
nlmixrObject |
nlmixr object. See |
control |
Control options for dynmodel
|
... |
Other parameters (ignored) |
A dynmodel fit object
Wenping Wang, Mason McComb and Matt Fidler
# dynmodel example --------------------------------------------------------
ode <- "
kel = CL/V;
d/dt(X) = -kel*X;
C=X/V;
PRED = C
"
ode_system <- RxODE(model = ode)
model_error_structure <- cp ~ C + add(0.01) + prop(0.01)
inits <- c(CL = 1, V = 10)
control <- dynmodelControl(method = "Nelder-Mead")
fit <-
try(dynmodel(
system = ode_system,
model = model_error_structure,
data = Bolus_1CPT,
inits = inits,
control = control
))
# nlmixr model example ----------------------------------------------------------
model_onecmt_bolus <- function() {
ini({
CL <- c(0, 5, 10) # Clearance (L/hr)
V <- c(0, 50, 100) # Volume of Distribution
prop.err <- c(0, 0.01, 1)
})
model({
kel <- CL / V
d / dt(X) <- -kel * X
cp <- X / V
cp ~ prop(prop.err)
})
}
# note on some platforms this fit is not successful
fit <- try(nlmixr(object = model_onecmt_bolus, data = Bolus_1CPT, est = "dynmodel"))
if (inherits(fit, "nlmixrDynmodel")) {
as.dynmodel(fit)
}
# method = "focei" is slightly more flexible and well tested
fit <- try(nlmixr(object = model_onecmt_bolus, data = Bolus_1CPT, est = "focei"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.