diff options
Diffstat (limited to 'man')
-rw-r--r-- | man/mkinmod.Rd | 6 | ||||
-rw-r--r-- | man/nlme.Rd | 1 | ||||
-rw-r--r-- | man/nlme.mmkin.Rd | 45 | ||||
-rw-r--r-- | man/summary.nlme.mmkin.Rd | 1 |
4 files changed, 33 insertions, 20 deletions
diff --git a/man/mkinmod.Rd b/man/mkinmod.Rd index 77319aac..95cec09a 100644 --- a/man/mkinmod.Rd +++ b/man/mkinmod.Rd @@ -155,13 +155,17 @@ print(SFO_SFO) fit_sfo_sfo <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve") # Now supplying compound names used for plotting, and write to user defined location + # We need to choose a path outside the session tempdir because this gets removed + DLL_dir <- "~/.local/share/mkin" + if (!dir.exists(DLL_dir)) dir.create(DLL_dir) SFO_SFO.2 <- mkinmod( parent = mkinsub("SFO", "m1", full_name = "Test compound"), m1 = mkinsub("SFO", full_name = "Metabolite M1"), - name = "SFO_SFO", dll_dir = "~/dll", unload = TRUE, overwrite = TRUE) + name = "SFO_SFO", dll_dir = DLL_dir, unload = TRUE, overwrite = TRUE) # Now we can save the model and restore it in a new session saveRDS(SFO_SFO.2, file = "~/SFO_SFO.rds") # Terminate the R session here if you would like to check, and then do +library(mkin) SFO_SFO.3 <- readRDS("~/SFO_SFO.rds") fit_sfo_sfo <- mkinfit(SFO_SFO.3, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve") diff --git a/man/nlme.Rd b/man/nlme.Rd index df721a0f..307cca82 100644 --- a/man/nlme.Rd +++ b/man/nlme.Rd @@ -78,7 +78,6 @@ plot(augPred(m_nlme, level = 0:1), layout = c(3, 1)) # The procedure is greatly simplified by the nlme.mmkin function f_nlme <- nlme(f) plot(f_nlme) - } \seealso{ \code{\link{nlme.mmkin}} diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd index abcd0e81..0a9f6913 100644 --- a/man/nlme.mmkin.Rd +++ b/man/nlme.mmkin.Rd @@ -87,15 +87,15 @@ ds <- lapply(experimental_data_for_UBA_2019[6:10], 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) -print(f_nlme_dfop) -plot(f_nlme_dfop) -endpoints(f_nlme_dfop) \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) + + f_nlme_dfop <- nlme(f["DFOP", ]) + anova(f_nlme_sfo, f_nlme_dfop) + print(f_nlme_dfop) + plot(f_nlme_dfop) + endpoints(f_nlme_dfop) + 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"), @@ -113,14 +113,15 @@ endpoints(f_nlme_dfop) f_nlme_sfo_sfo <- nlme(f_2["SFO-SFO", ]) 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) + # 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) - # 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) + # 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", ]) plot(f_nlme_dfop_sfo) @@ -145,10 +146,18 @@ endpoints(f_nlme_dfop) 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 - #f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ], control = list(maxIter = 100)) + f_nlme_dfop_sfo_obs <- nlme(f_2_obs["DFOP-SFO", ]) + + 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) + } } \seealso{ diff --git a/man/summary.nlme.mmkin.Rd b/man/summary.nlme.mmkin.Rd index ea625dd7..d7e61074 100644 --- a/man/summary.nlme.mmkin.Rd +++ b/man/summary.nlme.mmkin.Rd @@ -80,6 +80,7 @@ pred_sfo <- function(k) { ds_sfo_mean <- lapply(k_in, pred_sfo) names(ds_sfo_mean) <- paste("ds", 1:5) +set.seed(12345) ds_sfo_syn <- lapply(ds_sfo_mean, function(ds) { add_err(ds, sdfunc = function(value) sqrt(1^2 + value^2 * 0.07^2), |