From 524a8bba89b95840b4e9215c403947a8bb76d7b2 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 30 Nov 2020 16:05:10 +0100 Subject: Complete rebuild of static docs of dev version --- docs/dev/reference/nlme.mmkin.html | 184 +++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 101 deletions(-) (limited to 'docs/dev/reference/nlme.mmkin.html') diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html index 84990521..6d9f2007 100644 --- a/docs/dev/reference/nlme.mmkin.html +++ b/docs/dev/reference/nlme.mmkin.html @@ -193,8 +193,10 @@ mmkin model are used as fixed parameters

random -

If not specified, all fixed effects are complemented -with uncorrelated random effects

+

If not specified, correlated random effects are set up +for all optimised degradation model parameters using the log-Cholesky +parameterization nlme::pdLogChol that is also the default of +the generic nlme method.

groups @@ -274,11 +276,14 @@ methods that will automatically work on 'nlme.mmkin' objects, such as f <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, cores = 1) library(nlme) f_nlme_sfo <- nlme(f["SFO", ]) -f_nlme_dfop <- nlme(f["DFOP", ]) -AIC(f_nlme_sfo, f_nlme_dfop) -
#> df AIC -#> f_nlme_sfo 5 625.0539 -#> f_nlme_dfop 9 495.1270
print(f_nlme_dfop) +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
+# \dontrun{ + + f_nlme_dfop <- nlme(f["DFOP", ]) + anova(f_nlme_sfo, f_nlme_dfop) +
#> Model df AIC BIC logLik Test L.Ratio p-value +#> f_nlme_sfo 1 6 622.0677 637.0666 -305.0338 +#> f_nlme_dfop 2 15 487.0134 524.5105 -228.5067 1 vs 2 153.0543 <.0001
print(f_nlme_dfop)
#> Kinetic nonlinear mixed-effects model fit by maximum likelihood #> #> Structural model: @@ -289,48 +294,30 @@ methods that will automatically work on 'nlme.mmkin' objects, such as #> Data: #> 90 observations of 1 variable(s) grouped in 5 datasets #> -#> Log-likelihood: -238.5635 +#> Log-likelihood: -228.5067 #> #> Fixed effects: #> list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) #> parent_0 log_k1 log_k2 g_qlogis -#> 94.1702 -1.8002 -4.1474 0.0324 +#> 94.18273 -1.82135 -4.16872 0.08949 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) #> Level: ds -#> Structure: Diagonal -#> parent_0 log_k1 log_k2 g_qlogis Residual -#> StdDev: 2.488 0.8447 1.33 0.4652 2.321 -#>
plot(f_nlme_dfop) -
endpoints(f_nlme_dfop) +#> Structure: General positive-definite, Log-Cholesky parametrization +#> StdDev Corr +#> parent_0 2.4656397 prnt_0 log_k1 log_k2 +#> log_k1 0.7950788 0.240 +#> log_k2 1.2605419 0.150 0.984 +#> g_qlogis 0.5013272 -0.075 0.843 0.834 +#> Residual 2.3308100 +#>
plot(f_nlme_dfop) +
endpoints(f_nlme_dfop)
#> $distimes #> DT50 DT90 DT50back DT50_k1 DT50_k2 -#> parent 10.79857 100.7937 30.34192 4.193937 43.85442 +#> parent 10.57119 101.0652 30.42366 4.283776 44.80015 #>
-# \dontrun{ - f_nlme_2 <- nlme(f["SFO", ], start = c(parent_0 = 100, log_k_parent = 0.1)) - update(f_nlme_2, random = parent_0 ~ 1) -
#> Kinetic nonlinear mixed-effects model fit by maximum likelihood -#> -#> Structural model: -#> d_parent/dt = - k_parent * parent -#> -#> Data: -#> observations of 0 variable(s) grouped in 0 datasets -#> -#> Log-likelihood: -404.3729 -#> -#> Fixed effects: -#> list(parent_0 ~ 1, log_k_parent ~ 1) -#> parent_0 log_k_parent -#> 75.933 -3.556 -#> -#> Random effects: -#> Formula: parent_0 ~ 1 | ds -#> parent_0 Residual -#> StdDev: 0.002417 21.63 -#>
ds_2 <- lapply(experimental_data_for_UBA_2019[6:10], + ds_2 <- lapply(experimental_data_for_UBA_2019[6:10], function(x) x$data[c("name", "time", "value")]) m_sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"), A1 = mkinsub("SFO"), use_of_ff = "min", quiet = TRUE) @@ -345,66 +332,42 @@ methods that will automatically work on 'nlme.mmkin' objects, such as ds_2, quiet = TRUE) f_nlme_sfo_sfo <- nlme(f_2["SFO-SFO", ]) - plot(f_nlme_sfo_sfo) +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 2, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
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) -
- # For the following fit 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), verbose = TRUE) -
#> -#> **Iteration 1 -#> LME step: Loglik: -404.9583, nlminb iterations: 1 -#> reStruct parameters: -#> ds1 ds2 ds3 ds4 ds5 ds6 -#> -0.4114356 0.9798646 1.3524300 0.7293315 0.3354323 1.3647313 -#> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 630.3633 -#> fixed effects: 93.82269 -5.455993 -0.9601037 -1.862196 -4.199671 0.07824609 -#> iterations: 120 -#> Convergence crit. (must all become <= tolerance = 0.0005): -#> fixed reStruct -#> 0.7897284 0.5822782 -#> -#> **Iteration 2 -#> LME step: Loglik: -407.7755, nlminb iterations: 11 -#> reStruct parameters: -#> ds1 ds2 ds3 ds4 ds5 ds6 -#> -0.37122411 0.00305562 1.44336560 0.72467122 0.30160310 1.40762692 -#> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 630.3637 -#> fixed effects: 93.82269 -5.455992 -0.9601036 -1.862196 -4.199671 0.0782462 -#> iterations: 120 -#> Convergence crit. (must all become <= tolerance = 0.0005): -#> fixed reStruct -#> 1.375673e-06 9.758294e-06
+ # With formation fractions this does not coverge with defaults + # 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", ]) +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 2, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 3, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 4, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
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.9274 -#> f_nlme_sfo_sfo 2 9 1085.1821 1113.4043 -533.5910 1 vs 2 249.3274 <.0001
+#> f_nlme_dfop_sfo 1 28 811.7199 899.5222 -377.8599 +#> f_nlme_sfo_sfo 2 15 1075.1934 1122.2304 -522.5967 1 vs 2 289.4736 <.0001
endpoints(f_nlme_sfo_sfo)
#> $ff #> parent_sink parent_A1 A1_sink -#> 0.5912432 0.4087568 1.0000000 +#> 0.6512742 0.3487258 1.0000000 #> #> $distimes -#> DT50 DT90 -#> parent 19.13518 63.5657 -#> A1 66.02155 219.3189 +#> DT50 DT90 +#> parent 18.03144 59.89916 +#> A1 102.72949 341.25997 #>
endpoints(f_nlme_dfop_sfo)
#> $ff #> parent_A1 parent_sink -#> 0.2768574 0.7231426 +#> 0.2762167 0.7237833 #> #> $distimes #> DT50 DT90 DT50back DT50_k1 DT50_k2 -#> parent 11.07091 104.6320 31.49738 4.462384 46.20825 -#> A1 162.30523 539.1663 NA NA NA +#> parent 11.15024 133.9652 40.32755 4.688015 62.16017 +#> A1 235.83191 783.4167 NA NA NA #>
if (length(findFunction("varConstProp")) > 0) { # tc error model for nlme available # Attempts to fit metabolite kinetics with the tc error model are possible, @@ -416,7 +379,7 @@ methods that will automatically work on 'nlme.mmkin' objects, such as AIC(f_nlme_sfo, f_nlme_sfo_tc, f_nlme_dfop, f_nlme_dfop_tc) print(f_nlme_dfop_tc) } -
#> Kinetic nonlinear mixed-effects model fit by maximum likelihood +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 14, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 2, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 4, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 5, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 6, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 7, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 8, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 9, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 10, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 11, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 12, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 14, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 15, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 16, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 17, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 18, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Kinetic nonlinear mixed-effects model fit by maximum likelihood #> #> Structural model: #> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * @@ -426,31 +389,35 @@ methods that will automatically work on 'nlme.mmkin' objects, such as #> Data: #> 90 observations of 1 variable(s) grouped in 5 datasets #> -#> Log-likelihood: -238.4298 +#> Log-likelihood: -228.3575 #> #> Fixed effects: #> list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) #> parent_0 log_k1 log_k2 g_qlogis -#> 94.04775 -1.82340 -4.16715 0.05685 +#> 93.6695 -1.9187 -4.4253 0.2215 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) #> Level: ds -#> Structure: Diagonal -#> parent_0 log_k1 log_k2 g_qlogis Residual -#> StdDev: 2.474 0.85 1.337 0.4659 1 +#> Structure: General positive-definite, Log-Cholesky parametrization +#> StdDev Corr +#> parent_0 2.8574651 prnt_0 log_k1 log_k2 +#> log_k1 0.9689083 0.506 +#> log_k2 1.5798002 0.446 0.997 +#> g_qlogis 0.5761569 -0.457 0.247 0.263 +#> Residual 1.0000000 #> #> Variance function: #> Structure: Constant plus proportion of variance covariate #> Formula: ~fitted(.) #> Parameter estimates: -#> const prop -#> 2.23224114 0.01262341
+#> const prop +#> 2.0376990 0.0221686
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", ]) - print(f_nlme_sfo_sfo_obs) +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
print(f_nlme_sfo_sfo_obs)
#> Kinetic nonlinear mixed-effects model fit by maximum likelihood #> #> Structural model: @@ -460,29 +427,44 @@ methods that will automatically work on 'nlme.mmkin' objects, such as #> Data: #> 170 observations of 2 variable(s) grouped in 5 datasets #> -#> Log-likelihood: -472.976 +#> Log-likelihood: -462.2203 #> #> Fixed effects: #> 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.976 -3.670 -4.164 -4.645 +#> 88.682 -3.664 -4.164 -4.665 #> #> 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.992 1.777 1.055 0.4821 6.483 +#> Structure: General positive-definite, Log-Cholesky parametrization +#> StdDev Corr +#> parent_0 4.9153305 prnt_0 lg_k__ l___A1 +#> log_k_parent_sink 1.8158570 0.956 +#> log_k_parent_A1 1.0514548 0.821 0.907 +#> log_k_A1_sink 0.4924122 0.035 0.315 0.533 +#> Residual 6.3987599 #> #> Variance function: #> Structure: Different standard deviations per stratum #> Formula: ~1 | name #> Parameter estimates: #> parent A1 -#> 1.0000000 0.2050003
# 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)) +#> 1.0000000 0.2040647
f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ]) +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 2, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 3, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 4, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
+ 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", ]) +
#> Warning: Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 2, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 3, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 4, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'!
#> Warning: Iteration 6, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 7, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 8, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 9, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 11, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 12, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 15, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
#> Warning: Iteration 25, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)
# 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) +
#> Model df AIC BIC logLik Test L.Ratio p-value +#> f_nlme_dfop_sfo 1 28 811.7199 899.5222 -377.8599 +#> f_nlme_dfop_sfo_obs 2 29 784.1304 875.0685 -363.0652 1 vs 2 29.5895 <.0001 +#> f_nlme_dfop_sfo_tc 3 29 791.9981 882.9362 -366.9990
# }
-- cgit v1.2.1