From 60270e2849ebd48eaf57b83eb1aa9fbe53281f8b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 24 Oct 2020 02:18:59 +0200 Subject: Fix a bug for nlme with parent only, improve examples --- docs/dev/reference/Rplot001.png | Bin 27839 -> 48355 bytes docs/dev/reference/Rplot002.png | Bin 64132 -> 62018 bytes docs/dev/reference/Rplot003.png | Bin 26194 -> 62243 bytes docs/dev/reference/Rplot004.png | Bin 26783 -> 63952 bytes docs/dev/reference/nlme.mmkin-1.png | Bin 79142 -> 135400 bytes docs/dev/reference/nlme.mmkin-2.png | Bin 79539 -> 171122 bytes docs/dev/reference/nlme.mmkin-3.png | Bin 79703 -> 171684 bytes docs/dev/reference/nlme.mmkin-4.png | Bin 82209 -> 175495 bytes docs/dev/reference/nlme.mmkin.html | 101 +++++------------------------------- 9 files changed, 13 insertions(+), 88 deletions(-) (limited to 'docs/dev/reference') diff --git a/docs/dev/reference/Rplot001.png b/docs/dev/reference/Rplot001.png index cfc5bc2b..bf7c274a 100644 Binary files a/docs/dev/reference/Rplot001.png and b/docs/dev/reference/Rplot001.png differ diff --git a/docs/dev/reference/Rplot002.png b/docs/dev/reference/Rplot002.png index cffa10c1..965d4620 100644 Binary files a/docs/dev/reference/Rplot002.png and b/docs/dev/reference/Rplot002.png differ diff --git a/docs/dev/reference/Rplot003.png b/docs/dev/reference/Rplot003.png index 89ba6c49..057b525f 100644 Binary files a/docs/dev/reference/Rplot003.png and b/docs/dev/reference/Rplot003.png differ diff --git a/docs/dev/reference/Rplot004.png b/docs/dev/reference/Rplot004.png index 7d30a181..2b5ba960 100644 Binary files a/docs/dev/reference/Rplot004.png and b/docs/dev/reference/Rplot004.png differ diff --git a/docs/dev/reference/nlme.mmkin-1.png b/docs/dev/reference/nlme.mmkin-1.png index 564f7e2b..d0a1d7d4 100644 Binary files a/docs/dev/reference/nlme.mmkin-1.png and b/docs/dev/reference/nlme.mmkin-1.png differ diff --git a/docs/dev/reference/nlme.mmkin-2.png b/docs/dev/reference/nlme.mmkin-2.png index a9ce4636..b68dc3e0 100644 Binary files a/docs/dev/reference/nlme.mmkin-2.png and b/docs/dev/reference/nlme.mmkin-2.png differ diff --git a/docs/dev/reference/nlme.mmkin-3.png b/docs/dev/reference/nlme.mmkin-3.png index 0b7ce0f6..77804b2c 100644 Binary files a/docs/dev/reference/nlme.mmkin-3.png and b/docs/dev/reference/nlme.mmkin-3.png differ diff --git a/docs/dev/reference/nlme.mmkin-4.png b/docs/dev/reference/nlme.mmkin-4.png index d7c68dd5..96717087 100644 Binary files a/docs/dev/reference/nlme.mmkin-4.png and b/docs/dev/reference/nlme.mmkin-4.png differ diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html index 6e83b700..3c84abe2 100644 --- a/docs/dev/reference/nlme.mmkin.html +++ b/docs/dev/reference/nlme.mmkin.html @@ -286,7 +286,8 @@ with additional elements

#> StdDev: 2.488249 0.8447273 1.32965 0.3289311 2.321364 #> #> Number of Observations: 90 -#> Number of Groups: 5
endpoints(f_nlme_dfop) +#> Number of Groups: 5
plot(f_nlme_dfop) +
endpoints(f_nlme_dfop)
#> $distimes #> DT50 DT90 DT50back DT50_k1 DT50_k2 #> parent 10.79857 100.7937 30.34193 4.193938 43.85443 @@ -313,82 +314,24 @@ with additional elements

