Learn R Programming

insideRODE (version 2.0)

nlmLSODA: LSODA Solver for NLME

Description

Use Solver for Ordinary Differential Equations (ODE), Switching Automatically Between Stiff and Non-stiff Methods and Generate functions to be used in NLME

Usage

nlmLSODA(model, data, LogParms = TRUE, JAC = FALSE, SEQ = FALSE,rtol = 1e-4, atol = 1e-4, tcrit = NULL, hmin = 0, hmax = Inf)

Arguments

model
either an R-function that computes the values of the derivatives in the ODE system (the model definition) at time t.The return value of model should be a list. See package "nlmeODE" for more details.
data
nlme GroupedData format.
LogParms
transform parameters into log scale
JAC
A JAC set FALSE. This time we can implement this parts.
SEQ
A SEQ set FALSE.
rtol
relative error tolerance, either a scalar or an array as long as y. See details.
atol
absolute error tolerance, either a scalar or an array as long as y. See details.
tcrit
if not NULL, then lsoda cannot integrate past tcrit. The FORTRAN routine lsoda overshoots its targets (times points in the vector times), and interpolates values for the desired time points. If there is a time beyond which integration should not proceed (perhaps because of a singularity), that should be provided in tcrit.
hmin
an optional minimum value of the integration stepsize. In special situations this parameter may speed up computations with the cost of precision. Don't use hmin if you don't know why!
hmax
an optional maximum value of the integration stepsize. If not specified, hmax is set to the largest difference in times, to avoid that the simulation possibly ignores short-term events. If 0, no maximal size is specified.

See Also

Examples

Run this code
####################################################################
#general model from nlmeODE package
#nlmLSODA USE ACCORDING FUNCTIONS
####################################################################
rm(list=ls())
require(insideRODE)

data(Theoph)# examples from nlmeODE
TheophODE <- Theoph
TheophODE$Dose[TheophODE$Time!=0] <- 0
TheophODE$Cmt <- rep(1,dim(TheophODE)[1])

# model files
OneComp <- list(DiffEq=list(
                            dy1dt = ~ -ka*y1 ,
                            dy2dt = ~ ka*y1-ke*y2),
                ObsEq=list(
                            c1 = ~ 0,
                            c2 = ~ y2/CL*ke),
                Parms=c("ka","ke","CL"),
                States=c("y1","y2"),
                Init=list(0,0))

TheophModel <- nlmLSODA(OneComp,TheophODE) #ode solver
Theoph.nlme <- nlme(conc ~ TheophModel(ka,ke,CL,Time,Subject),
data = TheophODE, fixed=ka+ke+CL~1, random = pdDiag(ka+CL~1),
start=c(ka=0.5,ke=-2.5,CL=-3.2),
control=list(returnObject=TRUE,msVerbose=TRUE),
verbose=TRUE)

plot(augPred(Theoph.nlme,level=0:1))

Run the code above in your browser using DataLab