diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2015-06-19 17:46:11 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2015-06-19 17:46:11 +0200 |
commit | ec574cff822a1238138c0aa69b3d1459bdc3dfa8 (patch) | |
tree | ed35e64ca0a2e51b0974e7fa3efd768aa5bc446a /man | |
parent | 6281424beafe531c9891670c3227ab12e9a21990 (diff) |
Use odeintr instead of ccSolve for compiling modelsodeintr
Diffstat (limited to 'man')
-rw-r--r-- | man/IORE.solution.Rd | 4 | ||||
-rw-r--r-- | man/mkinfit.Rd | 24 | ||||
-rw-r--r-- | man/mkinmod.Rd | 34 | ||||
-rw-r--r-- | man/mkinpredict.Rd | 34 |
4 files changed, 59 insertions, 37 deletions
diff --git a/man/IORE.solution.Rd b/man/IORE.solution.Rd index 3d827bdc..bb377d3f 100644 --- a/man/IORE.solution.Rd +++ b/man/IORE.solution.Rd @@ -7,12 +7,12 @@ a concentration dependent rate constant.
}
\usage{
- IORE.solution(t, parent.0, k.iore, N)
+ IORE.solution(t, parent.0, k__iore, N)
}
\arguments{
\item{t}{ Time. }
\item{parent.0}{ Starting value for the response variable at time zero. }
- \item{k.iore}{ Rate constant. Note that this depends on the concentration units used. }
+ \item{k__iore}{ Rate constant. Note that this depends on the concentration units used. }
\item{N}{ Exponent describing the nonlinearity of the rate equation }
}
\note{
diff --git a/man/mkinfit.Rd b/man/mkinfit.Rd index b4923ddd..f3ce6a08 100644 --- a/man/mkinfit.Rd +++ b/man/mkinfit.Rd @@ -21,9 +21,8 @@ mkinfit(mkinmod, observed, parms.ini = "auto", state.ini = "auto", fixed_parms = NULL, fixed_initials = names(mkinmod$diffs)[-1], - solution_type = c("auto", "analytical", "eigen", "deSolve"), + solution_type = c("auto", "analytical", "eigen", "deSolve", "odeintr"), method.ode = "lsoda", - use_compiled = "auto", method.modFit = c("Port", "Marq", "SANN", "Nelder-Mead", "BFGS", "CG", "L-BFGS-B"), maxit.modFit = "auto", control.modFit = list(), @@ -103,11 +102,6 @@ mkinfit(mkinmod, observed, \code{\link{ode}} in case the solution type is "deSolve". The default "lsoda" is performant, but sometimes fails to converge. } - \item{use_compiled}{ - If set to \code{FALSE}, no compiled version of the \code{\link{mkinmod}} - model is used, in the calls to \code{\link{mkinpredict}} even if - a compiled verion is present. - } \item{method.modFit}{ The optimisation method passed to \code{\link{modFit}}. @@ -175,12 +169,13 @@ mkinfit(mkinmod, observed, according to the number of observations. } \item{atol}{ - Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-8, - lower than in \code{\link{lsoda}}. + Absolute error tolerance, passed to \code{\link{ode}} when the solution + type is "deSolve". Default is 1e-8, lower than in \code{\link{lsoda}}. } \item{rtol}{ - Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-10, - much lower than in \code{\link{lsoda}}. + Absolute error tolerance, passed to \code{\link{ode}} when the solution + type is "deSolve". Default is 1e-10, much lower than in + \code{\link{lsoda}}. } \item{n.outtimes}{ The length of the dataseries that is produced by the model prediction @@ -246,13 +241,6 @@ print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet = TRUE))) coef(fit) endpoints(fit) -\dontrun{ -# deSolve is slower when ccSolve is not installed and set up -print(system.time(fit.deSolve <- mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve"))) -coef(fit.deSolve) -endpoints(fit.deSolve) -} # Use stepwise fitting, using optimised parameters from parent only fit, FOMC \dontrun{ diff --git a/man/mkinmod.Rd b/man/mkinmod.Rd index f6a8fe5d..c5d59403 100644 --- a/man/mkinmod.Rd +++ b/man/mkinmod.Rd @@ -11,9 +11,16 @@ For the definition of model types and their parameters, the equations given
in the FOCUS and NAFTA guidance documents are used.
+
+ When a C++ compiler is available (currently checking for g++), the model is
+ compiled using the \code{\link{odeintr}} package, so that model fitting will
+ be faster.
}
\usage{
-mkinmod(..., use_of_ff = "min", speclist = NULL, quiet = FALSE)
+mkinmod(..., use_of_ff = "min", speclist = NULL, quiet = FALSE,
+ odeintr_compile = c("auto", "no", "yes"),
+ odeintr_method = "rk5_i",
+ odeintr_atol = 1e-8, odeintr_rtol = 1e-10)
}
\arguments{
\item{...}{
@@ -45,6 +52,24 @@ mkinmod(..., use_of_ff = "min", speclist = NULL, quiet = FALSE) \item{quiet}{
Should messages be suppressed?
}
+ \item{odeintr_compile}{
+ When "no", the model is not compiled using \code{\link{compile_sys}}.
+ When "auto", it is only compiled when an eigenvalue based solution
+ is not possible, as compiling the model takes some time and we
+ want to avoid this in case it does not bring a large performance benefit.
+ }
+ \item{odeintr_method}{
+ The integration method passed to \code{\link{compile_sys}}. The default "rk5_i"
+ is an interpolating adaptive method.
+ }
+ \item{odeintr_atol}{
+ Absolute error tolerance, only used when the model is compiled using the odeintr
+ package. Default is 1e-8, lower than in \code{\link{compile_sys}}.
+ }
+ \item{odeintr_rtol}{
+ Relative error tolerance, only used when the model is compiled using the odeintr
+ package. Default is 1e-10, lower than in \code{\link{compile_sys}}.
+ }
}
\value{
A list of class \code{mkinmod} for use with \code{\link{mkinfit}}, containing
@@ -56,6 +81,11 @@ mkinmod(..., use_of_ff = "min", speclist = NULL, quiet = FALSE) \item{use_of_ff}{ The content of \code{use_of_ff} is passed on in this list component. }
\item{coefmat}{ The coefficient matrix, if the system of differential equations can be
represented by one. }
+ \item{e}{An environment where the functions generated by \{code\{link{compile_sys}}
+ are installed when the model is compiled. The name used for the model is "m", so
+ for example the function for setting parameters is e$m_set_params(). See
+ the help page for \code{\link{compile_sys}} for the available functions
+ and their arguments.
}
\note{
The IORE submodel is not well tested (yet). When using this model for metabolites,
@@ -92,12 +122,12 @@ SFO_SFO <- mkinmod( # If we have several parallel metabolites
# (compare tests/testthat/test_synthetic_data_for_UBA_2014.R)
+\dontrun{
m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")),
M1 = mkinsub("SFO"),
M2 = mkinsub("SFO"),
use_of_ff = "max", quiet = TRUE)
-\dontrun{
fit_DFOP_par_c <- mkinfit(m_synth_DFOP_par,
synthetic_data_for_UBA_2014[[12]]$data,
quiet = TRUE)
diff --git a/man/mkinpredict.Rd b/man/mkinpredict.Rd index c6aee75f..745f1922 100644 --- a/man/mkinpredict.Rd +++ b/man/mkinpredict.Rd @@ -9,9 +9,10 @@ kinetic parameters and initial values for the state variables. } \usage{ - mkinpredict(mkinmod, odeparms, odeini, outtimes, solution_type = "deSolve", - use_compiled = "auto", method.ode = "lsoda", atol = 1e-08, rtol = 1e-10, - map_output = TRUE, ...) + mkinpredict(mkinmod, odeparms, odeini, outtimes, + solution_type = c("deSolve", "analytical", "eigen", "odeintr"), + method.ode = "lsoda", atol.deSolve = 1e-08, rtol.deSolve = 1e-10, + map_output = TRUE, ...) } \arguments{ \item{mkinmod}{ @@ -35,22 +36,21 @@ generally be "analytical" if there is only one observed variable, and usually "deSolve" in the case of several observed variables. The third possibility "eigen" is faster but not applicable to some models e.g. - using FOMC for the parent compound. + using FOMC for the parent compound. If a compiler is installed and functional, + method "odeintr" is also available, which is faster for complex models. + The default is "deSolve", as it works for all models and does not depend + on a compiler to be present. } \item{method.ode}{ The solution method passed via \code{\link{mkinpredict}} to \code{\link{ode}} in case the solution type is "deSolve". The default "lsoda" is performant, but sometimes fails to converge. } - \item{use_compiled}{ - If set to \code{FALSE}, no compiled version of the \code{\link{mkinmod}} - model is used, even if is present. - } - \item{atol}{ + \item{atol.deSolve}{ Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-8, lower than in \code{\link{lsoda}}. } - \item{rtol}{ + \item{rtol.deSolve}{ Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-10, much lower than in \code{\link{lsoda}}. } @@ -76,8 +76,6 @@ mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "deSolve") mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "deSolve", use_compiled = FALSE) - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "eigen") @@ -99,20 +97,26 @@ mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), seq(0, 20, by = 0.01))[2001,] - # Check compiled model versions - they are faster than the eigenvalue based solutions! SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), m1 = list(type = "SFO")) + \dontrun{ + # Check compiled model versions - they are faster than the eigenvalue based solutions! + SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"), odeintr_compile = "yes") + } system.time( print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "eigen")[201,])) + \dontrun{ system.time( print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), - solution_type = "deSolve")[201,])) + solution_type = "odeintr")[201,])) system.time( print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), - solution_type = "deSolve", use_compiled = FALSE)[201,])) + solution_type = "deSolve")[201,])) + } } \keyword{ manip } |