A1 = mkinsub("SFO"), use_of_ff = "min", quiet = TRUE) m_sfo_sfo_ff <- mkinmod(parent = mkinsub("SFO", "A1"), A1 = mkinsub("SFO"), use_of_ff = "max", quiet = TRUE) - m_fomc_sfo <- mkinmod(parent = mkinsub("FOMC", "A1"), - A1 = mkinsub("SFO"), quiet = TRUE) m_dfop_sfo <- mkinmod(parent = mkinsub("DFOP", "A1"), A1 = mkinsub("SFO"), quiet = TRUE) f_2 <- mmkin(list("SFO-SFO" = m_sfo_sfo, "SFO-SFO-ff" = m_sfo_sfo_ff, - "FOMC-SFO" = m_fomc_sfo, "DFOP-SFO" = m_dfop_sfo), ds_2, quiet = TRUE) - plot(f_2["SFO-SFO", 3:4]) # Separate fits for datasets 3 and 4 -
+ f_nlme_sfo_sfo <- nlme(f_2["SFO-SFO", ]) - # plot(f_nlme_sfo_sfo) # not feasible with pkgdown figures - plot(f_nlme_sfo_sfo, 3:4) # Global mixed model: Fits for datasets 3 and 4 + plot(f_nlme_sfo_sfo)
# With formation fractions f_nlme_sfo_sfo_ff <- nlme(f_2["SFO-SFO-ff", ]) - plot(f_nlme_sfo_sfo_ff, 3:4) # chi2 different due to different df attribution + plot(f_nlme_sfo_sfo_ff)
- # For more parameters, we need to increase pnlsMaxIter and the tolerance + # For the following fit we need to increase pnlsMaxIter and the tolerance # to get convergence - f_nlme_fomc_sfo <- nlme(f_2["FOMC-SFO", ], - control = list(pnlsMaxIter = 100, tolerance = 1e-4), verbose = TRUE) -
#> -#> **Iteration 1 -#> LME step: Loglik: -394.1603, nlminb iterations: 3 -#> reStruct parameters: -#> ds1 ds2 ds3 ds4 ds5 -#> -0.2079793 0.8563830 1.7454105 1.0917354 1.2756825 -#> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.8803 -#> fixed effects: 94.17379 -5.473193 -0.6970236 -0.2025091 2.103883 -#> iterations: 100 -#> Convergence crit. (must all become <= tolerance = 0.0001): -#> fixed reStruct -#> 0.7960134 0.1447728 -#> -#> **Iteration 2 -#> LME step: Loglik: -396.3824, nlminb iterations: 7 -#> reStruct parameters: -#> ds1 ds2 ds3 ds4 ds5 -#> -1.712404e-01 -2.432655e-05 1.842120e+00 1.073975e+00 1.322925e+00 -#> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.8035 -#> fixed effects: 94.17385 -5.473487 -0.6970404 -0.2025137 2.103871 -#> iterations: 100 -#> Convergence crit. (must all become <= tolerance = 0.0001): -#> fixed reStruct -#> 5.382757e-05 1.236667e-03 -#> -#> **Iteration 3 -#> LME step: Loglik: -396.3825, nlminb iterations: 7 -#> reStruct parameters: -#> ds1 ds2 ds3 ds4 ds5 -#> -0.1712499044 -0.0001499831 1.8420971364 1.0739799123 1.3229167796 -#> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.7948 -#> fixed effects: 94.17386 -5.473521 -0.6970422 -0.2025144 2.10387 -#> iterations: 100 -#> Convergence crit. (must all become <= tolerance = 0.0001): -#> fixed reStruct -#> 6.072817e-06 1.400857e-04 -#> -#> **Iteration 4 -#> LME step: Loglik: -396.3825, nlminb iterations: 7 -#> reStruct parameters: -#> ds1 ds2 ds3 ds4 ds5 -#> -0.1712529502 -0.0001641277 1.8420957542 1.0739797181 1.3229173076 -#> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.7936 -#> fixed effects: 94.17386 -5.473526 -0.6970426 -0.2025146 2.103869 -#> iterations: 100 -#> Convergence crit. (must all become <= tolerance = 0.0001): -#> fixed reStruct -#> 1.027451e-06 2.275704e-05
f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ], + f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ], control = list(pnlsMaxIter = 120, tolerance = 5e-4), verbose = TRUE)
#> #> **Iteration 1 @@ -415,17 +358,10 @@ with additional elements

#> iterations: 120 #> Convergence crit. (must all become <= tolerance = 0.0005): #> fixed reStruct -#> 4.789774e-07 2.200661e-05
plot(f_2["FOMC-SFO", 3:4]) -
plot(f_nlme_fomc_sfo, 3:4) -
- plot(f_2["DFOP-SFO", 3:4]) -
plot(f_nlme_dfop_sfo, 3:4) -
- anova(f_nlme_dfop_sfo, f_nlme_fomc_sfo, f_nlme_sfo_sfo) -
#> Model df AIC BIC logLik Test L.Ratio p-value -#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9273 -#> f_nlme_fomc_sfo 2 11 818.5149 853.0087 -398.2575 1 vs 2 21.33975 <.0001 -#> f_nlme_sfo_sfo 3 9 1085.1821 1113.4043 -533.5910 2 vs 3 270.66716 <.0001
anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo) # if we ignore FOMC +#> 4.789774e-07 2.200661e-05
+ plot(f_nlme_dfop_sfo) +
+ anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo)
#> Model df AIC BIC logLik Test L.Ratio p-value #> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9273 #> f_nlme_sfo_sfo 2 9 1085.1821 1113.4043 -533.5910 1 vs 2 249.3274 <.0001
@@ -449,19 +385,8 @@ with additional elements

#> A1 162.30536 539.1667 NA NA NA #>
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, - # "FOMC-SFO" = m_fomc_sfo, - # "DFOP-SFO" = m_dfop_sfo), - # ds_2, quiet = TRUE, - # error_model = "tc") - #f_nlme_sfo_sfo_tc <- nlme(f_2_tc["SFO-SFO", ], control = list(maxIter = 100)) - #f_nlme_dfop_sfo_tc <- nlme(f_2_tc["DFOP-SFO", ]) - #f_nlme_dfop_sfo_tc <- update(f_nlme_dfop_sfo, weights = varConstProp(), - # control = list(sigma = 1, msMaxIter = 100, pnlsMaxIter = 15)) - # Fitting metabolite kinetics with nlme.mmkin and the two-component - # error model currently does not work, at least not with these data. + # Attempts to fit metabolite kinetics with the tc error model are possible, + # but need tweeking of control values and sometimes do not converge f_tc <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, error_model = "tc") f_nlme_sfo_tc <- nlme(f_tc["SFO", ]) -- cgit v1.2.1