aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
authorjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2012-07-03 15:46:14 +0000
committerjranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>2012-07-03 15:46:14 +0000
commit5b28712ad11470293e7ab6746718ab3edcfe966b (patch)
tree4d1b3329e04ca007048317536b5dd596bab29eec /R/mkinfit.R
parente832b2255ad18d85e4ea9cc445ee87825a71c3a8 (diff)
- Add rtol argument in order to increase the precision of deSolve based
predictions for complex models - Improve default values for atol and set rtol default to 1e-10 git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@49 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R7
1 files changed, 4 insertions, 3 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 3100b30f..02155966 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -29,7 +29,7 @@ mkinfit <- function(mkinmod, observed,
solution_type = "auto",
plot = FALSE, quiet = FALSE,
err = NULL, weight = "none", scaleVar = FALSE,
- atol = 1e-6, n.outtimes = 100,
+ atol = 1e-8, rtol = 1e-10, n.outtimes = 100,
trace_parms = FALSE,
...)
{
@@ -130,7 +130,7 @@ mkinfit <- function(mkinmod, observed,
parms <- backtransform_odeparms(odeparms, mod_vars)
# Solve the system with current transformed parameter values
- out <- mkinpredict(mkinmod, parms, odeini, outtimes, solution_type = solution_type, ...)
+ out <- mkinpredict(mkinmod, parms, odeini, outtimes, solution_type = solution_type, atol = atol, rtol = rtol, ...)
assign("out_predicted", out, inherits=TRUE)
@@ -146,7 +146,7 @@ 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, ...)
+ solution_type = solution_type, atol = atol, rtol = rtol, ...)
plot(0, type="n",
xlim = range(observed$time), ylim = range(observed$value, na.rm=TRUE),
@@ -198,6 +198,7 @@ mkinfit <- function(mkinmod, observed,
data$variable <- ordered(data$variable, levels = obs_vars)
fit$data <- data[order(data$variable, data$time), ]
fit$atol <- atol
+ fit$rtol <- rtol
fit$parms.all <- parms.all # Return all backtransformed parameters for summary
fit$odeparms.final <- parms.all[mkinmod$parms] # Return ode parameters for further fitting
fit$date <- date()

Contact - Imprint