From c1144753adfa0809003085009ebd85f8af9beda8 Mon Sep 17 00:00:00 2001 From: jranke Date: Tue, 10 Apr 2012 21:50:22 +0000 Subject: - Fitting and summaries now work with the new parameter transformations. - The SFORB models with metabolites is broken (see TODO) - Moved the vignette to the location recommended since R 2.14 - Added the missing documentation - Commented out the schaefer_complex_case test, as this version of mkin is not able to fit a model without sink and therefore mkin estimated parameters are quite different git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@22 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- man/ilr.Rd | 8 +----- man/mkinpredict.Rd | 63 +++++++++++++++++++++++++++++++++++++++++++++++ man/summary.mkinfit.Rd | 11 ++------- man/transform_odeparms.Rd | 51 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 16 deletions(-) create mode 100644 man/mkinpredict.Rd create mode 100644 man/transform_odeparms.Rd (limited to 'man') diff --git a/man/ilr.Rd b/man/ilr.Rd index fef0d29..8bf7a72 100644 --- a/man/ilr.Rd +++ b/man/ilr.Rd @@ -17,22 +17,16 @@ vectors with all elements being greater than zero. } } -\details{ -} \value{ The result of the forward or backward transformation. The returned components always sum to 1 for the case of the inverse log-ratio transformation. } \references{ -%% ~put references to the literature/web site here ~ + Peter Filzmoser, Karel Hron (2008) Outlier Detection for Compositional Data Using Robust Methods. Math Geosci 40 233-248 } \author{ René Lehmann and Johannes Ranke } -\note{ -%% ~~further notes~~ -} - \seealso{ Other implementations are in R packages \code{compositions} and \code{robCompositions}. } diff --git a/man/mkinpredict.Rd b/man/mkinpredict.Rd new file mode 100644 index 0000000..af37f7c --- /dev/null +++ b/man/mkinpredict.Rd @@ -0,0 +1,63 @@ +\name{mkinpredict} +\alias{mkinpredict} +\title{ + Produce predictions from a kinetic model using specifc parameters +} +\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 parameters and + initial values for the state variables. +} +\usage{ +mkinpredict(mkinmod, odeparms, odeini, outtimes, solution_type = "deSolve", map_output = TRUE, atol = 1e-06, ...) +} +\arguments{ + \item{mkinmod}{ + A kinetic model as produced by \code{\link{mkinmod}}. +} + \item{odeparms}{ + A numeric vector specifying the parameters used in the kinetic model, which is generally + defined as a set of ordinary differential equations. +} + \item{odeini}{ + A numeric vectory 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. +} + \item{outtimes}{ + A numeric vector specifying the time points for which model predictions should be + generated. +} + \item{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 produces results that the author believes to be less accurate. +} + \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). +} + \item{atol}{ + Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-6 as in + \code{\link{lsoda}}. +} + \item{\dots}{ + Further arguments passed to the ode solver in case such a solver is used. +} +} +\value{ + A matrix in the same format as the output of \code{\link{ode}}. +} +\author{ + Johannes Ranke +} +\examples{ + SFO <- mkinmod(degradinol = list(type = "SFO")) + mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 1:20, solution_type = "analytical") + mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 1:20, solution_type = "eigen") + mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 1:20, atol = 1e-20) + mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 1:20, atol = 1e-20, method = "rk4") + mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), (1:200)/10) +} +\keyword{ manip } diff --git a/man/summary.mkinfit.Rd b/man/summary.mkinfit.Rd index b3e7862..59b988a 100644 --- a/man/summary.mkinfit.Rd +++ b/man/summary.mkinfit.Rd @@ -11,8 +11,8 @@ and residual values. } \usage{ -\method{summary}{mkinfit}(object, data = TRUE, distimes = TRUE, ff = TRUE, ...) -\method{print}{summary.mkinfit}(x, digits = max(3, getOption("digits") - 3), tval = TRUE, ...) +\method{summary}{mkinfit}(object, data = TRUE, distimes = TRUE, ...) +\method{print}{summary.mkinfit}(x, digits = max(3, getOption("digits") - 3), ...) } \arguments{ @@ -27,16 +27,9 @@ } \item{distimes}{ logical, indicating whether DT50 and DT90 values should be included. -} - \item{ff}{ - logical, indicating whether formation fractions should be included. } \item{digits}{ Number of digits to use for printing -} - \item{tval}{ - Should the test statistic of the t-test for parameter significance be - printed? Defaults to \code{TRUE}. Saves vertical space if set to \code{FALSE}. } \item{\dots}{ optional arguments passed to methods like \code{print}. diff --git a/man/transform_odeparms.Rd b/man/transform_odeparms.Rd new file mode 100644 index 0000000..cc1c8f7 --- /dev/null +++ b/man/transform_odeparms.Rd @@ -0,0 +1,51 @@ +\name{transform_odeparms} +\alias{transform_odeparms} +\alias{backtransform_odeparms} +\title{ + Functions to transform and backtransform kinetic parameters for fitting +} +\description{ + The transformations are intended to map parameters that should only take + on restricted values to the full scale of real numbers. For kinetic rate + constants and other paramters that can only take on positive values, a + simple log transformation is used. For compositional parameters, such as + the formations fractions that should always sum up to 1 and can not be + negative, the \code{\link{ilr}} transformation is used. +} +\usage{ +transform_odeparms(parms, mod_vars) +backtransform_odeparms(transparms, mod_vars) +} +\arguments{ + \item{parms}{ + Parameters of kinetic models as used in the differential equations. +} + \item{transparms}{ + Transformed parameters of kinetic models as used in the fitting procedure. +} + \item{mod_vars}{ + Names of the state variables in the kinetic model. These are used for + grouping the formation fractions before \code{\link{ilr}} transformation. +} +} +\value{ + A vector of transformed or backtransformed parameters with the same names + as the original parameters. +} +\author{ + Johannes Ranke +} +\examples{ +SFO_SFO <- mkinmod( + parent = list(type = "SFO", to = "m1", sink = TRUE), + m1 = list(type = "SFO")) +# Fit the model to the FOCUS example dataset D using defaults +fit <- mkinfit(SFO_SFO, FOCUS_2006_D) +summary(fit, data=FALSE) # See transformed and backtransformed parameters +initials <- fit$start$initial +transformed <- fit$start$transformed +names(initials) <- names(transformed) <- rownames(fit$start) +transform_odeparms(initials, c("parent", "m1")) +backtransform_odeparms(transformed, c("parent", "m1")) +} +\keyword{ manip } -- cgit v1.2.1