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(). --- docs/dev/reference/nlme.mmkin.html | 51 +++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'docs/dev/reference') 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 #>
- 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, @@ -469,11 +469,56 @@ with additional elements

AIC(f_nlme_sfo, f_nlme_sfo_tc, f_nlme_dfop, f_nlme_dfop_tc) print(f_nlme_dfop_tc) } -
#> 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
f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo, +
#> 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
f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo, "DFOP-SFO" = m_dfop_sfo), ds_2, quiet = TRUE, error_model = "obs") f_nlme_sfo_sfo_obs <- nlme(f_2_obs["SFO-SFO", ]) - # The same with DFOP-SFO does not converge, apparently the variances of + print(f_nlme_sfo_sfo_obs) +
#> 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)) -- cgit v1.2.1