diff options
-rw-r--r-- | R/mkinpredict.R | 49 | ||||
-rw-r--r-- | man/mkinpredict.Rd | 33 |
2 files changed, 44 insertions, 38 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R index 9e6ba31f..0dc9cf55 100644 --- a/R/mkinpredict.R +++ b/R/mkinpredict.R @@ -1,40 +1,41 @@ #' Produce predictions from a kinetic model using specific parameters #' #' This function produces a time series for all the observed variables in a -#' kinetic model as specified by \code{\link{mkinmod}}, using a specific set of +#' kinetic model as specified by [mkinmod], using a specific set of #' kinetic parameters and initial values for the state variables. #' #' @aliases mkinpredict mkinpredict.mkinmod mkinpredict.mkinfit -#' @param x A kinetic model as produced by \code{\link{mkinmod}}, or a kinetic -#' fit as fitted by \code{\link{mkinfit}}. In the latter case, the fitted -#' parameters are used for the prediction. +#' @param x A kinetic model as produced by [mkinmod], or a kinetic fit as +#' fitted by [mkinfit]. In the latter case, the fitted parameters are used for +#' the prediction. #' @param odeparms A numeric vector specifying the parameters used in the -#' kinetic model, which is generally defined as a set of ordinary -#' differential equations. +#' kinetic model, which is generally defined as a set of ordinary differential +#' equations. #' @param odeini A numeric vector containing the initial values of the state -#' variables of the model. Note that the state variables can differ from the -#' observed variables, for example in the case of the SFORB model. +#' variables of the model. Note that the state variables can differ from the +#' observed variables, for example in the case of the SFORB model. #' @param outtimes A numeric vector specifying the time points for which model -#' predictions should be generated. +#' predictions should be generated. #' @param solution_type The method that should be used for producing the -#' predictions. This should 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. -#' @param 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. +#' predictions. This should 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. +#' @param method.ode The solution method passed via [mkinpredict] to [ode]] in +#' case the solution type is "deSolve". The default "lsoda" is performant, but +#' sometimes fails to converge. #' @param use_compiled If set to \code{FALSE}, no compiled version of the -#' \code{\link{mkinmod}} model is used, even if is present. -#' @param atol Absolute error tolerance, passed to \code{\link{ode}}. Default -#' is 1e-8, lower than in \code{\link{lsoda}}. -#' @param rtol Absolute error tolerance, passed to \code{\link{ode}}. Default -#' is 1e-10, much lower than in \code{\link{lsoda}}. +#' [mkinmod] model is used, even if is present. +#' @param atol Absolute error tolerance, passed to [ode]. Default is 1e-8, +#' lower than in [lsoda]. +#' @param rtol Absolute error tolerance, passed to [ode]. Default is 1e-10, +#' much lower than in [lsoda]. +#' @param maxsteps Maximum number of steps, passed to [ode]. #' @param map_output Boolean to specify if the output should list values for #' the observed variables (default) or for all state variables (if set to #' FALSE). Setting this to FALSE has no effect for analytical solutions, #' as these always return mapped output. -#' @param na_stop Should it be an error if deSolve::ode returns NaN values +#' @param na_stop Should it be an error if [ode] returns NaN values #' @param \dots Further arguments passed to the ode solver in case such a #' solver is used. #' @import deSolve @@ -115,7 +116,7 @@ mkinpredict.mkinmod <- function(x, outtimes = seq(0, 120, by = 0.1), solution_type = "deSolve", use_compiled = "auto", - method.ode = "lsoda", atol = 1e-8, rtol = 1e-10, + method.ode = "lsoda", atol = 1e-8, rtol = 1e-10, maxsteps = 20000, map_output = TRUE, na_stop = TRUE, ...) @@ -183,6 +184,7 @@ mkinpredict.mkinmod <- function(x, method = method.ode, atol = atol, rtol = rtol, + maxsteps = maxsteps, ... ) } else { @@ -206,6 +208,7 @@ mkinpredict.mkinmod <- function(x, method = method.ode, atol = atol, rtol = rtol, + maxsteps = maxsteps, ... ) } diff --git a/man/mkinpredict.Rd b/man/mkinpredict.Rd index 3a2939e1..0797f259 100644 --- a/man/mkinpredict.Rd +++ b/man/mkinpredict.Rd @@ -18,6 +18,7 @@ mkinpredict(x, odeparms, odeini, outtimes, ...) method.ode = "lsoda", atol = 1e-08, rtol = 1e-10, + maxsteps = 20000, map_output = TRUE, na_stop = TRUE, ... @@ -38,13 +39,13 @@ mkinpredict(x, odeparms, odeini, outtimes, ...) ) } \arguments{ -\item{x}{A kinetic model as produced by \code{\link{mkinmod}}, or a kinetic -fit as fitted by \code{\link{mkinfit}}. In the latter case, the fitted -parameters are used for the prediction.} +\item{x}{A kinetic model as produced by \link{mkinmod}, or a kinetic fit as +fitted by \link{mkinfit}. In the latter case, the fitted parameters are used for +the prediction.} \item{odeparms}{A numeric vector specifying the parameters used in the -kinetic model, which is generally defined as a set of ordinary -differential equations.} +kinetic model, which is generally defined as a set of ordinary differential +equations.} \item{odeini}{A numeric vector containing the initial values of the state variables of the model. Note that the state variables can differ from the @@ -63,31 +64,33 @@ variables. The third possibility "eigen" is faster but not applicable to some models e.g. using FOMC for the parent compound.} \item{use_compiled}{If set to \code{FALSE}, no compiled version of the -\code{\link{mkinmod}} model is used, even if is present.} +\link{mkinmod} model is used, even if is 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{method.ode}{The solution method passed via \link{mkinpredict} to \link{ode}] in +case the solution type is "deSolve". The default "lsoda" is performant, but +sometimes fails to converge.} -\item{atol}{Absolute error tolerance, passed to \code{\link{ode}}. Default -is 1e-8, lower than in \code{\link{lsoda}}.} +\item{atol}{Absolute error tolerance, passed to \link{ode}. Default is 1e-8, +lower than in \link{lsoda}.} -\item{rtol}{Absolute error tolerance, passed to \code{\link{ode}}. Default -is 1e-10, much lower than in \code{\link{lsoda}}.} +\item{rtol}{Absolute error tolerance, passed to \link{ode}. Default is 1e-10, +much lower than in \link{lsoda}.} + +\item{maxsteps}{Maximum number of steps, passed to \link{ode}.} \item{map_output}{Boolean to specify if the output should list values for the observed variables (default) or for all state variables (if set to FALSE). Setting this to FALSE has no effect for analytical solutions, as these always return mapped output.} -\item{na_stop}{Should it be an error if deSolve::ode returns NaN values} +\item{na_stop}{Should it be an error if \link{ode} returns NaN values} } \value{ A matrix with the numeric solution in wide format } \description{ This function produces a time series for all the observed variables in a -kinetic model as specified by \code{\link{mkinmod}}, using a specific set of +kinetic model as specified by \link{mkinmod}, using a specific set of kinetic parameters and initial values for the state variables. } \examples{ |