From 651b27080fd20c8079f2f2744b93b7d866cc8b75 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 4 Dec 2013 05:15:38 +0100 Subject: Remove mkinmod warning based on a misconception --- R/mkinmod.R | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/R/mkinmod.R b/R/mkinmod.R index c743777b..2bc6ae35 100644 --- a/R/mkinmod.R +++ b/R/mkinmod.R @@ -1,6 +1,4 @@ -# $Id$ - -# Copyright (C) 2010-2012 Johannes Ranke {{{ +# Copyright (C) 2010-2013 Johannes Ranke {{{ # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -46,19 +44,10 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL) # fractions if(spec[[1]]$type %in% c("FOMC", "DFOP", "HS")) { mat = FALSE - if(!is.null(spec[[1]]$to)) { - message <- paste( - "Only constant formation fractions over time are implemented.", - "Depending on the reason for the time dependence of degradation", - "this may be unrealistic. You may want to consider using the", - "SFORB model", - sep="\n") - warning(message) - } else message <- "ok" } else mat = TRUE #}}} - # Establish list of differential equations as well as map from observed {{{ + # Establish a list of differential equations as well as a map from observed {{{ # compartments to differential equations for (varname in obs_vars) { -- cgit v1.2.1 From fdf654552324cfd7b83b6282be18d55fece72106 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 4 Dec 2013 05:34:43 +0100 Subject: Add Makefile targets without vignette building --- GNUmakefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 1c124b19..255b97f3 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -16,11 +16,12 @@ help: @echo "" @echo "Development Tasks" @echo "-----------------" - @echo " build Create the package" - @echo " check Invoke build and then check the package" - @echo " install Invoke build and then install the result" - @echo " test Install a new copy of the package and run it " - @echo " through the testsuite" + @echo " build Create the package" + @echo " build-no-vignettes Create the package without rebuilding vignettes" + @echo " check Invoke build and then check the package" + @echo " install Invoke build and then install the result" + @echo " test Install a new copy of the package and run it " + @echo " through the testsuite" @echo "" @echo "Packaging Tasks" @echo "---------------" @@ -43,15 +44,15 @@ build-no-vignettes: cd ..;\ "$(RBIN)/R" CMD build $(PKGSRC) --no-build-vignettes -install: build +install%: build% cd ..;\ "$(RBIN)/R" CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz -check: build +check%: build% cd ..;\ "$(RBIN)/R" CMD check --as-cran --no-tests $(PKGNAME)_$(PKGVERS).tar.gz -test: install +test%: install% cd tests;\ "$(RBIN)/Rscript" doRUnit.R -- cgit v1.2.1 From 3ee58ca030d5c9e6bffb71f1e2bd7fca0f355b61 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 4 Dec 2013 05:35:46 +0100 Subject: Make clear in help file that gmkin is experimental --- man/gmkin.Rd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/gmkin.Rd b/man/gmkin.Rd index 29a4f8ca..8a7d1320 100644 --- a/man/gmkin.Rd +++ b/man/gmkin.Rd @@ -8,6 +8,9 @@ \href{http://github.com/jverzani/gWidgetsWWW2}{github page of gWidgetsWWW2} for an explanation how this toolkit works. } +\note{ + This GUI is experimental and not recommended for real work. +} \usage{ gmkin() } -- cgit v1.2.1 From f7be9d1c545b6385f53603d2861e0a16e3044165 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 4 Dec 2013 05:36:30 +0100 Subject: Update ChangeLog and DESCRIPTION --- ChangeLog | 5 ++++- DESCRIPTION | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74c161fd..eba6d92d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ -2013-11-17 Johannes Ranke for mkin (0.9-25) +2013-12-04 Johannes Ranke for mkin (0.9-25) * Change vignette format from Sweave to knitr * Split examples vignette to FOCUS_L and FOCUS_Z + * Add a starter function for the GUI: gmkin() + * Remove warning about constant formation fractions in mkinmod + as it was based on a misconception 2013-11-06 Johannes Ranke for mkin (0.9-24) diff --git a/DESCRIPTION b/DESCRIPTION index 5c55e362..6321f7ae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Routines for fitting kinetic models with one or more state variables to chemical degradation data Version: 0.9-25 -Date: 2013-11-18 +Date: 2013-12-04 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre"), email = "jranke@uni-bremen.de"), person("Katrin", "Lindenberger", role = "ctb"), @@ -21,4 +21,4 @@ LazyLoad: yes LazyData: yes Encoding: UTF-8 VignetteBuilder: knitr -URL: http://cran.r-project.org, http://kinfit.r-forge.r-project.org, http://github.com/jranke/mkin +URL: http://cran.r-project.org/package=mkin, http://kinfit.r-forge.r-project.org, http://github.com/jranke/mkin -- cgit v1.2.1 From 8b94131388071980e62c17190eb4229e89975a0c Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 4 Dec 2013 10:25:14 +0100 Subject: Make it possible to use different ode solvers --- GNUmakefile | 22 +++++++++++++++++++--- R/mkinfit.R | 8 +++++--- R/mkinpredict.R | 10 ++++++---- man/mkinfit.Rd | 6 ++++++ man/mkinpredict.Rd | 17 +++++++++++------ 5 files changed, 47 insertions(+), 16 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 255b97f3..cf5c845e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -19,9 +19,13 @@ help: @echo " build Create the package" @echo " build-no-vignettes Create the package without rebuilding vignettes" @echo " check Invoke build and then check the package" + @echo " check-no-vignettes Invoke build without rebuilding vignettes, and then check" @echo " install Invoke build and then install the result" + @echo " install Invoke build without rebuilding vignettes and then install the result" @echo " test Install a new copy of the package and run it " @echo " through the testsuite" + @echo " test-no-vignettes Invoke build without rebuilding vignettes, and then run it" + @echo " through the testsuite" @echo "" @echo "Packaging Tasks" @echo "---------------" @@ -44,15 +48,27 @@ build-no-vignettes: cd ..;\ "$(RBIN)/R" CMD build $(PKGSRC) --no-build-vignettes -install%: build% +install: build cd ..;\ "$(RBIN)/R" CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz -check%: build% +install-no-vignettes: build-no-vignettes + cd ..;\ + "$(RBIN)/R" CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz + +check: build + cd ..;\ + "$(RBIN)/R" CMD check --as-cran --no-tests $(PKGNAME)_$(PKGVERS).tar.gz + +check-no-vignettes: build-no-vignettes cd ..;\ "$(RBIN)/R" CMD check --as-cran --no-tests $(PKGNAME)_$(PKGVERS).tar.gz -test%: install% +test: install + cd tests;\ + "$(RBIN)/Rscript" doRUnit.R + +test-no-vignettes: install-no-vignettes cd tests;\ "$(RBIN)/Rscript" doRUnit.R diff --git a/R/mkinfit.R b/R/mkinfit.R index 3e47479f..749d7485 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -1,5 +1,3 @@ -# $Id$ - # Copyright (C) 2010-2013 Johannes Ranke # Contact: jranke@uni-bremen.de # The summary function is an adapted and extended version of summary.modFit @@ -28,6 +26,7 @@ mkinfit <- function(mkinmod, observed, fixed_parms = NULL, fixed_initials = names(mkinmod$diffs)[-1], solution_type = "auto", + method.ode = "lsoda", method.modFit = "Marq", control.modFit = list(), plot = FALSE, quiet = FALSE, @@ -161,6 +160,7 @@ mkinfit <- function(mkinmod, observed, # Solve the system with current transformed parameter values out <- mkinpredict(mkinmod, parms, odeini, outtimes, solution_type = solution_type, + method.ode = method.ode, atol = atol, rtol = rtol, ...) assign("out_predicted", out, inherits=TRUE) @@ -177,7 +177,9 @@ mkinfit <- function(mkinmod, observed, outtimes_plot = seq(min(observed$time), max(observed$time), length.out=100) out_plot <- mkinpredict(mkinmod, parms, odeini, outtimes_plot, - solution_type = solution_type, atol = atol, rtol = rtol, ...) + solution_type = solution_type, + method.ode = method.ode, + atol = atol, rtol = rtol, ...) plot(0, type="n", xlim = range(observed$time), ylim = range(observed$value, na.rm=TRUE), diff --git a/R/mkinpredict.R b/R/mkinpredict.R index 7ce26caf..07c1a819 100644 --- a/R/mkinpredict.R +++ b/R/mkinpredict.R @@ -1,6 +1,4 @@ -# $Id$ - -# Copyright (C) 2010-2012 Johannes Ranke +# Copyright (C) 2010-2013 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -18,7 +16,10 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see -mkinpredict <- function(mkinmod, odeparms, odeini, outtimes, solution_type = "deSolve", map_output = TRUE, atol = 1e-8, rtol = 1e-10, ...) { +mkinpredict <- function(mkinmod, odeparms, odeini, + outtimes, solution_type = "deSolve", + method.ode = "lsoda", atol = 1e-8, rtol = 1e-10, + map_output = TRUE, ...) { # Get the names of the state variables in the model mod_vars <- names(mkinmod$diffs) @@ -96,6 +97,7 @@ mkinpredict <- function(mkinmod, odeparms, odeini, outtimes, solution_type = "de times = outtimes, func = mkindiff, parms = odeparms, + method = method.ode, atol = atol, rtol = rtol, ... diff --git a/man/mkinfit.Rd b/man/mkinfit.Rd index 51e26ed5..0c5d76a9 100644 --- a/man/mkinfit.Rd +++ b/man/mkinfit.Rd @@ -20,6 +20,7 @@ mkinfit(mkinmod, observed, state.ini = c(100, rep(0, length(mkinmod$diffs) - 1)), fixed_parms = NULL, fixed_initials = names(mkinmod$diffs)[-1], solution_type = "auto", + method.ode = "lsoda", method.modFit = "Marq", control.modFit = list(), plot = FALSE, quiet = FALSE, err = NULL, weight = "none", @@ -85,6 +86,11 @@ mkinfit(mkinmod, observed, dependence of degradation rates and metabolites). This argument is passed on to the helper function \code{\link{mkinpredict}}. } + \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.modFit}{ The optimisation method passed to \code{\link{modFit}}. The default "Marq" is the Levenberg Marquardt algorithm \code{\link{nls.lm}} from the package diff --git a/man/mkinpredict.Rd b/man/mkinpredict.Rd index afb57e0b..97db90e3 100644 --- a/man/mkinpredict.Rd +++ b/man/mkinpredict.Rd @@ -10,7 +10,7 @@ } \usage{ mkinpredict(mkinmod, odeparms, odeini, outtimes, solution_type = "deSolve", - map_output = TRUE, atol = 1e-08, rtol = 1e-10, ...) + method.ode = "lsoda", atol = 1e-08, rtol = 1e-10, map_output = TRUE, ...) } \arguments{ \item{mkinmod}{ @@ -33,12 +33,13 @@ 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. + possibility "eigen" is faster but not applicable to some models e.g. + using FOMC for the parent compound. } - \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{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{atol}{ Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-8, @@ -48,6 +49,10 @@ Absolute error tolerance, passed to \code{\link{ode}}. Default is 1e-10, much lower than in \code{\link{lsoda}}. } + \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{\dots}{ Further arguments passed to the ode solver in case such a solver is used. } -- cgit v1.2.1