aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DESCRIPTION4
-rw-r--r--NEWS.md8
-rw-r--r--R/confint.mkinfit.R8
-rw-r--r--R/logLik.mkinfit.R6
-rw-r--r--R/mkinfit.R2
-rw-r--r--R/mkinresplot.R2
-rw-r--r--R/mmkin.R1
-rw-r--r--R/nlme.mmkin.R36
-rw-r--r--R/transform_odeparms.R18
-rw-r--r--README.md2
-rw-r--r--_pkgdown.yml1
-rw-r--r--build.log2
-rw-r--r--check.log2
-rw-r--r--docs/404.html2
-rw-r--r--docs/articles/index.html2
-rw-r--r--docs/authors.html2
-rw-r--r--docs/index.html4
-rw-r--r--docs/news/index.html14
-rw-r--r--docs/pkgdown.yml2
-rw-r--r--docs/reference/Rplot001.pngbin13995 -> 1011 bytes
-rw-r--r--docs/reference/Rplot002.pngbin13648 -> 37427 bytes
-rw-r--r--docs/reference/Rplot003.pngbin15333 -> 33263 bytes
-rw-r--r--docs/reference/Rplot004.pngbin10670 -> 24137 bytes
-rw-r--r--docs/reference/Rplot005.pngbin19414 -> 24137 bytes
-rw-r--r--docs/reference/Rplot006.pngbin24624 -> 22141 bytes
-rw-r--r--docs/reference/confint.mkinfit.html85
-rw-r--r--docs/reference/index.html10
-rw-r--r--docs/reference/logLik.mkinfit.html8
-rw-r--r--docs/reference/mkinresplot.html2
-rw-r--r--docs/reference/mmkin.html15
-rw-r--r--docs/reference/nlme.mmkin-3.pngbin79703 -> 172659 bytes
-rw-r--r--docs/reference/nlme.mmkin.html66
-rw-r--r--docs/reference/transform_odeparms.html78
-rw-r--r--docs/sitemap.xml3
-rw-r--r--man/confint.mkinfit.Rd8
-rw-r--r--man/logLik.mkinfit.Rd6
-rw-r--r--man/mkinresplot.Rd2
-rw-r--r--man/mmkin.Rd7
-rw-r--r--man/nlme.mmkin.Rd37
-rw-r--r--man/print.mmkin.Rd16
-rw-r--r--man/transform_odeparms.Rd18
-rw-r--r--test.log4
42 files changed, 266 insertions, 217 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 8bef6055..70872c1d 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Package: mkin
Type: Package
Title: Kinetic Evaluation of Chemical Degradation Data
-Version: 1.0.0
-Date: 2021-02-03
+Version: 1.0.1
+Date: 2021-02-04
Authors@R: c(
person("Johannes", "Ranke", role = c("aut", "cre", "cph"),
email = "jranke@uni-bremen.de",
diff --git a/NEWS.md b/NEWS.md
index bb3f341b..dd1b2e75 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,11 @@
+# mkin 1.0.1
+
+- 'confint.mmkin', 'nlme.mmkin', 'transform_odeparms': Fix example code in dontrun sections that failed with current defaults
+
+- 'logLik.mkinfit': Improve example code to avoid warnings and show convenient syntax
+
+- 'mkinresplot': Re-add Katrin Lindenberger as coauthor who was accidentally removed long ago
+
# mkin 1.0.0
## General
diff --git a/R/confint.mkinfit.R b/R/confint.mkinfit.R
index 53eb45ee..6403c349 100644
--- a/R/confint.mkinfit.R
+++ b/R/confint.mkinfit.R
@@ -57,20 +57,20 @@
#' if (identical(Sys.getenv("NOT_CRAN"), "true")) {
#' n_cores <- parallel::detectCores() - 1
#' } else {
-#' n_cores <- 1
+#' n_cores <- 1
#' }
#' if (Sys.getenv("TRAVIS") != "") n_cores = 1
#' if (Sys.info()["sysname"] == "Windows") n_cores = 1
#'
-#' SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), quiet = TRUE)
+#' SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"),
+#' use_of_ff = "min", quiet = TRUE)
#' SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"),
#' use_of_ff = "max", quiet = TRUE)
#' f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE)
#' system.time(ci_profile <- confint(f_d_1, method = "profile", cores = 1, quiet = TRUE))
#' # Using more cores does not save much time here, as parent_0 takes up most of the time
#' # If we additionally exclude parent_0 (the confidence of which is often of
-#' # minor interest), we get a nice performance improvement from about 50
-#' # seconds to about 12 seconds if we use at least four cores
+#' # minor interest), we get a nice performance improvement if we use at least 4 cores
#' system.time(ci_profile_no_parent_0 <- confint(f_d_1, method = "profile",
#' c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores))
#' ci_profile
diff --git a/R/logLik.mkinfit.R b/R/logLik.mkinfit.R
index 1c025893..7cc10234 100644
--- a/R/logLik.mkinfit.R
+++ b/R/logLik.mkinfit.R
@@ -25,10 +25,10 @@
#' parent = mkinsub("SFO", to = "m1"),
#' m1 = mkinsub("SFO")
#' )
-#' d_t <- FOCUS_2006_D
+#' d_t <- subset(FOCUS_2006_D, value != 0)
#' f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
-#' f_obs <- mkinfit(sfo_sfo, d_t, error_model = "obs", quiet = TRUE)
-#' f_tc <- mkinfit(sfo_sfo, d_t, error_model = "tc", quiet = TRUE)
+#' f_obs <- update(f_nw, error_model = "obs")
+#' f_tc <- update(f_nw, error_model = "tc")
#' AIC(f_nw, f_obs, f_tc)
#' }
#'
diff --git a/R/mkinfit.R b/R/mkinfit.R
index d7de718b..704e70a9 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -542,6 +542,8 @@ mkinfit <- function(mkinmod, observed,
{
assign("calls", calls + 1, inherits = TRUE) # Increase the model solution counter
+ #browser()
+
# Trace parameter values if requested and if we are actually optimising
if(trace_parms & update_data) cat(format(P, width = 10, digits = 6), "\n")
diff --git a/R/mkinresplot.R b/R/mkinresplot.R
index bad28ae8..be361690 100644
--- a/R/mkinresplot.R
+++ b/R/mkinresplot.R
@@ -28,7 +28,7 @@ utils::globalVariables(c("variable", "residual"))
#' @param \dots further arguments passed to \code{\link{plot}}.
#' @return Nothing is returned by this function, as it is called for its side
#' effect, namely to produce a plot.
-#' @author Johannes Ranke
+#' @author Johannes Ranke and Katrin Lindenberger
#' @seealso \code{\link{mkinplot}}, for a way to plot the data and the fitted
#' lines of the mkinfit object, and \code{\link{plot_res}} for a function
#' combining the plot of the fit and the residual plot.
diff --git a/R/mmkin.R b/R/mmkin.R
index bb111efe..030fb27b 100644
--- a/R/mmkin.R
+++ b/R/mmkin.R
@@ -162,6 +162,7 @@ mmkin <- function(models = c("SFO", "FOMC", "DFOP"), datasets,
#'
#' @param x An [mmkin] object.
#' @param \dots Not used.
+#' @rdname mmkin
#' @export
print.mmkin <- function(x, ...) {
cat("<mmkin> object\n")
diff --git a/R/nlme.mmkin.R b/R/nlme.mmkin.R
index 82d5f6de..ff1f2fff 100644
--- a/R/nlme.mmkin.R
+++ b/R/nlme.mmkin.R
@@ -24,6 +24,11 @@ get_deg_func <- function() {
#' This functions sets up a nonlinear mixed effects model for an mmkin row
#' object. An mmkin row object is essentially a list of mkinfit objects that
#' have been obtained by fitting the same model to a list of datasets.
+#'
+#' Note that the convergence of the nlme algorithms depends on the quality
+#' of the data. In degradation kinetics, we often only have few datasets
+#' (e.g. data for few soils) and complicated degradation models, which may
+#' make it impossible to obtain convergence with nlme.
#'
#' @param model An [mmkin] row object.
#' @param data Ignored, data are taken from the mmkin model
@@ -88,11 +93,10 @@ get_deg_func <- function() {
#' # f_nlme_sfo_sfo_ff <- nlme(f_2["SFO-SFO-ff", ])
#' #plot(f_nlme_sfo_sfo_ff)
#'
-#' # With the log-Cholesky parameterization, this converges in 11
-#' # iterations and around 100 seconds, but without tweaking control
-#' # parameters (with pdDiag, increasing the tolerance and pnlsMaxIter was
-#' # necessary)
-#' f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ])
+#' # For the following, we need to increase pnlsMaxIter and the tolerance
+#' # to get convergence
+#' f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ],
+#' control = list(pnlsMaxIter = 120, tolerance = 5e-4))
#'
#' plot(f_nlme_dfop_sfo)
#'
@@ -112,22 +116,18 @@ get_deg_func <- function() {
#' print(f_nlme_dfop_tc)
#' }
#'
-#' f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo,
-#' "DFOP-SFO" = m_dfop_sfo),
-#' ds_2, quiet = TRUE, error_model = "obs")
+#' f_2_obs <- update(f_2, error_model = "obs")
#' f_nlme_sfo_sfo_obs <- nlme(f_2_obs["SFO-SFO", ])
#' print(f_nlme_sfo_sfo_obs)
-#' f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ])
+#' f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ],
+#' control = list(pnlsMaxIter = 120, tolerance = 5e-4))
#'
-#' f_2_tc <- mmkin(list("SFO-SFO" = m_sfo_sfo,
-#' "DFOP-SFO" = m_dfop_sfo),
-#' ds_2, quiet = TRUE, error_model = "tc")
-#' # f_nlme_sfo_sfo_tc <- nlme(f_2_tc["SFO-SFO", ]) # stops with error message
-#' f_nlme_dfop_sfo_tc <- nlme(f_2_tc["DFOP-SFO", ])
-#' # We get warnings about false convergence in the LME step in several iterations
-#' # but as the last such warning occurs in iteration 25 and we have 28 iterations
-#' # we can ignore these
-#' anova(f_nlme_dfop_sfo, f_nlme_dfop_sfo_obs, f_nlme_dfop_sfo_tc)
+#' f_2_tc <- update(f_2, error_model = "tc")
+#' # f_nlme_sfo_sfo_tc <- nlme(f_2_tc["SFO-SFO", ]) # No convergence with 50 iterations
+#' # f_nlme_dfop_sfo_tc <- nlme(f_2_tc["DFOP-SFO", ],
+#' # control = list(pnlsMaxIter = 120, tolerance = 5e-4)) # Error in X[, fmap[[nm]]] <- gradnm
+#'
+#' anova(f_nlme_dfop_sfo, f_nlme_dfop_sfo_obs)
#'
#' }
nlme.mmkin <- function(model, data = "auto",
diff --git a/R/transform_odeparms.R b/R/transform_odeparms.R
index f21d31fc..4fe4e5c2 100644
--- a/R/transform_odeparms.R
+++ b/R/transform_odeparms.R
@@ -42,17 +42,21 @@
#'
#' SFO_SFO <- mkinmod(
#' parent = list(type = "SFO", to = "m1", sink = TRUE),
-#' m1 = list(type = "SFO"))
+#' m1 = list(type = "SFO"), use_of_ff = "min")
+#'
#' # Fit the model to the FOCUS example dataset D using defaults
-#' fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+#' FOCUS_D <- subset(FOCUS_2006_D, value != 0) # remove zero values to avoid warning
+#' fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE)
#' fit.s <- summary(fit)
#' # Transformed and backtransformed parameters
#' print(fit.s$par, 3)
#' print(fit.s$bpar, 3)
#'
#' \dontrun{
-#' # Compare to the version without transforming rate parameters
-#' fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
+#' # Compare to the version without transforming rate parameters (does not work
+#' # with analytical solution, we get NA values for m1 in predictions)
+#' fit.2 <- mkinfit(SFO_SFO, FOCUS_D, transform_rates = FALSE,
+#' solution_type = "deSolve", quiet = TRUE)
#' fit.2.s <- summary(fit.2)
#' print(fit.2.s$par, 3)
#' print(fit.2.s$bpar, 3)
@@ -66,13 +70,13 @@
#' backtransform_odeparms(transformed, SFO_SFO)
#'
#' \dontrun{
-#' # The case of formation fractions
+#' # The case of formation fractions (this is now the default)
#' SFO_SFO.ff <- mkinmod(
#' parent = list(type = "SFO", to = "m1", sink = TRUE),
#' m1 = list(type = "SFO"),
#' use_of_ff = "max")
#'
-#' fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
+#' fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE)
#' fit.ff.s <- summary(fit.ff)
#' print(fit.ff.s$par, 3)
#' print(fit.ff.s$bpar, 3)
@@ -87,7 +91,7 @@
#' use_of_ff = "max")
#'
#'
-#' fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE)
+#' fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_D, quiet = TRUE)
#' fit.ff.2.s <- summary(fit.ff.2)
#' print(fit.ff.2.s$par, 3)
#' print(fit.ff.2.s$bpar, 3)
diff --git a/README.md b/README.md
index 77d3b776..973dbc89 100644
--- a/README.md
+++ b/README.md
@@ -100,6 +100,8 @@ version is found in the ['dev' subdirectory](https://pkgdown.jrwb.de/mkin/dev/).
* Nonlinear mixed-effects models can be created from fits of the same degradation
model to different datasets for the same compound by using the
[nlme.mmkin](https://pkgdown.jrwb.de/mkin/reference/nlme.mmkin.html) method.
+ Note that the convergence of the nlme fits depends on the quality of the data.
+ Convergence is better for simple models and data for many groups (e.g. soils).
## GUI
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 7d66f5b0..f632ddb0 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -35,7 +35,6 @@ reference:
- "`[.mmkin`"
- plot.mmkin
- AIC.mmkin
- - print.mmkin
- title: Mixed models
desc: Create and work with nonlinear mixed effects models
contents:
diff --git a/build.log b/build.log
index 80426597..09d94134 100644
--- a/build.log
+++ b/build.log
@@ -6,5 +6,5 @@
* creating vignettes ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
-* building ‘mkin_1.0.0.tar.gz’
+* building ‘mkin_1.0.1.tar.gz’
diff --git a/check.log b/check.log
index ba4820b3..d0aeb08a 100644
--- a/check.log
+++ b/check.log
@@ -5,7 +5,7 @@
* using options ‘--no-tests --as-cran’
* checking for file ‘mkin/DESCRIPTION’ ... OK
* checking extension type ... Package
-* this is package ‘mkin’ version ‘1.0.0’
+* this is package ‘mkin’ version ‘1.0.1’
* package encoding: UTF-8
* checking CRAN incoming feasibility ... Note_to_CRAN_maintainers
Maintainer: ‘Johannes Ranke <jranke@uni-bremen.de>’
diff --git a/docs/404.html b/docs/404.html
index 42423c5d..45a45f3e 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://pkgdown.jrwb.de/mkin/index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
diff --git a/docs/articles/index.html b/docs/articles/index.html
index 369b506c..66393487 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
diff --git a/docs/authors.html b/docs/authors.html
index f5c6160c..0f68e2ce 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
diff --git a/docs/index.html b/docs/index.html
index c7b2e277..bcdaa7e4 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -37,7 +37,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
@@ -146,7 +146,7 @@
<li>Three different error models can be selected using the argument <code>error_model</code> to the <a href="https://pkgdown.jrwb.de/mkin/reference/mkinfit.html"><code>mkinfit</code></a> function.</li>
<li>The ‘variance by variable’ error model which is often fitted using Iteratively Reweighted Least Squares (IRLS) should now be specified as <code>error_model = "obs"</code>.</li>
<li>A two-component error model similar to the one proposed by <a href="https://pkgdown.jrwb.de/mkin/reference/sigma_twocomp.html">Rocke and Lorenzato</a> can be selected using the argument <code>error_model = "tc"</code>.</li>
-<li>Nonlinear mixed-effects models can be created from fits of the same degradation model to different datasets for the same compound by using the <a href="https://pkgdown.jrwb.de/mkin/reference/nlme.mmkin.html">nlme.mmkin</a> method.</li>
+<li>Nonlinear mixed-effects models can be created from fits of the same degradation model to different datasets for the same compound by using the <a href="https://pkgdown.jrwb.de/mkin/reference/nlme.mmkin.html">nlme.mmkin</a> method. Note that the convergence of the nlme fits depends on the quality of the data. Convergence is better for simple models and data for many groups (e.g. soils).</li>
</ul>
</div>
<div id="gui" class="section level2">
diff --git a/docs/news/index.html b/docs/news/index.html
index 88c7c49c..7a307709 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
@@ -141,9 +141,19 @@
<small>Source: <a href='https://github.com/jranke/mkin/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
+ <div id="mkin-1-0-1" class="section level1">
+<h1 class="page-header" data-toc-text="1.0.1">
+<a href="#mkin-1-0-1" class="anchor"></a>mkin 1.0.1<small> Unreleased </small>
+</h1>
+<ul>
+<li><p>‘confint.mmkin’, ‘nlme.mmkin’, ‘transform_odeparms’: Fix example code in dontrun sections that failed with current defaults</p></li>
+<li><p>‘logLik.mkinfit’: Improve example code to avoid warnings and show convenient syntax</p></li>
+<li><p>‘mkinresplot’: Re-add Katrin Lindenberger as coauthor who was accidentally removed long ago</p></li>
+</ul>
+</div>
<div id="mkin-1-0-0" class="section level1">
<h1 class="page-header" data-toc-text="1.0.0">
-<a href="#mkin-1-0-0" class="anchor"></a>mkin 1.0.0<small> Unreleased </small>
+<a href="#mkin-1-0-0" class="anchor"></a>mkin 1.0.0<small> 2021-02-03 </small>
</h1>
<div id="general" class="section level2">
<h2 class="hasAnchor">
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 6c5f8bc3..d05f3168 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -10,7 +10,7 @@ articles:
web_only/NAFTA_examples: NAFTA_examples.html
web_only/benchmarks: benchmarks.html
web_only/compiled_models: compiled_models.html
-last_built: 2021-02-03T16:42Z
+last_built: 2021-02-04T10:34Z
urls:
reference: https://pkgdown.jrwb.de/mkin/reference
article: https://pkgdown.jrwb.de/mkin/articles
diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png
index 7f498242..17a35806 100644
--- a/docs/reference/Rplot001.png
+++ b/docs/reference/Rplot001.png
Binary files differ
diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png
index 54c31a3f..bb624e64 100644
--- a/docs/reference/Rplot002.png
+++ b/docs/reference/Rplot002.png
Binary files differ
diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png
index 19198739..e96adeb3 100644
--- a/docs/reference/Rplot003.png
+++ b/docs/reference/Rplot003.png
Binary files differ
diff --git a/docs/reference/Rplot004.png b/docs/reference/Rplot004.png
index ead98fba..91058d4b 100644
--- a/docs/reference/Rplot004.png
+++ b/docs/reference/Rplot004.png
Binary files differ
diff --git a/docs/reference/Rplot005.png b/docs/reference/Rplot005.png
index 949a9283..91058d4b 100644
--- a/docs/reference/Rplot005.png
+++ b/docs/reference/Rplot005.png
Binary files differ
diff --git a/docs/reference/Rplot006.png b/docs/reference/Rplot006.png
index da52f580..74f43dfa 100644
--- a/docs/reference/Rplot006.png
+++ b/docs/reference/Rplot006.png
Binary files differ
diff --git a/docs/reference/confint.mkinfit.html b/docs/reference/confint.mkinfit.html
index 4f7e8872..b71e039a 100644
--- a/docs/reference/confint.mkinfit.html
+++ b/docs/reference/confint.mkinfit.html
@@ -273,68 +273,69 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37,
<span class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/identical.html'>identical</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.getenv.html'>Sys.getenv</a></span><span class='op'>(</span><span class='st'>"NOT_CRAN"</span><span class='op'>)</span>, <span class='st'>"true"</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span>
<span class='va'>n_cores</span> <span class='op'>&lt;-</span> <span class='fu'>parallel</span><span class='fu'>::</span><span class='fu'><a href='https://rdrr.io/r/parallel/detectCores.html'>detectCores</a></span><span class='op'>(</span><span class='op'>)</span> <span class='op'>-</span> <span class='fl'>1</span>
<span class='op'>}</span> <span class='kw'>else</span> <span class='op'>{</span>
- <span class='va'>n_cores</span> <span class='op'>&lt;-</span> <span class='fl'>1</span>
+ <span class='va'>n_cores</span> <span class='op'>&lt;-</span> <span class='fl'>1</span>
<span class='op'>}</span>
<span class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.getenv.html'>Sys.getenv</a></span><span class='op'>(</span><span class='st'>"TRAVIS"</span><span class='op'>)</span> <span class='op'>!=</span> <span class='st'>""</span><span class='op'>)</span> <span class='va'>n_cores</span> <span class='op'>=</span> <span class='fl'>1</span>
<span class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>Sys.info</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='st'>"sysname"</span><span class='op'>]</span> <span class='op'>==</span> <span class='st'>"Windows"</span><span class='op'>)</span> <span class='va'>n_cores</span> <span class='op'>=</span> <span class='fl'>1</span>
-<span class='va'>SFO_SFO</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"m1"</span><span class='op'>)</span>, m1 <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
+<span class='va'>SFO_SFO</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"m1"</span><span class='op'>)</span>, m1 <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span>,
+ use_of_ff <span class='op'>=</span> <span class='st'>"min"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='va'>SFO_SFO.ff</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"m1"</span><span class='op'>)</span>, m1 <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span>,
use_of_ff <span class='op'>=</span> <span class='st'>"max"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='va'>f_d_1</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span><span class='op'>(</span><span class='va'>FOCUS_2006_D</span>, <span class='va'>value</span> <span class='op'>!=</span> <span class='fl'>0</span><span class='op'>)</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'><a href='https://rdrr.io/r/base/system.time.html'>system.time</a></span><span class='op'>(</span><span class='va'>ci_profile</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span><span class='va'>f_d_1</span>, method <span class='op'>=</span> <span class='st'>"profile"</span>, cores <span class='op'>=</span> <span class='fl'>1</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span><span class='op'>)</span>
</div><div class='output co'>#&gt; user system elapsed
-#&gt; 3.796 1.056 3.506 </div><div class='input'><span class='co'># Using more cores does not save much time here, as parent_0 takes up most of the time</span>
+#&gt; 4.324 0.980 3.960 </div><div class='input'><span class='co'># Using more cores does not save much time here, as parent_0 takes up most of the time</span>
<span class='co'># If we additionally exclude parent_0 (the confidence of which is often of</span>
-<span class='co'># minor interest), we get a nice performance improvement from about 50</span>
-<span class='co'># seconds to about 12 seconds if we use at least four cores</span>
+<span class='co'># minor interest), we get a nice performance improvement if we use at least 4 cores</span>
<span class='fu'><a href='https://rdrr.io/r/base/system.time.html'>system.time</a></span><span class='op'>(</span><span class='va'>ci_profile_no_parent_0</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span><span class='va'>f_d_1</span>, method <span class='op'>=</span> <span class='st'>"profile"</span>,
<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"k_parent_sink"</span>, <span class='st'>"k_parent_m1"</span>, <span class='st'>"k_m1_sink"</span>, <span class='st'>"sigma"</span><span class='op'>)</span>, cores <span class='op'>=</span> <span class='va'>n_cores</span><span class='op'>)</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='message'>Profiling the likelihood</span></div><div class='output co'>#&gt; <span class='warning'>Warning: scheduled cores 2, 1, 3 encountered errors in user code, all values of the jobs will be affected</span></div><div class='output co'>#&gt; <span class='error'>Error in dimnames(x) &lt;- dn: length of 'dimnames' [2] not equal to array extent</span></div><div class='output co'>#&gt; <span class='message'>Timing stopped at: 0 0.043 0.246</span></div><div class='input'><span class='va'>ci_profile</span>
-</div><div class='output co'>#&gt; 2.5% 97.5%
-#&gt; parent_0 96.456003640 1.027703e+02
-#&gt; k_parent 0.090911032 1.071578e-01
-#&gt; k_m1 0.003892606 6.702775e-03
-#&gt; f_parent_to_m1 0.471328495 5.611550e-01
-#&gt; sigma 2.535612399 3.985263e+00</div><div class='input'><span class='va'>ci_quadratic_transformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span><span class='va'>f_d_1</span>, method <span class='op'>=</span> <span class='st'>"quadratic"</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; <span class='message'>Profiling the likelihood</span></div><div class='output co'>#&gt; user system elapsed
+#&gt; 1.480 0.109 0.905 </div><div class='input'><span class='va'>ci_profile</span>
+</div><div class='output co'>#&gt; 2.5% 97.5%
+#&gt; parent_0 96.456003640 1.027703e+02
+#&gt; k_parent_sink 0.040762501 5.549764e-02
+#&gt; k_parent_m1 0.046786482 5.500879e-02
+#&gt; k_m1_sink 0.003892605 6.702778e-03
+#&gt; sigma 2.535612399 3.985263e+00</div><div class='input'><span class='va'>ci_quadratic_transformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span><span class='va'>f_d_1</span>, method <span class='op'>=</span> <span class='st'>"quadratic"</span><span class='op'>)</span>
<span class='va'>ci_quadratic_transformed</span>
-</div><div class='output co'>#&gt; 2.5% 97.5%
-#&gt; parent_0 96.403833585 102.79311650
-#&gt; k_parent 0.090823771 0.10725430
-#&gt; k_m1 0.004012219 0.00689755
-#&gt; f_parent_to_m1 0.469118824 0.55959615
-#&gt; sigma 2.396089689 3.85491806</div><div class='input'><span class='va'>ci_quadratic_untransformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span><span class='va'>f_d_1</span>, method <span class='op'>=</span> <span class='st'>"quadratic"</span>, transformed <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; 2.5% 97.5%
+#&gt; parent_0 96.403841640 1.027931e+02
+#&gt; k_parent_sink 0.041033378 5.596269e-02
+#&gt; k_parent_m1 0.046777902 5.511931e-02
+#&gt; k_m1_sink 0.004012217 6.897547e-03
+#&gt; sigma 2.396089689 3.854918e+00</div><div class='input'><span class='va'>ci_quadratic_untransformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span><span class='va'>f_d_1</span>, method <span class='op'>=</span> <span class='st'>"quadratic"</span>, transformed <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='va'>ci_quadratic_untransformed</span>
-</div><div class='output co'>#&gt; 2.5% 97.5%
-#&gt; parent_0 96.403833589 1.027931e+02
-#&gt; k_parent 0.090491913 1.069035e-01
-#&gt; k_m1 0.003835485 6.685823e-03
-#&gt; f_parent_to_m1 0.469113477 5.598387e-01
-#&gt; sigma 2.396089689 3.854918e+00</div><div class='input'><span class='co'># Against the expectation based on Bates and Watts (1988), the confidence</span>
+</div><div class='output co'>#&gt; 2.5% 97.5%
+#&gt; parent_0 96.403841645 102.79312449
+#&gt; k_parent_sink 0.040485331 0.05535491
+#&gt; k_parent_m1 0.046611582 0.05494364
+#&gt; k_m1_sink 0.003835483 0.00668582
+#&gt; sigma 2.396089689 3.85491806</div><div class='input'><span class='co'># Against the expectation based on Bates and Watts (1988), the confidence</span>
<span class='co'># intervals based on the internal parameter transformation are less</span>
<span class='co'># congruent with the likelihood based intervals. Note the superiority of the</span>
<span class='co'># interval based on the untransformed fit for k_m1_sink</span>
<span class='va'>rel_diffs_transformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/MathFun.html'>abs</a></span><span class='op'>(</span><span class='op'>(</span><span class='va'>ci_quadratic_transformed</span> <span class='op'>-</span> <span class='va'>ci_profile</span><span class='op'>)</span><span class='op'>/</span><span class='va'>ci_profile</span><span class='op'>)</span>
<span class='va'>rel_diffs_untransformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/MathFun.html'>abs</a></span><span class='op'>(</span><span class='op'>(</span><span class='va'>ci_quadratic_untransformed</span> <span class='op'>-</span> <span class='va'>ci_profile</span><span class='op'>)</span><span class='op'>/</span><span class='va'>ci_profile</span><span class='op'>)</span>
<span class='va'>rel_diffs_transformed</span> <span class='op'>&lt;</span> <span class='va'>rel_diffs_untransformed</span>
-</div><div class='output co'>#&gt; 2.5% 97.5%
-#&gt; parent_0 FALSE FALSE
-#&gt; k_parent TRUE TRUE
-#&gt; k_m1 FALSE FALSE
-#&gt; f_parent_to_m1 TRUE FALSE
-#&gt; sigma TRUE FALSE</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/Round.html'>signif</a></span><span class='op'>(</span><span class='va'>rel_diffs_transformed</span>, <span class='fl'>3</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; 2.5% 97.5%
-#&gt; parent_0 0.000541 0.000222
-#&gt; k_parent 0.000960 0.000900
-#&gt; k_m1 0.030700 0.029100
-#&gt; f_parent_to_m1 0.004690 0.002780
-#&gt; sigma 0.055000 0.032700</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/Round.html'>signif</a></span><span class='op'>(</span><span class='va'>rel_diffs_untransformed</span>, <span class='fl'>3</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; 2.5% 97.5%
-#&gt; parent_0 0.000541 0.000222
-#&gt; k_parent 0.004610 0.002370
-#&gt; k_m1 0.014700 0.002530
-#&gt; f_parent_to_m1 0.004700 0.002350
-#&gt; sigma 0.055000 0.032700</div><div class='input'>
+</div><div class='output co'>#&gt; 2.5% 97.5%
+#&gt; parent_0 FALSE FALSE
+#&gt; k_parent_sink TRUE FALSE
+#&gt; k_parent_m1 TRUE FALSE
+#&gt; k_m1_sink FALSE FALSE
+#&gt; sigma FALSE FALSE</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/Round.html'>signif</a></span><span class='op'>(</span><span class='va'>rel_diffs_transformed</span>, <span class='fl'>3</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; 2.5% 97.5%
+#&gt; parent_0 0.000541 0.000222
+#&gt; k_parent_sink 0.006650 0.008380
+#&gt; k_parent_m1 0.000183 0.002010
+#&gt; k_m1_sink 0.030700 0.029100
+#&gt; sigma 0.055000 0.032700</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/Round.html'>signif</a></span><span class='op'>(</span><span class='va'>rel_diffs_untransformed</span>, <span class='fl'>3</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; 2.5% 97.5%
+#&gt; parent_0 0.000541 0.000222
+#&gt; k_parent_sink 0.006800 0.002570
+#&gt; k_parent_m1 0.003740 0.001180
+#&gt; k_m1_sink 0.014700 0.002530
+#&gt; sigma 0.055000 0.032700</div><div class='input'>
<span class='co'># Investigate a case with formation fractions</span>
<span class='va'>f_d_2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO.ff</span>, <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span><span class='op'>(</span><span class='va'>FOCUS_2006_D</span>, <span class='va'>value</span> <span class='op'>!=</span> <span class='fl'>0</span><span class='op'>)</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
diff --git a/docs/reference/index.html b/docs/reference/index.html
index c9f66992..0859a152 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
@@ -175,7 +175,7 @@
</tr><tr>
<td>
- <p><code><a href="mmkin.html">mmkin()</a></code> </p>
+ <p><code><a href="mmkin.html">mmkin()</a></code> <code><a href="mmkin.html">print(<i>&lt;mmkin&gt;</i>)</a></code> </p>
</td>
<td><p>Fit one or more kinetic models with one or more state variables to one or
more datasets</p></td>
@@ -297,12 +297,6 @@ of an mmkin object</p></td>
<p><code><a href="AIC.mmkin.html">AIC(<i>&lt;mmkin&gt;</i>)</a></code> <code><a href="AIC.mmkin.html">BIC(<i>&lt;mmkin&gt;</i>)</a></code> </p>
</td>
<td><p>Calculate the AIC for a column of an mmkin object</p></td>
- </tr><tr>
-
- <td>
- <p><code><a href="print.mmkin.html">print(<i>&lt;mmkin&gt;</i>)</a></code> </p>
- </td>
- <td><p>Print method for mmkin objects</p></td>
</tr>
</tbody><tbody>
<tr>
diff --git a/docs/reference/logLik.mkinfit.html b/docs/reference/logLik.mkinfit.html
index ac3f570c..8d984e55 100644
--- a/docs/reference/logLik.mkinfit.html
+++ b/docs/reference/logLik.mkinfit.html
@@ -196,11 +196,11 @@ and the fitted error model parameters.</p>
parent <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, to <span class='op'>=</span> <span class='st'>"m1"</span><span class='op'>)</span>,
m1 <span class='op'>=</span> <span class='fu'><a href='mkinmod.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span>
<span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='message'>Temporary DLL for differentials generated and loaded</span></div><div class='input'> <span class='va'>d_t</span> <span class='op'>&lt;-</span> <span class='va'>FOCUS_2006_D</span>
+</div><div class='output co'>#&gt; <span class='message'>Temporary DLL for differentials generated and loaded</span></div><div class='input'> <span class='va'>d_t</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span><span class='op'>(</span><span class='va'>FOCUS_2006_D</span>, <span class='va'>value</span> <span class='op'>!=</span> <span class='fl'>0</span><span class='op'>)</span>
<span class='va'>f_nw</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>sfo_sfo</span>, <span class='va'>d_t</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> <span class='co'># no weighting (weights are unity)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'> <span class='va'>f_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>sfo_sfo</span>, <span class='va'>d_t</span>, error_model <span class='op'>=</span> <span class='st'>"obs"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'> <span class='va'>f_tc</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>sfo_sfo</span>, <span class='va'>d_t</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'> <span class='fu'><a href='https://rdrr.io/r/stats/AIC.html'>AIC</a></span><span class='op'>(</span><span class='va'>f_nw</span>, <span class='va'>f_obs</span>, <span class='va'>f_tc</span><span class='op'>)</span>
+ <span class='va'>f_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>f_nw</span>, error_model <span class='op'>=</span> <span class='st'>"obs"</span><span class='op'>)</span>
+ <span class='va'>f_tc</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>f_nw</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span>
+ <span class='fu'><a href='https://rdrr.io/r/stats/AIC.html'>AIC</a></span><span class='op'>(</span><span class='va'>f_nw</span>, <span class='va'>f_obs</span>, <span class='va'>f_tc</span><span class='op'>)</span>
</div><div class='output co'>#&gt; df AIC
#&gt; f_nw 5 204.4486
#&gt; f_obs 6 205.8727
diff --git a/docs/reference/mkinresplot.html b/docs/reference/mkinresplot.html
index a9638c93..69517f36 100644
--- a/docs/reference/mkinresplot.html
+++ b/docs/reference/mkinresplot.html
@@ -242,7 +242,7 @@ lines of the mkinfit object, and <code><a href='plot.mkinfit.html'>plot_res</a><
combining the plot of the fit and the residual plot.</p></div>
<h2 class="hasAnchor" id="author"><a class="anchor" href="#author"></a>Author</h2>
- <p>Johannes Ranke</p>
+ <p>Johannes Ranke and Katrin Lindenberger</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'>
diff --git a/docs/reference/mmkin.html b/docs/reference/mmkin.html
index 20134030..77f815da 100644
--- a/docs/reference/mmkin.html
+++ b/docs/reference/mmkin.html
@@ -158,7 +158,10 @@ datasets specified in its first two arguments.</p>
cores <span class='op'>=</span> <span class='fu'>parallel</span><span class='fu'>::</span><span class='fu'><a href='https://rdrr.io/r/parallel/detectCores.html'>detectCores</a></span><span class='op'>(</span><span class='op'>)</span>,
cluster <span class='op'>=</span> <span class='cn'>NULL</span>,
<span class='va'>...</span>
-<span class='op'>)</span></pre>
+<span class='op'>)</span>
+
+<span class='co'># S3 method for mmkin</span>
+<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>x</span>, <span class='va'>...</span><span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
@@ -189,7 +192,11 @@ for parallel execution.</p></td>
</tr>
<tr>
<th>...</th>
- <td><p>Further arguments that will be passed to <code><a href='mkinfit.html'>mkinfit</a></code>.</p></td>
+ <td><p>Not used.</p></td>
+ </tr>
+ <tr>
+ <th>x</th>
+ <td><p>An mmkin object.</p></td>
</tr>
</table>
@@ -227,9 +234,9 @@ plotting.</p></div>
<span class='va'>time_default</span>
</div><div class='output co'>#&gt; user system elapsed
-#&gt; 4.869 0.357 1.415 </div><div class='input'><span class='va'>time_1</span>
+#&gt; 4.634 0.317 1.280 </div><div class='input'><span class='va'>time_1</span>
</div><div class='output co'>#&gt; user system elapsed
-#&gt; 5.502 0.002 5.507 </div><div class='input'>
+#&gt; 5.249 0.016 5.267 </div><div class='input'>
<span class='fu'><a href='endpoints.html'>endpoints</a></span><span class='op'>(</span><span class='va'>fits.0</span><span class='op'>[[</span><span class='st'>"SFO_lin"</span>, <span class='fl'>2</span><span class='op'>]</span><span class='op'>]</span><span class='op'>)</span>
</div><div class='output co'>#&gt; $ff
#&gt; parent_M1 parent_sink M1_M2 M1_sink
diff --git a/docs/reference/nlme.mmkin-3.png b/docs/reference/nlme.mmkin-3.png
index 0b7ce0f6..7c04df4b 100644
--- a/docs/reference/nlme.mmkin-3.png
+++ b/docs/reference/nlme.mmkin-3.png
Binary files differ
diff --git a/docs/reference/nlme.mmkin.html b/docs/reference/nlme.mmkin.html
index dd1670fe..2e4f6337 100644
--- a/docs/reference/nlme.mmkin.html
+++ b/docs/reference/nlme.mmkin.html
@@ -157,7 +157,7 @@ have been obtained by fitting the same model to a list of datasets.</p>
data <span class='op'>=</span> <span class='st'>"auto"</span>,
fixed <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>as.list</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span><span class='op'>(</span><span class='fu'><a href='nlme_function.html'>mean_degparms</a></span><span class='op'>(</span><span class='va'>model</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>el</span><span class='op'>)</span> <span class='fu'><a href='https://rdrr.io/r/base/eval.html'>eval</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/parse.html'>parse</a></span><span class='op'>(</span>text <span class='op'>=</span>
<span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='va'>el</span>, <span class='fl'>1</span>, sep <span class='op'>=</span> <span class='st'>"~"</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
- random <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/pdDiag.html'>pdDiag</a></span><span class='op'>(</span><span class='va'>fixed</span><span class='op'>)</span>,
+ random <span class='op'>=</span> <span class='fu'>pdDiag</span><span class='op'>(</span><span class='va'>fixed</span><span class='op'>)</span>,
<span class='va'>groups</span>,
start <span class='op'>=</span> <span class='fu'><a href='nlme_function.html'>mean_degparms</a></span><span class='op'>(</span><span class='va'>model</span>, random <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>,
correlation <span class='op'>=</span> <span class='cn'>NULL</span>,
@@ -262,6 +262,12 @@ parameters taken from the mmkin object are used</p></td>
<p>Upon success, a fitted 'nlme.mmkin' object, which is an nlme object
with additional elements. It also inherits from 'mixed.mmkin'.</p>
+ <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
+
+ <p>Note that the convergence of the nlme algorithms depends on the quality
+of the data. In degradation kinetics, we often only have few datasets
+(e.g. data for few soils) and complicated degradation models, which may
+make it impossible to obtain convergence with nlme.</p>
<h2 class="hasAnchor" id="note"><a class="anchor" href="#note"></a>Note</h2>
<p>As the object inherits from <a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme::nlme</a>, there is a wealth of
@@ -335,16 +341,17 @@ methods that will automatically work on 'nlme.mmkin' objects, such as
<span class='co'># f_nlme_sfo_sfo_ff &lt;- nlme(f_2["SFO-SFO-ff", ])</span>
<span class='co'>#plot(f_nlme_sfo_sfo_ff)</span>
- <span class='co'># With the log-Cholesky parameterization, this converges in 11</span>
- <span class='co'># iterations and around 100 seconds, but without tweaking control</span>
- <span class='co'># parameters (with pdDiag, increasing the tolerance and pnlsMaxIter was</span>
- <span class='co'># necessary)</span>
- <span class='va'>f_nlme_dfop_sfo</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in nlme.formula(model = value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_A1, f_parent_qlogis, log_k1, log_k2, g_qlogis), data = structure(list(ds = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L ), .Label = c("1", "2", "3", "4", "5"), class = c("ordered", "factor")), name = c("parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1"), time = c(0, 0, 3, 3, 6, 6, 10, 10, 20, 20, 34, 34, 55, 55, 90, 90, 112, 112, 132, 132, 3, 3, 6, 6, 10, 10, 20, 20, 34, 34, 55, 55, 90, 90, 112, 112, 132, 132, 0, 0, 3, 3, 7, 7, 14, 14, 30, 30, 60, 60, 90, 90, 120, 120, 180, 180, 3, 3, 7, 7, 14, 14, 30, 30, 60, 60, 90, 90, 120, 120, 180, 180, 0, 0, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 0, 0, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 91, 91, 120, 120, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 91, 91, 120, 120, 0, 0, 8, 8, 14, 14, 21, 21, 41, 41, 63, 63, 91, 91, 120, 120, 8, 8, 14, 14, 21, 21, 41, 41, 63, 63, 91, 91, 120, 120), value = c(97.2, 96.4, 71.1, 69.2, 58.1, 56.6, 44.4, 43.4, 33.3, 29.2, 17.6, 18, 10.5, 9.3, 4.5, 4.7, 3, 3.4, 2.3, 2.7, 4.3, 4.6, 7, 7.2, 8.2, 8, 11, 13.7, 11.5, 12.7, 14.9, 14.5, 12.1, 12.3, 9.9, 10.2, 8.8, 7.8, 93.6, 92.3, 87, 82.2, 74, 73.9, 64.2, 69.5, 54, 54.6, 41.1, 38.4, 32.5, 35.5, 28.1, 29, 26.5, 27.6, 3.9, 3.1, 6.9, 6.6, 10.4, 8.3, 14.4, 13.7, 22.1, 22.3, 27.5, 25.4, 28, 26.6, 25.8, 25.3, 91.9, 90.8, 64.9, 66.2, 43.5, 44.1, 18.3, 18.1, 10.2, 10.8, 4.9, 3.3, 1.6, 1.5, 1.1, 0.9, 9.6, 7.7, 15, 15.1, 21.2, 21.1, 19.7, 18.9, 17.5, 15.9, 9.5, 9.8, 6.2, 6.1, 99.8, 98.3, 77.1, 77.2, 59, 58.1, 27.4, 29.2, 19.1, 29.6, 10.1, 18.2, 4.5, 9.1, 2.3, 2.9, 2, 1.8, 2, 2.2, 4.2, 3.9, 7.4, 7.9, 14.5, 13.7, 14.2, 12.2, 13.7, 13.2, 13.6, 15.4, 10.4, 11.6, 10, 9.5, 9.1, 9, 96.1, 94.3, 73.9, 73.9, 69.4, 73.1, 65.6, 65.3, 55.9, 54.4, 47, 49.3, 44.7, 46.7, 42.1, 41.3, 3.3, 3.4, 3.9, 2.9, 6.4, 7.2, 9.1, 8.5, 11.7, 12, 13.3, 13.2, 14.3, 12.1)), row.names = c(NA, -170L), class = c("nfnGroupedData", "nfGroupedData", "groupedData", "data.frame"), formula = value ~ time | ds, FUN = function (x) max(x, na.rm = TRUE), order.groups = FALSE), start = list( fixed = c(parent_0 = 93.8101519326534, log_k_A1 = -9.76474551635931, f_parent_qlogis = -0.971114801595408, log_k1 = -1.87993711571859, log_k2 = -4.27081421366622, g_qlogis = 0.135644115277507 ), random = list(ds = structure(c(2.56569977430371, -3.49441920289139, -3.32614443321494, 4.35347873814922, -0.0986148763466161, 4.65850590018027, 1.8618544764481, 6.12693257601545, 4.91792724701579, -17.5652201996596, -0.466203822618637, 0.746660653597927, 0.282193987271096, -0.42053488943072, -0.142115928819667, 0.369240076779088, -1.38985563501659, 1.02592753494098, 0.73090914081534, -0.736221117518819, 0.768170629350299, -1.89347658079869, 1.72168783460352, 0.844607177798114, -1.44098906095325, -0.377731855445672, 0.168180098477565, 0.469683412912104, 0.500717664434525, -0.760849320378522), .Dim = 5:6, .Dimnames = list(c("1", "2", "3", "4", "5"), c("parent_0", "log_k_A1", "f_parent_qlogis", "log_k1", "log_k2", "g_qlogis"))))), fixed = list(parent_0 ~ 1, log_k_A1 ~ 1, f_parent_qlogis ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1), random = structure(numeric(0), class = c("pdDiag", "pdMat"), formula = structure(list(parent_0 ~ 1, log_k_A1 ~ 1, f_parent_qlogis ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1), class = "listForm"), Dimnames = list(NULL, NULL))): maximum number of iterations (maxIter = 50) reached without convergence</span></div><div class='output co'>#&gt; <span class='message'>Timing stopped at: 48.39 16.98 43</span></div><div class='input'>
+ <span class='co'># For the following, we need to increase pnlsMaxIter and the tolerance</span>
+ <span class='co'># to get convergence</span>
+ <span class='va'>f_nlme_dfop_sfo</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span>,
+ control <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>pnlsMaxIter <span class='op'>=</span> <span class='fl'>120</span>, tolerance <span class='op'>=</span> <span class='fl'>5e-4</span><span class='op'>)</span><span class='op'>)</span>
+
<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f_nlme_dfop_sfo</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in plot(f_nlme_dfop_sfo): object 'f_nlme_dfop_sfo' not found</span></div><div class='input'>
+</div><div class='img'><img src='nlme.mmkin-3.png' alt='' width='700' height='433' /></div><div class='input'>
<span class='fu'><a href='https://rdrr.io/r/stats/anova.html'>anova</a></span><span class='op'>(</span><span class='va'>f_nlme_dfop_sfo</span>, <span class='va'>f_nlme_sfo_sfo</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo): object 'f_nlme_dfop_sfo' not found</span></div><div class='input'>
+</div><div class='output co'>#&gt; Model df AIC BIC logLik Test L.Ratio p-value
+#&gt; f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9274
+#&gt; f_nlme_sfo_sfo 2 9 1085.1821 1113.4043 -533.5910 1 vs 2 249.3274 &lt;.0001</div><div class='input'>
<span class='fu'><a href='endpoints.html'>endpoints</a></span><span class='op'>(</span><span class='va'>f_nlme_sfo_sfo</span><span class='op'>)</span>
</div><div class='output co'>#&gt; $ff
#&gt; parent_sink parent_A1 A1_sink
@@ -355,7 +362,15 @@ methods that will automatically work on 'nlme.mmkin' objects, such as
#&gt; parent 19.13518 63.5657
#&gt; A1 66.02155 219.3189
#&gt; </div><div class='input'> <span class='fu'><a href='endpoints.html'>endpoints</a></span><span class='op'>(</span><span class='va'>f_nlme_dfop_sfo</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in endpoints(f_nlme_dfop_sfo): object 'f_nlme_dfop_sfo' not found</span></div><div class='input'>
+</div><div class='output co'>#&gt; $ff
+#&gt; parent_A1 parent_sink
+#&gt; 0.2768574 0.7231426
+#&gt;
+#&gt; $distimes
+#&gt; DT50 DT90 DT50back DT50_k1 DT50_k2
+#&gt; parent 11.07091 104.6320 31.49738 4.462384 46.20825
+#&gt; A1 162.30523 539.1663 NA NA NA
+#&gt; </div><div class='input'>
<span class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span><span class='op'>(</span><span class='fu'>findFunction</span><span class='op'>(</span><span class='st'>"varConstProp"</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>&gt;</span> <span class='fl'>0</span><span class='op'>)</span> <span class='op'>{</span> <span class='co'># tc error model for nlme available</span>
<span class='co'># Attempts to fit metabolite kinetics with the tc error model are possible,</span>
<span class='co'># but need tweeking of control values and sometimes do not converge</span>
@@ -396,9 +411,7 @@ methods that will automatically work on 'nlme.mmkin' objects, such as
#&gt; Parameter estimates:
#&gt; const prop
#&gt; 2.23224114 0.01262341 </div><div class='input'>
- <span class='va'>f_2_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='st'>"SFO-SFO"</span> <span class='op'>=</span> <span class='va'>m_sfo_sfo</span>,
- <span class='st'>"DFOP-SFO"</span> <span class='op'>=</span> <span class='va'>m_dfop_sfo</span><span class='op'>)</span>,
- <span class='va'>ds_2</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"obs"</span><span class='op'>)</span>
+ <span class='va'>f_2_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>f_2</span>, error_model <span class='op'>=</span> <span class='st'>"obs"</span><span class='op'>)</span>
<span class='va'>f_nlme_sfo_sfo_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2_obs</span><span class='op'>[</span><span class='st'>"SFO-SFO"</span>, <span class='op'>]</span><span class='op'>)</span>
<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>f_nlme_sfo_sfo_obs</span><span class='op'>)</span>
</div><div class='output co'>#&gt; Kinetic nonlinear mixed-effects model fit by maximum likelihood
@@ -429,18 +442,21 @@ methods that will automatically work on 'nlme.mmkin' objects, such as
#&gt; Formula: ~1 | name
#&gt; Parameter estimates:
#&gt; parent A1
-#&gt; 1.0000000 0.2050003 </div><div class='input'> <span class='va'>f_nlme_dfop_sfo_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2_obs</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in nlme.formula(model = value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_A1, f_parent_qlogis, log_k1, log_k2, g_qlogis), data = structure(list(ds = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L ), .Label = c("1", "2", "3", "4", "5"), class = c("ordered", "factor")), name = c("parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "parent", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1"), time = c(0, 0, 3, 3, 6, 6, 10, 10, 20, 20, 34, 34, 55, 55, 90, 90, 112, 112, 132, 132, 3, 3, 6, 6, 10, 10, 20, 20, 34, 34, 55, 55, 90, 90, 112, 112, 132, 132, 0, 0, 3, 3, 7, 7, 14, 14, 30, 30, 60, 60, 90, 90, 120, 120, 180, 180, 3, 3, 7, 7, 14, 14, 30, 30, 60, 60, 90, 90, 120, 120, 180, 180, 0, 0, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 0, 0, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 91, 91, 120, 120, 1, 1, 3, 3, 8, 8, 14, 14, 27, 27, 48, 48, 70, 70, 91, 91, 120, 120, 0, 0, 8, 8, 14, 14, 21, 21, 41, 41, 63, 63, 91, 91, 120, 120, 8, 8, 14, 14, 21, 21, 41, 41, 63, 63, 91, 91, 120, 120), value = c(97.2, 96.4, 71.1, 69.2, 58.1, 56.6, 44.4, 43.4, 33.3, 29.2, 17.6, 18, 10.5, 9.3, 4.5, 4.7, 3, 3.4, 2.3, 2.7, 4.3, 4.6, 7, 7.2, 8.2, 8, 11, 13.7, 11.5, 12.7, 14.9, 14.5, 12.1, 12.3, 9.9, 10.2, 8.8, 7.8, 93.6, 92.3, 87, 82.2, 74, 73.9, 64.2, 69.5, 54, 54.6, 41.1, 38.4, 32.5, 35.5, 28.1, 29, 26.5, 27.6, 3.9, 3.1, 6.9, 6.6, 10.4, 8.3, 14.4, 13.7, 22.1, 22.3, 27.5, 25.4, 28, 26.6, 25.8, 25.3, 91.9, 90.8, 64.9, 66.2, 43.5, 44.1, 18.3, 18.1, 10.2, 10.8, 4.9, 3.3, 1.6, 1.5, 1.1, 0.9, 9.6, 7.7, 15, 15.1, 21.2, 21.1, 19.7, 18.9, 17.5, 15.9, 9.5, 9.8, 6.2, 6.1, 99.8, 98.3, 77.1, 77.2, 59, 58.1, 27.4, 29.2, 19.1, 29.6, 10.1, 18.2, 4.5, 9.1, 2.3, 2.9, 2, 1.8, 2, 2.2, 4.2, 3.9, 7.4, 7.9, 14.5, 13.7, 14.2, 12.2, 13.7, 13.2, 13.6, 15.4, 10.4, 11.6, 10, 9.5, 9.1, 9, 96.1, 94.3, 73.9, 73.9, 69.4, 73.1, 65.6, 65.3, 55.9, 54.4, 47, 49.3, 44.7, 46.7, 42.1, 41.3, 3.3, 3.4, 3.9, 2.9, 6.4, 7.2, 9.1, 8.5, 11.7, 12, 13.3, 13.2, 14.3, 12.1)), row.names = c(NA, -170L), class = c("nfnGroupedData", "nfGroupedData", "groupedData", "data.frame"), formula = value ~ time | ds, FUN = function (x) max(x, na.rm = TRUE), order.groups = FALSE), start = list( fixed = c(parent_0 = 93.4272167134207, log_k_A1 = -9.71590717106959, f_parent_qlogis = -0.953712099744438, log_k1 = -1.95256957646888, log_k2 = -4.42919226610318, g_qlogis = 0.193023137298073 ), random = list(ds = structure(c(2.85557330683041, -3.87630303729395, -2.78062140212751, 4.82042042600536, -1.01906929341432, 4.613992019697, 2.05871276943309, 6.0766404049189, 4.86471337131288, -17.6140585653619, -0.480721175257541, 0.773079218835614, 0.260464433006093, -0.440615012802434, -0.112207463781733, 0.445812953745225, -1.49588630006094, 1.13602040717272, 0.801850880762046, -0.887797941619048, 0.936480292463262, -2.43093808171905, 1.91256225793793, 0.984827519864443, -1.40293198854659, -0.455176326336681, 0.376355651864385, 0.343919720700401, 0.46329187713133, -0.728390923359434 ), .Dim = 5:6, .Dimnames = list(c("1", "2", "3", "4", "5"), c("parent_0", "log_k_A1", "f_parent_qlogis", "log_k1", "log_k2", "g_qlogis"))))), fixed = list(parent_0 ~ 1, log_k_A1 ~ 1, f_parent_qlogis ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1), random = structure(numeric(0), class = c("pdDiag", "pdMat"), formula = structure(list(parent_0 ~ 1, log_k_A1 ~ 1, f_parent_qlogis ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1), class = "listForm"), Dimnames = list(NULL, NULL)), weights = structure(numeric(0), formula = ~1 | name, class = c("varIdent", "varFunc"))): maximum number of iterations (maxIter = 50) reached without convergence</span></div><div class='output co'>#&gt; <span class='message'>Timing stopped at: 58.24 16.62 52.48</span></div><div class='input'>
- <span class='va'>f_2_tc</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='st'>"SFO-SFO"</span> <span class='op'>=</span> <span class='va'>m_sfo_sfo</span>,
- <span class='st'>"DFOP-SFO"</span> <span class='op'>=</span> <span class='va'>m_dfop_sfo</span><span class='op'>)</span>,
- <span class='va'>ds_2</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span>
- <span class='co'># f_nlme_sfo_sfo_tc &lt;- nlme(f_2_tc["SFO-SFO", ]) # stops with error message</span>
- <span class='va'>f_nlme_dfop_sfo_tc</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2_tc</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='warning'>Warning: longer object length is not a multiple of shorter object length</span></div><div class='output co'>#&gt; <span class='error'>Error in X[, fmap[[nm]]] &lt;- gradnm: number of items to replace is not a multiple of replacement length</span></div><div class='output co'>#&gt; <span class='message'>Timing stopped at: 6.327 2.686 5.428</span></div><div class='input'> <span class='co'># We get warnings about false convergence in the LME step in several iterations</span>
- <span class='co'># but as the last such warning occurs in iteration 25 and we have 28 iterations</span>
- <span class='co'># we can ignore these</span>
- <span class='fu'><a href='https://rdrr.io/r/stats/anova.html'>anova</a></span><span class='op'>(</span><span class='va'>f_nlme_dfop_sfo</span>, <span class='va'>f_nlme_dfop_sfo_obs</span>, <span class='va'>f_nlme_dfop_sfo_tc</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in anova(f_nlme_dfop_sfo, f_nlme_dfop_sfo_obs, f_nlme_dfop_sfo_tc): object 'f_nlme_dfop_sfo' not found</span></div><div class='input'>
+#&gt; 1.0000000 0.2050003 </div><div class='input'> <span class='va'>f_nlme_dfop_sfo_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2_obs</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span>,
+ control <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>pnlsMaxIter <span class='op'>=</span> <span class='fl'>120</span>, tolerance <span class='op'>=</span> <span class='fl'>5e-4</span><span class='op'>)</span><span class='op'>)</span>
+
+ <span class='va'>f_2_tc</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>f_2</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span>
+ <span class='co'># f_nlme_sfo_sfo_tc &lt;- nlme(f_2_tc["SFO-SFO", ]) # No convergence with 50 iterations</span>
+ <span class='co'># f_nlme_dfop_sfo_tc &lt;- nlme(f_2_tc["DFOP-SFO", ],</span>
+ <span class='co'># control = list(pnlsMaxIter = 120, tolerance = 5e-4)) # Error in X[, fmap[[nm]]] &lt;- gradnm</span>
+
+ <span class='fu'><a href='https://rdrr.io/r/stats/anova.html'>anova</a></span><span class='op'>(</span><span class='va'>f_nlme_dfop_sfo</span>, <span class='va'>f_nlme_dfop_sfo_obs</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; Model df AIC BIC logLik Test L.Ratio
+#&gt; f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9274
+#&gt; f_nlme_dfop_sfo_obs 2 14 817.5338 861.4350 -394.7669 1 vs 2 28.32089
+#&gt; p-value
+#&gt; f_nlme_dfop_sfo
+#&gt; f_nlme_dfop_sfo_obs &lt;.0001</div><div class='input'>
<span class='co'># }</span>
</div></pre>
</div>
diff --git a/docs/reference/transform_odeparms.html b/docs/reference/transform_odeparms.html
index efaf7b46..e2cb876b 100644
--- a/docs/reference/transform_odeparms.html
+++ b/docs/reference/transform_odeparms.html
@@ -77,7 +77,7 @@ the ilr transformation is used." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.0</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.0.1</span>
</span>
</div>
@@ -231,50 +231,64 @@ This is no problem for the internal use in <a href='mkinfit.html'>mkinfit</a>.</
<pre class="examples"><div class='input'>
<span class='va'>SFO_SFO</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>
parent <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>type <span class='op'>=</span> <span class='st'>"SFO"</span>, to <span class='op'>=</span> <span class='st'>"m1"</span>, sink <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>,
- m1 <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>type <span class='op'>=</span> <span class='st'>"SFO"</span><span class='op'>)</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='message'>Temporary DLL for differentials generated and loaded</span></div><div class='input'><span class='co'># Fit the model to the FOCUS example dataset D using defaults</span>
-<span class='va'>fit</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_2006_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='va'>fit.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit</span><span class='op'>)</span>
+ m1 <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>type <span class='op'>=</span> <span class='st'>"SFO"</span><span class='op'>)</span>, use_of_ff <span class='op'>=</span> <span class='st'>"min"</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; <span class='message'>Temporary DLL for differentials generated and loaded</span></div><div class='input'>
+<span class='co'># Fit the model to the FOCUS example dataset D using defaults</span>
+<span class='va'>FOCUS_D</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span><span class='op'>(</span><span class='va'>FOCUS_2006_D</span>, <span class='va'>value</span> <span class='op'>!=</span> <span class='fl'>0</span><span class='op'>)</span> <span class='co'># remove zero values to avoid warning</span>
+<span class='va'>fit</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
+<span class='va'>fit.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit</span><span class='op'>)</span>
<span class='co'># Transformed and backtransformed parameters</span>
<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.s</span><span class='op'>$</span><span class='va'>par</span>, <span class='fl'>3</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; Estimate Std. Error Lower Upper
-#&gt; parent_0 99.5985 1.5702 96.404 102.79
-#&gt; log_k_parent -2.3157 0.0409 -2.399 -2.23
-#&gt; log_k_m1 -5.2475 0.1332 -5.518 -4.98
-#&gt; f_parent_qlogis 0.0579 0.0893 -0.124 0.24
-#&gt; sigma 3.1255 0.3585 2.396 3.85</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.s</span><span class='op'>$</span><span class='va'>bpar</span>, <span class='fl'>3</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; Estimate se_notrans t value Pr(&gt;t) Lower Upper
-#&gt; parent_0 99.59848 1.57022 63.43 2.30e-36 96.40383 102.7931
-#&gt; k_parent 0.09870 0.00403 24.47 4.96e-23 0.09082 0.1073
-#&gt; k_m1 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069
-#&gt; f_parent_to_m1 0.51448 0.02230 23.07 3.10e-22 0.46912 0.5596
-#&gt; sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549</div><div class='input'>
+</div><div class='output co'>#&gt; Estimate Std. Error Lower Upper
+#&gt; parent_0 99.60 1.5702 96.40 102.79
+#&gt; log_k_parent_sink -3.04 0.0763 -3.19 -2.88
+#&gt; log_k_parent_m1 -2.98 0.0403 -3.06 -2.90
+#&gt; log_k_m1_sink -5.25 0.1332 -5.52 -4.98
+#&gt; sigma 3.13 0.3585 2.40 3.85</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.s</span><span class='op'>$</span><span class='va'>bpar</span>, <span class='fl'>3</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; Estimate se_notrans t value Pr(&gt;t) Lower Upper
+#&gt; parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 102.7931
+#&gt; k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04103 0.0560
+#&gt; k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04678 0.0551
+#&gt; k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069
+#&gt; sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549</div><div class='input'>
<span class='co'># \dontrun{</span>
-<span class='co'># Compare to the version without transforming rate parameters</span>
-<span class='va'>fit.2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_2006_D</span>, transform_rates <span class='op'>=</span> <span class='cn'>FALSE</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='output co'>#&gt; <span class='error'>Error in if (cost &lt; cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", signif(cost.current, 6), "\n", sep = "")}: missing value where TRUE/FALSE needed</span></div><div class='output co'>#&gt; <span class='message'>Timing stopped at: 0.003 0 0.003</span></div><div class='input'><span class='va'>fit.2.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.2</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in summary(fit.2): object 'fit.2' not found</span></div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.2.s</span><span class='op'>$</span><span class='va'>par</span>, <span class='fl'>3</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in print(fit.2.s$par, 3): object 'fit.2.s' not found</span></div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.2.s</span><span class='op'>$</span><span class='va'>bpar</span>, <span class='fl'>3</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='error'>Error in print(fit.2.s$bpar, 3): object 'fit.2.s' not found</span></div><div class='input'><span class='co'># }</span>
+<span class='co'># Compare to the version without transforming rate parameters (does not work</span>
+<span class='co'># with analytical solution, we get NA values for m1 in predictions)</span>
+<span class='va'>fit.2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, transform_rates <span class='op'>=</span> <span class='cn'>FALSE</span>,
+ solution_type <span class='op'>=</span> <span class='st'>"deSolve"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
+<span class='va'>fit.2.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.2</span><span class='op'>)</span>
+<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.2.s</span><span class='op'>$</span><span class='va'>par</span>, <span class='fl'>3</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; Estimate Std. Error Lower Upper
+#&gt; parent_0 99.59849 1.57022 96.40385 1.03e+02
+#&gt; k_parent_sink 0.04792 0.00365 0.04049 5.54e-02
+#&gt; k_parent_m1 0.05078 0.00205 0.04661 5.49e-02
+#&gt; k_m1_sink 0.00526 0.00070 0.00384 6.69e-03
+#&gt; sigma 3.12550 0.35852 2.39609 3.85e+00</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.2.s</span><span class='op'>$</span><span class='va'>bpar</span>, <span class='fl'>3</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; Estimate se_notrans t value Pr(&gt;t) Lower Upper
+#&gt; parent_0 99.59849 1.57022 63.43 2.30e-36 96.40385 1.03e+02
+#&gt; k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04049 5.54e-02
+#&gt; k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04661 5.49e-02
+#&gt; k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00384 6.69e-03
+#&gt; sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.85e+00</div><div class='input'><span class='co'># }</span>
<span class='va'>initials</span> <span class='op'>&lt;-</span> <span class='va'>fit</span><span class='op'>$</span><span class='va'>start</span><span class='op'>$</span><span class='va'>value</span>
<span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span><span class='op'>(</span><span class='va'>initials</span><span class='op'>)</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>rownames</a></span><span class='op'>(</span><span class='va'>fit</span><span class='op'>$</span><span class='va'>start</span><span class='op'>)</span>
<span class='va'>transformed</span> <span class='op'>&lt;-</span> <span class='va'>fit</span><span class='op'>$</span><span class='va'>start_transformed</span><span class='op'>$</span><span class='va'>value</span>
<span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span><span class='op'>(</span><span class='va'>transformed</span><span class='op'>)</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>rownames</a></span><span class='op'>(</span><span class='va'>fit</span><span class='op'>$</span><span class='va'>start_transformed</span><span class='op'>)</span>
<span class='fu'>transform_odeparms</span><span class='op'>(</span><span class='va'>initials</span>, <span class='va'>SFO_SFO</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; parent_0 log_k_parent log_k_m1 f_parent_qlogis
-#&gt; 100.750000 -2.302585 -2.301586 0.000000 </div><div class='input'><span class='fu'>backtransform_odeparms</span><span class='op'>(</span><span class='va'>transformed</span>, <span class='va'>SFO_SFO</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; parent_0 k_parent k_m1 f_parent_to_m1
-#&gt; 100.7500 0.1000 0.1001 0.5000 </div><div class='input'>
+</div><div class='output co'>#&gt; parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink
+#&gt; 100.750000 -2.302585 -2.301586 -2.300587 </div><div class='input'><span class='fu'>backtransform_odeparms</span><span class='op'>(</span><span class='va'>transformed</span>, <span class='va'>SFO_SFO</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; parent_0 k_parent_sink k_parent_m1 k_m1_sink
+#&gt; 100.7500 0.1000 0.1001 0.1002 </div><div class='input'>
<span class='co'># \dontrun{</span>
-<span class='co'># The case of formation fractions</span>
+<span class='co'># The case of formation fractions (this is now the default)</span>
<span class='va'>SFO_SFO.ff</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>
parent <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>type <span class='op'>=</span> <span class='st'>"SFO"</span>, to <span class='op'>=</span> <span class='st'>"m1"</span>, sink <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>,
m1 <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>type <span class='op'>=</span> <span class='st'>"SFO"</span><span class='op'>)</span>,
use_of_ff <span class='op'>=</span> <span class='st'>"max"</span><span class='op'>)</span>
</div><div class='output co'>#&gt; <span class='message'>Temporary DLL for differentials generated and loaded</span></div><div class='input'>
-<span class='va'>fit.ff</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO.ff</span>, <span class='va'>FOCUS_2006_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='va'>fit.ff.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.ff</span><span class='op'>)</span>
+<span class='va'>fit.ff</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO.ff</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
+<span class='va'>fit.ff.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.ff</span><span class='op'>)</span>
<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.ff.s</span><span class='op'>$</span><span class='va'>par</span>, <span class='fl'>3</span><span class='op'>)</span>
</div><div class='output co'>#&gt; Estimate Std. Error Lower Upper
#&gt; parent_0 99.5985 1.5702 96.404 102.79
@@ -299,8 +313,8 @@ This is no problem for the internal use in <a href='mkinfit.html'>mkinfit</a>.</
use_of_ff <span class='op'>=</span> <span class='st'>"max"</span><span class='op'>)</span>
</div><div class='output co'>#&gt; <span class='message'>Temporary DLL for differentials generated and loaded</span></div><div class='input'>
-<span class='va'>fit.ff.2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO.ff.2</span>, <span class='va'>FOCUS_2006_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='output co'>#&gt; <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='va'>fit.ff.2.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.ff.2</span><span class='op'>)</span>
+<span class='va'>fit.ff.2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span><span class='op'>(</span><span class='va'>SFO_SFO.ff.2</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
+<span class='va'>fit.ff.2.s</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.ff.2</span><span class='op'>)</span>
<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>fit.ff.2.s</span><span class='op'>$</span><span class='va'>par</span>, <span class='fl'>3</span><span class='op'>)</span>
</div><div class='output co'>#&gt; Estimate Std. Error Lower Upper
#&gt; parent_0 84.79 3.012 78.67 90.91
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
index 7e3d8a53..601a4464 100644
--- a/docs/sitemap.xml
+++ b/docs/sitemap.xml
@@ -175,9 +175,6 @@
<loc>https://pkgdown.jrwb.de/mkin/reference/plot.nafta.html</loc>
</url>
<url>
- <loc>https://pkgdown.jrwb.de/mkin/reference/print.mmkin.html</loc>
- </url>
- <url>
<loc>https://pkgdown.jrwb.de/mkin/reference/reexports.html</loc>
</url>
<url>
diff --git a/man/confint.mkinfit.Rd b/man/confint.mkinfit.Rd
index fd2890ff..b19e78c2 100644
--- a/man/confint.mkinfit.Rd
+++ b/man/confint.mkinfit.Rd
@@ -82,20 +82,20 @@ confint(f, method = "profile")
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
n_cores <- parallel::detectCores() - 1
} else {
- n_cores <- 1
+ n_cores <- 1
}
if (Sys.getenv("TRAVIS") != "") n_cores = 1
if (Sys.info()["sysname"] == "Windows") n_cores = 1
-SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), quiet = TRUE)
+SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"),
+ use_of_ff = "min", quiet = TRUE)
SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"),
use_of_ff = "max", quiet = TRUE)
f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE)
system.time(ci_profile <- confint(f_d_1, method = "profile", cores = 1, quiet = TRUE))
# Using more cores does not save much time here, as parent_0 takes up most of the time
# If we additionally exclude parent_0 (the confidence of which is often of
-# minor interest), we get a nice performance improvement from about 50
-# seconds to about 12 seconds if we use at least four cores
+# minor interest), we get a nice performance improvement if we use at least 4 cores
system.time(ci_profile_no_parent_0 <- confint(f_d_1, method = "profile",
c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores))
ci_profile
diff --git a/man/logLik.mkinfit.Rd b/man/logLik.mkinfit.Rd
index 637570e4..6b40305e 100644
--- a/man/logLik.mkinfit.Rd
+++ b/man/logLik.mkinfit.Rd
@@ -35,10 +35,10 @@ and the fitted error model parameters.
parent = mkinsub("SFO", to = "m1"),
m1 = mkinsub("SFO")
)
- d_t <- FOCUS_2006_D
+ d_t <- subset(FOCUS_2006_D, value != 0)
f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
- f_obs <- mkinfit(sfo_sfo, d_t, error_model = "obs", quiet = TRUE)
- f_tc <- mkinfit(sfo_sfo, d_t, error_model = "tc", quiet = TRUE)
+ f_obs <- update(f_nw, error_model = "obs")
+ f_tc <- update(f_nw, error_model = "tc")
AIC(f_nw, f_obs, f_tc)
}
diff --git a/man/mkinresplot.Rd b/man/mkinresplot.Rd
index 498d914d..9658ddb5 100644
--- a/man/mkinresplot.Rd
+++ b/man/mkinresplot.Rd
@@ -75,5 +75,5 @@ lines of the mkinfit object, and \code{\link{plot_res}} for a function
combining the plot of the fit and the residual plot.
}
\author{
-Johannes Ranke
+Johannes Ranke and Katrin Lindenberger
}
diff --git a/man/mmkin.Rd b/man/mmkin.Rd
index 9b836242..170ce8df 100644
--- a/man/mmkin.Rd
+++ b/man/mmkin.Rd
@@ -2,6 +2,7 @@
% Please edit documentation in R/mmkin.R
\name{mmkin}
\alias{mmkin}
+\alias{print.mmkin}
\title{Fit one or more kinetic models with one or more state variables to one or
more datasets}
\usage{
@@ -12,6 +13,8 @@ mmkin(
cluster = NULL,
...
)
+
+\method{print}{mmkin}(x, ...)
}
\arguments{
\item{models}{Either a character vector of shorthand names like
@@ -30,7 +33,9 @@ detected by \code{\link[parallel:detectCores]{parallel::detectCores()}} are used
\item{cluster}{A cluster as returned by \code{\link{makeCluster}} to be used
for parallel execution.}
-\item{\dots}{Further arguments that will be passed to \code{\link{mkinfit}}.}
+\item{\dots}{Not used.}
+
+\item{x}{An \link{mmkin} object.}
}
\value{
A two-dimensional \code{\link{array}} of \code{\link{mkinfit}}
diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd
index f78256ac..2fb0488a 100644
--- a/man/nlme.mmkin.Rd
+++ b/man/nlme.mmkin.Rd
@@ -79,6 +79,12 @@ This functions sets up a nonlinear mixed effects model for an mmkin row
object. An mmkin row object is essentially a list of mkinfit objects that
have been obtained by fitting the same model to a list of datasets.
}
+\details{
+Note that the convergence of the nlme algorithms depends on the quality
+of the data. In degradation kinetics, we often only have few datasets
+(e.g. data for few soils) and complicated degradation models, which may
+make it impossible to obtain convergence with nlme.
+}
\note{
As the object inherits from \link[nlme:nlme]{nlme::nlme}, there is a wealth of
methods that will automatically work on 'nlme.mmkin' objects, such as
@@ -120,11 +126,10 @@ f_nlme_sfo <- nlme(f["SFO", ])
# f_nlme_sfo_sfo_ff <- nlme(f_2["SFO-SFO-ff", ])
#plot(f_nlme_sfo_sfo_ff)
- # With the log-Cholesky parameterization, this converges in 11
- # iterations and around 100 seconds, but without tweaking control
- # parameters (with pdDiag, increasing the tolerance and pnlsMaxIter was
- # necessary)
- f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ])
+ # For the following, we need to increase pnlsMaxIter and the tolerance
+ # to get convergence
+ f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ],
+ control = list(pnlsMaxIter = 120, tolerance = 5e-4))
plot(f_nlme_dfop_sfo)
@@ -144,22 +149,18 @@ f_nlme_sfo <- nlme(f["SFO", ])
print(f_nlme_dfop_tc)
}
- f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo,
- "DFOP-SFO" = m_dfop_sfo),
- ds_2, quiet = TRUE, error_model = "obs")
+ f_2_obs <- update(f_2, error_model = "obs")
f_nlme_sfo_sfo_obs <- nlme(f_2_obs["SFO-SFO", ])
print(f_nlme_sfo_sfo_obs)
- f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ])
+ f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ],
+ control = list(pnlsMaxIter = 120, tolerance = 5e-4))
- f_2_tc <- mmkin(list("SFO-SFO" = m_sfo_sfo,
- "DFOP-SFO" = m_dfop_sfo),
- ds_2, quiet = TRUE, error_model = "tc")
- # f_nlme_sfo_sfo_tc <- nlme(f_2_tc["SFO-SFO", ]) # stops with error message
- f_nlme_dfop_sfo_tc <- nlme(f_2_tc["DFOP-SFO", ])
- # We get warnings about false convergence in the LME step in several iterations
- # but as the last such warning occurs in iteration 25 and we have 28 iterations
- # we can ignore these
- anova(f_nlme_dfop_sfo, f_nlme_dfop_sfo_obs, f_nlme_dfop_sfo_tc)
+ f_2_tc <- update(f_2, error_model = "tc")
+ # f_nlme_sfo_sfo_tc <- nlme(f_2_tc["SFO-SFO", ]) # No convergence with 50 iterations
+ # f_nlme_dfop_sfo_tc <- nlme(f_2_tc["DFOP-SFO", ],
+ # control = list(pnlsMaxIter = 120, tolerance = 5e-4)) # Error in X[, fmap[[nm]]] <- gradnm
+
+ anova(f_nlme_dfop_sfo, f_nlme_dfop_sfo_obs)
}
}
diff --git a/man/print.mmkin.Rd b/man/print.mmkin.Rd
deleted file mode 100644
index 29abe143..00000000
--- a/man/print.mmkin.Rd
+++ /dev/null
@@ -1,16 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/mmkin.R
-\name{print.mmkin}
-\alias{print.mmkin}
-\title{Print method for mmkin objects}
-\usage{
-\method{print}{mmkin}(x, ...)
-}
-\arguments{
-\item{x}{An \link{mmkin} object.}
-
-\item{\dots}{Not used.}
-}
-\description{
-Print method for mmkin objects
-}
diff --git a/man/transform_odeparms.Rd b/man/transform_odeparms.Rd
index f38bb051..3a97ff8d 100644
--- a/man/transform_odeparms.Rd
+++ b/man/transform_odeparms.Rd
@@ -69,17 +69,21 @@ This is no problem for the internal use in \link{mkinfit}.
SFO_SFO <- mkinmod(
parent = list(type = "SFO", to = "m1", sink = TRUE),
- m1 = list(type = "SFO"))
+ m1 = list(type = "SFO"), use_of_ff = "min")
+
# Fit the model to the FOCUS example dataset D using defaults
-fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+FOCUS_D <- subset(FOCUS_2006_D, value != 0) # remove zero values to avoid warning
+fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE)
fit.s <- summary(fit)
# Transformed and backtransformed parameters
print(fit.s$par, 3)
print(fit.s$bpar, 3)
\dontrun{
-# Compare to the version without transforming rate parameters
-fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
+# Compare to the version without transforming rate parameters (does not work
+# with analytical solution, we get NA values for m1 in predictions)
+fit.2 <- mkinfit(SFO_SFO, FOCUS_D, transform_rates = FALSE,
+ solution_type = "deSolve", quiet = TRUE)
fit.2.s <- summary(fit.2)
print(fit.2.s$par, 3)
print(fit.2.s$bpar, 3)
@@ -93,13 +97,13 @@ transform_odeparms(initials, SFO_SFO)
backtransform_odeparms(transformed, SFO_SFO)
\dontrun{
-# The case of formation fractions
+# The case of formation fractions (this is now the default)
SFO_SFO.ff <- mkinmod(
parent = list(type = "SFO", to = "m1", sink = TRUE),
m1 = list(type = "SFO"),
use_of_ff = "max")
-fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
+fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE)
fit.ff.s <- summary(fit.ff)
print(fit.ff.s$par, 3)
print(fit.ff.s$bpar, 3)
@@ -114,7 +118,7 @@ SFO_SFO.ff.2 <- mkinmod(
use_of_ff = "max")
-fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE)
+fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_D, quiet = TRUE)
fit.ff.2.s <- summary(fit.ff.2)
print(fit.ff.2.s$par, 3)
print(fit.ff.2.s$bpar, 3)
diff --git a/test.log b/test.log
index 1e64f466..9c075726 100644
--- a/test.log
+++ b/test.log
@@ -21,7 +21,7 @@ Testing mkin
✔ | 8 | mkinmod model generation and printing [0.2 s]
✔ | 3 | Model predictions with mkinpredict [0.4 s]
✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.6 s]
-✔ | 9 | Nonlinear mixed-effects models [7.7 s]
+✔ | 9 | Nonlinear mixed-effects models [7.8 s]
✔ | 14 | Plotting [1.7 s]
✔ | 4 | Residuals extracted from mkinfit models
✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.5 s]
@@ -32,6 +32,6 @@ Testing mkin
✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 40.4 s
+Duration: 40.6 s
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 176 ]

Contact - Imprint