nlme_ode: Fit nlme-based mixed-effect model using ODE implementation

Description Usage Arguments Details RxODE Syntax Author(s) Examples

View source: R/nlme_fit.R

Description

'nlme_ode' fits a mixed-effect model described using ordinary differential equation (ODEs). The ODE-definition follows RxODE syntax. Specification of fixed effects, random effects and intial values follows the standard nlme notations.

Usage

1
2
3
nlme_ode(dat.o, model, par_model, par_trans, response, response.scaler = NULL,
  transit_abs = FALSE, atol = 1e-08, rtol = 1e-08, debugODE = FALSE,
  mc.cores = 1, ...)

Arguments

dat.o

data to be fitted

model

a string containing the set of ordinary differential equations (ODE) and other expressions defining the changes in the dynamic system. For details, see the sections “Details” and “RxODE Syntax” below.

par_model

list: model for fixed effects, randoms effects and initial values.

par_trans

function: calculation of PK parameters

response

names of the response variable

response.scaler

optional response variable scaler. default is NULL

transit_abs

a logical if transit absorption model is enabled

atol

atol (absolute tolerance for ODE-solver)

rtol

rtol (relative tolerance for ODE-solver)

debugODE

a logical if debugging is enabled

mc.cores

number of cores used in fitting (only for Linux)

...

additional nlme options

Details

The ODE-based model specification may be coded inside a character string or in a text file, see Section RxODE Syntax below for coding details. An internal RxODE compilation manager object translates the ODE system into C, compiles it, and dynamically loads the object code into the current R session. The call to RxODE produces an object of class RxODE which consists of a list-like structure (closure) with various member functions (see Section Value below).

RxODE Syntax

An RxODE model specification consists of one or more statements terminated by semi-colons, ‘;’, and optional comments (comments are delimited by # and an end-of-line marker). NB: Comments are not allowed inside statements.

A block of statements is a set of statements delimited by curly braces, ‘{ ... }’. Statements can be either assignments or conditional if statements. Assignment statements can be either “simple” assignments, where the left hand is an identifier (i.e., variable), or special “time-derivative” assignments, where the left hand specifies the change of that variable with respect to time e.g., d/dt(depot).

Expressions in assignment and ‘if’ statements can be numeric or logical (no character expressions are currently supported). Numeric expressions can include the following numeric operators (‘+’, ‘-’, ‘*’, ‘/’, ‘^’), and those mathematical functions defined in the C or the R math libraries (e.g., fabs, exp, log, sin). (Note that the modulo operator ‘%’ is currently not supported.)

Identifiers in an RxODE model specification can refer to:

Identifiers consist of case-sensitive alphanumeric characters, plus the underscore ‘_’ character. NB: the dot ‘.’ character is not a valid character identifier.

The values of these variables at pre-specified time points are saved as part of the fitted/integrated/solved model (see eventTable, in particular its member function add.sampling that defines a set of time points at which to capture a snapshot of the system via the values of these variables).

The ODE specification mini-language is parsed with the help of the open source tool DParser, Plevyak (2015).

Author(s)

Wenping Wang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
library(nlmixr)
ode <- "
d/dt(depot) =-KA*depot;
d/dt(centr) = KA*depot - KE*centr;
"
dat <- read.table(system.file("examples/theo_md.txt", package = "nlmixr"), head=TRUE)
mypar <- function(lKA, lKE, lCL)
{
    KA=exp(lKA)
    KE=exp(lKE)
    CL=exp(lCL)
    V = CL/KE
}

specs <- list(fixed=lKA+lKE+lCL~1, random = pdDiag(lKA+lCL~1),
	start=c(lKA=0.5, lKE=-2.5, lCL=-3.2))
fit <- nlme_ode(dat, model=ode, par_model=specs, par_trans=mypar,
	response="centr", response.scaler="V")


## End(Not run)

nlmixr documentation built on Nov. 17, 2017, 4:20 a.m.