From 0af6a61b84cc29cdbfad16a6fc7ee0e6f88c7d0f Mon Sep 17 00:00:00 2001
From: Johannes Ranke
Date: Thu, 22 Oct 2020 13:14:31 +0200
Subject: Really fix check for nlme::varConstProp
And add output for nlme fit translating the mkinfit error model "obs"
into nlme::varIdent().
---
R/nlme.mmkin.R | 3 ++-
docs/dev/pkgdown.yml | 2 +-
docs/dev/reference/nlme.mmkin.html | 51 +++++++++++++++++++++++++++++++++++---
man/nlme.mmkin.Rd | 3 ++-
4 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/R/nlme.mmkin.R b/R/nlme.mmkin.R
index 7f7e34e9..c8a99d59 100644
--- a/R/nlme.mmkin.R
+++ b/R/nlme.mmkin.R
@@ -101,7 +101,7 @@ get_deg_func <- function() {
#' endpoints(f_nlme_sfo_sfo)
#' endpoints(f_nlme_dfop_sfo)
#'
-#' if (findFunction("varConstProp")) { # tc error model for nlme available
+#' if (length(findFunction("varConstProp")) > 0) { # tc error model for nlme available
#' # Attempts to fit metabolite kinetics with the tc error model
#' #f_2_tc <- mmkin(list("SFO-SFO" = m_sfo_sfo,
#' # "SFO-SFO-ff" = m_sfo_sfo_ff,
@@ -126,6 +126,7 @@ get_deg_func <- function() {
#' "DFOP-SFO" = m_dfop_sfo),
#' ds_2, quiet = TRUE, error_model = "obs")
#' f_nlme_sfo_sfo_obs <- nlme(f_2_obs["SFO-SFO", ])
+#' print(f_nlme_sfo_sfo_obs)
#' # The same with DFOP-SFO does not converge, apparently the variances of
#' # parent and A1 are too similar in this case, so that the model is
#' # overparameterised
diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml
index e3f126c0..4bca36e6 100644
--- a/docs/dev/pkgdown.yml
+++ b/docs/dev/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: 2020-10-22T11:08Z
+last_built: 2020-10-22T11:16Z
urls:
reference: https://pkgdown.jrwb.de/mkin/reference
article: https://pkgdown.jrwb.de/mkin/articles
diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html
index d186d785..6e83b700 100644
--- a/docs/dev/reference/nlme.mmkin.html
+++ b/docs/dev/reference/nlme.mmkin.html
@@ -448,7 +448,7 @@ with additional elements
#> parent 11.07091 104.6320 31.49738 4.462384 46.20825
#> A1 162.30536 539.1667 NA NA NA
#> #> Error in if (findFunction("varConstProp")) { f_tc <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, error_model = "tc") f_nlme_sfo_tc <- nlme(f_tc["SFO", ]) f_nlme_dfop_tc <- nlme(f_tc["DFOP", ]) AIC(f_nlme_sfo, f_nlme_sfo_tc, f_nlme_dfop, f_nlme_dfop_tc) print(f_nlme_dfop_tc)}: argument is not interpretable as logical
#> Nonlinear mixed-effects model fit by maximum likelihood
+#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k1, log_k2, g_ilr)
+#> Data: "Not shown"
+#> Log-likelihood: -238.4298
+#> Fixed: list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_ilr ~ 1)
+#> parent_0 log_k1 log_k2 g_ilr
+#> 94.04774463 -1.82339924 -4.16715509 0.04020161
+#>
+#> Random effects:
+#> Formula: list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_ilr ~ 1)
+#> Level: ds
+#> Structure: Diagonal
+#> parent_0 log_k1 log_k2 g_ilr Residual
+#> StdDev: 2.473883 0.8499901 1.337187 0.3294411 1
+#>
+#> Variance function:
+#> Structure: Constant plus proportion of variance covariate
+#> Formula: ~fitted(.)
+#> Parameter estimates:
+#> const prop
+#> 2.23222625 0.01262414
+#> Number of Observations: 90
+#> Number of Groups: 5
#> Nonlinear mixed-effects model fit by maximum likelihood
+#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent_sink, log_k_parent_A1, log_k_A1_sink)
+#> Data: "Not shown"
+#> Log-likelihood: -472.976
+#> Fixed: list(parent_0 ~ 1, log_k_parent_sink ~ 1, log_k_parent_A1 ~ 1, log_k_A1_sink ~ 1)
+#> parent_0 log_k_parent_sink log_k_parent_A1 log_k_A1_sink
+#> 87.975536 -3.669816 -4.164127 -4.645073
+#>
+#> Random effects:
+#> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1, log_k_parent_A1 ~ 1, log_k_A1_sink ~ 1)
+#> Level: ds
+#> Structure: Diagonal
+#> parent_0 log_k_parent_sink log_k_parent_A1 log_k_A1_sink Residual
+#> StdDev: 3.992214 1.77702 1.054733 0.4821383 6.482585
+#>
+#> Variance function:
+#> Structure: Different standard deviations per stratum
+#> Formula: ~1 | name
+#> Parameter estimates:
+#> parent A1
+#> 1.0000000 0.2050003
+#> Number of Observations: 170
+#> Number of Groups: 5
# The same with DFOP-SFO does not converge, apparently the variances of
# parent and A1 are too similar in this case, so that the model is
# overparameterised
#f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ], control = list(maxIter = 100))
diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd
index 0af670a0..08ce1ad8 100644
--- a/man/nlme.mmkin.Rd
+++ b/man/nlme.mmkin.Rd
@@ -131,7 +131,7 @@ endpoints(f_nlme_dfop)
endpoints(f_nlme_sfo_sfo)
endpoints(f_nlme_dfop_sfo)
- if (findFunction("varConstProp")) { # tc error model for nlme available
+ if (length(findFunction("varConstProp")) > 0) { # tc error model for nlme available
# Attempts to fit metabolite kinetics with the tc error model
#f_2_tc <- mmkin(list("SFO-SFO" = m_sfo_sfo,
# "SFO-SFO-ff" = m_sfo_sfo_ff,
@@ -156,6 +156,7 @@ endpoints(f_nlme_dfop)
"DFOP-SFO" = m_dfop_sfo),
ds_2, quiet = TRUE, error_model = "obs")
f_nlme_sfo_sfo_obs <- nlme(f_2_obs["SFO-SFO", ])
+ print(f_nlme_sfo_sfo_obs)
# The same with DFOP-SFO does not converge, apparently the variances of
# parent and A1 are too similar in this case, so that the model is
# overparameterised
--
cgit v1.2.1