From fb769cb42bc269839af7ed97c88212681e5c285a Mon Sep 17 00:00:00 2001 From: jranke Date: Mon, 4 Nov 2013 20:08:22 +0000 Subject: Add small random numbers to default initial values for rate constants to avoid numerical artefacts occurring in eigenvalue based solutions. git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@135 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- R/mkinfit.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/mkinfit.R b/R/mkinfit.R index 635ec292..2012755f 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -60,7 +60,7 @@ mkinfit <- function(mkinmod, observed, defaultpar.names <- setdiff(mkinmod$parms, names(parms.ini)) for (parmname in defaultpar.names) { # Default values for rate constants, depending on the parameterisation - if (substr(parmname, 1, 2) == "k_") parms.ini[parmname] = 0.1 + if (substr(parmname, 1, 2) == "k_") parms.ini[parmname] = 0.1 + runif(1)/1e6 # Default values for rate constants for reversible binding if (grepl("free_bound$", parmname)) parms.ini[parmname] = 0.1 if (grepl("bound_free$", parmname)) parms.ini[parmname] = 0.02 @@ -115,7 +115,7 @@ mkinfit <- function(mkinmod, observed, solution_type = "analytical" } else { if (is.matrix(mkinmod$coefmat)) { - solution_type = "eigen" + solution_type = "eigen" if (max(observed$value, na.rm = TRUE) < 0.1) { stop("The combination of small observed values (all < 0.1) and solution_type = eigen is error-prone") } -- cgit v1.2.1