diff options
-rw-r--r-- | R/create_deg_func.R | 2 | ||||
-rw-r--r-- | R/nlme.mmkin.R | 7 | ||||
-rw-r--r-- | R/summary.nlme.mmkin.R | 2 | ||||
-rw-r--r-- | check.log | 2 | ||||
-rw-r--r-- | docs/pkgdown.yml | 2 | ||||
-rw-r--r-- | docs/reference/Rplot001.png | bin | 14083 -> 1011 bytes | |||
-rw-r--r-- | docs/reference/Rplot002.png | bin | 13699 -> 57977 bytes | |||
-rw-r--r-- | docs/reference/Rplot003.png | bin | 48687 -> 59128 bytes | |||
-rw-r--r-- | docs/reference/create_deg_func.html | 10 | ||||
-rw-r--r-- | docs/reference/nlme.mmkin.html | 9 | ||||
-rw-r--r-- | docs/reference/summary.nlme.mmkin.html | 17 | ||||
-rw-r--r-- | man/create_deg_func.Rd | 2 | ||||
-rw-r--r-- | man/nlme.mmkin.Rd | 7 | ||||
-rw-r--r-- | man/summary.nlme.mmkin.Rd | 2 | ||||
-rw-r--r-- | test.log | 48 | ||||
-rw-r--r-- | tests/testthat/setup_script.R | 14 | ||||
-rw-r--r-- | tests/testthat/test_analytical.R | 7 | ||||
-rw-r--r-- | tests/testthat/test_plot.R | 14 | ||||
-rw-r--r-- | tests/testthat/test_saemix_parent.R | 1 |
19 files changed, 83 insertions, 63 deletions
diff --git a/R/create_deg_func.R b/R/create_deg_func.R index 4b4284db..5794c65c 100644 --- a/R/create_deg_func.R +++ b/R/create_deg_func.R @@ -10,8 +10,8 @@ #' m1 = mkinsub("SFO")) #' FOCUS_D <- subset(FOCUS_2006_D, value != 0) # to avoid warnings #' fit_1 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE) -#' fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) #' \dontrun{ +#' fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) #' if (require(rbenchmark)) #' benchmark( #' analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), diff --git a/R/nlme.mmkin.R b/R/nlme.mmkin.R index b6b6c830..09cb84b8 100644 --- a/R/nlme.mmkin.R +++ b/R/nlme.mmkin.R @@ -59,12 +59,11 @@ get_deg_func <- function() { #' @examples #' ds <- lapply(experimental_data_for_UBA_2019[6:10], #' function(x) subset(x$data[c("name", "time", "value")], name == "parent")) -#' f <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, cores = 1) -#' library(nlme) -#' f_nlme_sfo <- nlme(f["SFO", ]) #' #' \dontrun{ -#' +#' f <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, cores = 1) +#' library(nlme) +#' f_nlme_sfo <- nlme(f["SFO", ]) #' f_nlme_dfop <- nlme(f["DFOP", ]) #' anova(f_nlme_sfo, f_nlme_dfop) #' print(f_nlme_dfop) diff --git a/R/summary.nlme.mmkin.R b/R/summary.nlme.mmkin.R index be7f0441..1dd73301 100644 --- a/R/summary.nlme.mmkin.R +++ b/R/summary.nlme.mmkin.R @@ -62,11 +62,13 @@ #' n = 1)[[1]] #' }) #' +#' \dontrun{ #' # Evaluate using mmkin and nlme #' library(nlme) #' f_mmkin <- mmkin("SFO", ds_sfo_syn, quiet = TRUE, error_model = "tc", cores = 1) #' f_nlme <- nlme(f_mmkin) #' summary(f_nlme, data = TRUE) +#' } #' #' @export summary.nlme.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes = TRUE, alpha = 0.05, ...) { @@ -1,5 +1,5 @@ * using log directory ‘/home/jranke/git/mkin/mkin.Rcheck’ -* using R version 4.1.2 (2021-11-01) +* using R version 4.1.3 (2022-03-10) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using options ‘--no-tests --as-cran’ diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index d789805b..59854491 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -11,7 +11,7 @@ articles: benchmarks: web_only/benchmarks.html compiled_models: web_only/compiled_models.html dimethenamid_2018: web_only/dimethenamid_2018.html -last_built: 2022-03-09T08:50Z +last_built: 2022-03-14T07:56Z urls: reference: https://pkgdown.jrwb.de/mkin/reference article: https://pkgdown.jrwb.de/mkin/articles diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png Binary files differindex ca982688..17a35806 100644 --- a/docs/reference/Rplot001.png +++ b/docs/reference/Rplot001.png diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png Binary files differindex de2d61aa..ddd3a0d7 100644 --- a/docs/reference/Rplot002.png +++ b/docs/reference/Rplot002.png diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png Binary files differindex f8bf10bb..fa29fc43 100644 --- a/docs/reference/Rplot003.png +++ b/docs/reference/Rplot003.png diff --git a/docs/reference/create_deg_func.html b/docs/reference/create_deg_func.html index 57516fba..2516edff 100644 --- a/docs/reference/create_deg_func.html +++ b/docs/reference/create_deg_func.html @@ -111,8 +111,8 @@ <span class="r-msg co"><span class="r-pr">#></span> Temporary DLL for differentials generated and loaded</span> <span class="r-in"><span class="va">FOCUS_D</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">FOCUS_2006_D</span>, <span class="va">value</span> <span class="op">!=</span> <span class="fl">0</span><span class="op">)</span> <span class="co"># to avoid warnings</span></span> <span class="r-in"><span class="va">fit_1</span> <span class="op"><-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO</span>, <span class="va">FOCUS_D</span>, solution_type <span class="op">=</span> <span class="st">"analytical"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span> -<span class="r-in"><span class="va">fit_2</span> <span class="op"><-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO</span>, <span class="va">FOCUS_D</span>, solution_type <span class="op">=</span> <span class="st">"deSolve"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span> <span class="r-in"><span class="co"># \dontrun{</span></span> +<span class="r-in"><span class="va">fit_2</span> <span class="op"><-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO</span>, <span class="va">FOCUS_D</span>, solution_type <span class="op">=</span> <span class="st">"deSolve"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span> <span class="r-in"><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="va"><a href="http://rbenchmark.googlecode.com" class="external-link">rbenchmark</a></span><span class="op">)</span><span class="op">)</span></span> <span class="r-in"> <span class="fu"><a href="https://rdrr.io/pkg/rbenchmark/man/benchmark.html" class="external-link">benchmark</a></span><span class="op">(</span></span> <span class="r-in"> analytical <span class="op">=</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO</span>, <span class="va">FOCUS_D</span>, solution_type <span class="op">=</span> <span class="st">"analytical"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>,</span> @@ -120,8 +120,8 @@ <span class="r-in"> replications <span class="op">=</span> <span class="fl">2</span><span class="op">)</span></span> <span class="r-msg co"><span class="r-pr">#></span> Loading required package: rbenchmark</span> <span class="r-out co"><span class="r-pr">#></span> test replications elapsed relative user.self sys.self user.child</span> -<span class="r-out co"><span class="r-pr">#></span> 1 analytical 2 0.406 1.000 0.407 0.000 0</span> -<span class="r-out co"><span class="r-pr">#></span> 2 deSolve 2 0.698 1.719 0.695 0.003 0</span> +<span class="r-out co"><span class="r-pr">#></span> 1 analytical 2 0.394 1.000 0.393 0 0</span> +<span class="r-out co"><span class="r-pr">#></span> 2 deSolve 2 0.678 1.721 0.677 0 0</span> <span class="r-out co"><span class="r-pr">#></span> sys.child</span> <span class="r-out co"><span class="r-pr">#></span> 1 0</span> <span class="r-out co"><span class="r-pr">#></span> 2 0</span> @@ -134,8 +134,8 @@ <span class="r-in"> deSolve <span class="op">=</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">DFOP_SFO</span>, <span class="va">FOCUS_D</span>, solution_type <span class="op">=</span> <span class="st">"deSolve"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>,</span> <span class="r-in"> replications <span class="op">=</span> <span class="fl">2</span><span class="op">)</span></span> <span class="r-out co"><span class="r-pr">#></span> test replications elapsed relative user.self sys.self user.child</span> -<span class="r-out co"><span class="r-pr">#></span> 1 analytical 2 0.855 1.000 0.856 0 0</span> -<span class="r-out co"><span class="r-pr">#></span> 2 deSolve 2 1.588 1.857 1.587 0 0</span> +<span class="r-out co"><span class="r-pr">#></span> 1 analytical 2 0.829 1.000 0.829 0 0</span> +<span class="r-out co"><span class="r-pr">#></span> 2 deSolve 2 1.559 1.881 1.559 0 0</span> <span class="r-out co"><span class="r-pr">#></span> sys.child</span> <span class="r-out co"><span class="r-pr">#></span> 1 0</span> <span class="r-out co"><span class="r-pr">#></span> 2 0</span> diff --git a/docs/reference/nlme.mmkin.html b/docs/reference/nlme.mmkin.html index 4b59afed..1f071ffa 100644 --- a/docs/reference/nlme.mmkin.html +++ b/docs/reference/nlme.mmkin.html @@ -97,7 +97,7 @@ have been obtained by fitting the same model to a list of datasets.</p> data <span class="op">=</span> <span class="st">"auto"</span>, fixed <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">lapply</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">as.list</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu"><a href="mean_degparms.html">mean_degparms</a></span><span class="op">(</span><span class="va">model</span><span class="op">)</span><span class="op">)</span><span class="op">)</span>, <span class="kw">function</span><span class="op">(</span><span class="va">el</span><span class="op">)</span> <span class="fu"><a href="https://rdrr.io/r/base/eval.html" class="external-link">eval</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/parse.html" class="external-link">parse</a></span><span class="op">(</span>text <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html" class="external-link">paste</a></span><span class="op">(</span><span class="va">el</span>, <span class="fl">1</span>, sep <span class="op">=</span> <span class="st">"~"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span><span class="op">)</span>, - random <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/pkg/nlme/man/pdDiag.html" class="external-link">pdDiag</a></span><span class="op">(</span><span class="va">fixed</span><span class="op">)</span>, + random <span class="op">=</span> <span class="fu">pdDiag</span><span class="op">(</span><span class="va">fixed</span><span class="op">)</span>, <span class="va">groups</span>, start <span class="op">=</span> <span class="fu"><a href="mean_degparms.html">mean_degparms</a></span><span class="op">(</span><span class="va">model</span>, random <span class="op">=</span> <span class="cn">TRUE</span>, test_log_parms <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>, correlation <span class="op">=</span> <span class="cn">NULL</span>, @@ -187,12 +187,11 @@ methods that will automatically work on 'nlme.mmkin' objects, such as <h2>Examples</h2> <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span class="va">ds</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">lapply</a></span><span class="op">(</span><span class="va">experimental_data_for_UBA_2019</span><span class="op">[</span><span class="fl">6</span><span class="op">:</span><span class="fl">10</span><span class="op">]</span>,</span> <span class="r-in"> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">data</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"name"</span>, <span class="st">"time"</span>, <span class="st">"value"</span><span class="op">)</span><span class="op">]</span>, <span class="va">name</span> <span class="op">==</span> <span class="st">"parent"</span><span class="op">)</span><span class="op">)</span></span> -<span class="r-in"><span class="va">f</span> <span class="op"><-</span> <span class="fu"><a href="mmkin.html">mmkin</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="st">"DFOP"</span><span class="op">)</span>, <span class="va">ds</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span>, cores <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span> -<span class="r-in"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://svn.r-project.org/R-packages/trunk/nlme/" class="external-link">nlme</a></span><span class="op">)</span></span> -<span class="r-in"><span class="va">f_nlme_sfo</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/nlme/man/nlme.html" class="external-link">nlme</a></span><span class="op">(</span><span class="va">f</span><span class="op">[</span><span class="st">"SFO"</span>, <span class="op">]</span><span class="op">)</span></span> <span class="r-in"></span> <span class="r-in"><span class="co"># \dontrun{</span></span> -<span class="r-in"></span> +<span class="r-in"> <span class="va">f</span> <span class="op"><-</span> <span class="fu"><a href="mmkin.html">mmkin</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="st">"DFOP"</span><span class="op">)</span>, <span class="va">ds</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span>, cores <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span> +<span class="r-in"> <span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://svn.r-project.org/R-packages/trunk/nlme/" class="external-link">nlme</a></span><span class="op">)</span></span> +<span class="r-in"> <span class="va">f_nlme_sfo</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/nlme/man/nlme.html" class="external-link">nlme</a></span><span class="op">(</span><span class="va">f</span><span class="op">[</span><span class="st">"SFO"</span>, <span class="op">]</span><span class="op">)</span></span> <span class="r-in"> <span class="va">f_nlme_dfop</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/nlme/man/nlme.html" class="external-link">nlme</a></span><span class="op">(</span><span class="va">f</span><span class="op">[</span><span class="st">"DFOP"</span>, <span class="op">]</span><span class="op">)</span></span> <span class="r-in"> <span class="fu"><a href="https://rdrr.io/r/stats/anova.html" class="external-link">anova</a></span><span class="op">(</span><span class="va">f_nlme_sfo</span>, <span class="va">f_nlme_dfop</span><span class="op">)</span></span> <span class="r-out co"><span class="r-pr">#></span> Model df AIC BIC logLik Test L.Ratio p-value</span> diff --git a/docs/reference/summary.nlme.mmkin.html b/docs/reference/summary.nlme.mmkin.html index d2ed2a86..3f98bec7 100644 --- a/docs/reference/summary.nlme.mmkin.html +++ b/docs/reference/summary.nlme.mmkin.html @@ -96,7 +96,7 @@ endpoints such as formation fractions and DT50 values. Optionally <div id="ref-usage"> <div class="sourceCode"><pre class="sourceCode r"><code><span class="co"># S3 method for nlme.mmkin</span> -<span class="fu"><a href="https://rdrr.io/pkg/saemix/man/summary-methods.html" class="external-link">summary</a></span><span class="op">(</span> +<span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span> <span class="va">object</span>, data <span class="op">=</span> <span class="cn">FALSE</span>, verbose <span class="op">=</span> <span class="cn">FALSE</span>, @@ -193,16 +193,20 @@ José Pinheiro and Douglas Bates for the components inherited from nlme</p> <span class="r-in"> n <span class="op">=</span> <span class="fl">1</span><span class="op">)</span><span class="op">[[</span><span class="fl">1</span><span class="op">]</span><span class="op">]</span></span> <span class="r-in"><span class="op">}</span><span class="op">)</span></span> <span class="r-in"></span> +<span class="r-in"><span class="co"># \dontrun{</span></span> <span class="r-in"><span class="co"># Evaluate using mmkin and nlme</span></span> <span class="r-in"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://svn.r-project.org/R-packages/trunk/nlme/" class="external-link">nlme</a></span><span class="op">)</span></span> <span class="r-in"><span class="va">f_mmkin</span> <span class="op"><-</span> <span class="fu"><a href="mmkin.html">mmkin</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="va">ds_sfo_syn</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span>, error_model <span class="op">=</span> <span class="st">"tc"</span>, cores <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span> +<span class="r-wrn co"><span class="r-pr">#></span> <span class="warning">Warning: </span>Optimisation did not converge:</span> +<span class="r-wrn co"><span class="r-pr">#></span> iteration limit reached without convergence (10)</span> <span class="r-in"><span class="va">f_nlme</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/nlme/man/nlme.html" class="external-link">nlme</a></span><span class="op">(</span><span class="va">f_mmkin</span><span class="op">)</span></span> -<span class="r-in"><span class="fu"><a href="https://rdrr.io/pkg/saemix/man/summary-methods.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">f_nlme</span>, data <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span> +<span class="r-wrn co"><span class="r-pr">#></span> <span class="warning">Warning: </span>Iteration 4, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8)</span> +<span class="r-in"><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">f_nlme</span>, data <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span> <span class="r-out co"><span class="r-pr">#></span> nlme version used for fitting: 3.1.155 </span> <span class="r-out co"><span class="r-pr">#></span> mkin version used for pre-fitting: 1.1.0 </span> -<span class="r-out co"><span class="r-pr">#></span> R version used for fitting: 4.1.2 </span> -<span class="r-out co"><span class="r-pr">#></span> Date of fit: Mon Mar 7 13:15:33 2022 </span> -<span class="r-out co"><span class="r-pr">#></span> Date of summary: Mon Mar 7 13:15:33 2022 </span> +<span class="r-out co"><span class="r-pr">#></span> R version used for fitting: 4.1.3 </span> +<span class="r-out co"><span class="r-pr">#></span> Date of fit: Mon Mar 14 08:58:29 2022 </span> +<span class="r-out co"><span class="r-pr">#></span> Date of summary: Mon Mar 14 08:58:29 2022 </span> <span class="r-out co"><span class="r-pr">#></span> </span> <span class="r-out co"><span class="r-pr">#></span> Equations:</span> <span class="r-out co"><span class="r-pr">#></span> d_parent/dt = - k_parent * parent</span> @@ -212,7 +216,7 @@ José Pinheiro and Douglas Bates for the components inherited from nlme</p> <span class="r-out co"><span class="r-pr">#></span> </span> <span class="r-out co"><span class="r-pr">#></span> Model predictions using solution type analytical </span> <span class="r-out co"><span class="r-pr">#></span> </span> -<span class="r-out co"><span class="r-pr">#></span> Fitted in 0.528 s using 4 iterations</span> +<span class="r-out co"><span class="r-pr">#></span> Fitted in 0.527 s using 4 iterations</span> <span class="r-out co"><span class="r-pr">#></span> </span> <span class="r-out co"><span class="r-pr">#></span> Variance model: Two-component variance function </span> <span class="r-out co"><span class="r-pr">#></span> </span> @@ -352,6 +356,7 @@ José Pinheiro and Douglas Bates for the components inherited from nlme</p> <span class="r-out co"><span class="r-pr">#></span> ds 5 parent 90 20.8 22.692 -1.89165 1.7926 -1.055273</span> <span class="r-out co"><span class="r-pr">#></span> ds 5 parent 120 13.4 13.768 -0.36790 1.0876 -0.338259</span> <span class="r-out co"><span class="r-pr">#></span> ds 5 parent 120 13.8 13.768 0.03210 1.0876 0.029517</span> +<span class="r-in"><span class="co"># }</span></span> <span class="r-in"></span> </code></pre></div> </div> diff --git a/man/create_deg_func.Rd b/man/create_deg_func.Rd index 69058038..7b419342 100644 --- a/man/create_deg_func.Rd +++ b/man/create_deg_func.Rd @@ -24,8 +24,8 @@ SFO_SFO <- mkinmod( m1 = mkinsub("SFO")) FOCUS_D <- subset(FOCUS_2006_D, value != 0) # to avoid warnings fit_1 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE) -fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) \dontrun{ +fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) if (require(rbenchmark)) benchmark( analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd index ed58d603..ed19c0d3 100644 --- a/man/nlme.mmkin.Rd +++ b/man/nlme.mmkin.Rd @@ -92,12 +92,11 @@ methods that will automatically work on 'nlme.mmkin' objects, such as \examples{ ds <- lapply(experimental_data_for_UBA_2019[6:10], function(x) subset(x$data[c("name", "time", "value")], name == "parent")) -f <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, cores = 1) -library(nlme) -f_nlme_sfo <- nlme(f["SFO", ]) \dontrun{ - + f <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, cores = 1) + library(nlme) + f_nlme_sfo <- nlme(f["SFO", ]) f_nlme_dfop <- nlme(f["DFOP", ]) anova(f_nlme_sfo, f_nlme_dfop) print(f_nlme_dfop) diff --git a/man/summary.nlme.mmkin.Rd b/man/summary.nlme.mmkin.Rd index d7e61074..425df096 100644 --- a/man/summary.nlme.mmkin.Rd +++ b/man/summary.nlme.mmkin.Rd @@ -87,11 +87,13 @@ ds_sfo_syn <- lapply(ds_sfo_mean, function(ds) { n = 1)[[1]] }) +\dontrun{ # Evaluate using mmkin and nlme library(nlme) f_mmkin <- mmkin("SFO", ds_sfo_syn, quiet = TRUE, error_model = "tc", cores = 1) f_nlme <- nlme(f_mmkin) summary(f_nlme, data = TRUE) +} } \author{ @@ -7,14 +7,14 @@ Loading required package: parallel ✔ | 5 | Calculation of Akaike weights ✔ | 2 | Export dataset for reading into CAKE ✔ | 12 | Confidence intervals and p-values [1.0s] -✔ | 1 12 | Dimethenamid data from 2018 [31.0s] +✔ | 1 12 | Dimethenamid data from 2018 [31.2s] ──────────────────────────────────────────────────────────────────────────────── Skip (test_dmta.R:98:3): Different backends get consistent results for SFO-SFO3+, dimethenamid data Reason: Fitting this ODE model with saemix takes about 15 minutes on my system ──────────────────────────────────────────────────────────────────────────────── ✔ | 14 | Error model fitting [4.7s] ✔ | 5 | Time step normalisation -✔ | 4 | Calculation of FOCUS chi2 error levels [0.5s] +✔ | 4 | Calculation of FOCUS chi2 error levels [0.6s] ✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.8s] ✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3s] ✔ | 1 | Fitting the logistic model [0.2s] @@ -25,27 +25,43 @@ Reason: Fitting with saemix takes around 10 minutes when using deSolve ──────────────────────────────────────────────────────────────────────────────── ✔ | 3 | Test dataset classes mkinds and mkindsg ✔ | 10 | Special cases of mkinfit calls [0.4s] -✔ | 3 | mkinfit features [0.6s] -✔ | 8 | mkinmod model generation and printing [0.2s] -✔ | 3 | Model predictions with mkinpredict [0.3s] -✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.4s] -✔ | 9 | Nonlinear mixed-effects models with nlme [8.0s] -✔ | 16 | Plotting [1.3s] +✔ | 3 | mkinfit features [0.7s] +✔ | 8 | mkinmod model generation and printing [0.3s] +✔ | 3 | Model predictions with mkinpredict [0.4s] +✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.5s] +✔ | 9 | Nonlinear mixed-effects models with nlme [8.2s] +✔ | 5 16 | Plotting [10.5s] +──────────────────────────────────────────────────────────────────────────────── +Warning (test_plot.R:48:3): Plotting mkinfit, mmkin and mixed model objects is reproducible +Adding new file snapshot: 'tests/testhat/_snaps/mixed-model-fit-for-mmkin-object.svg' + +Warning (test_plot.R:51:3): Plotting mkinfit, mmkin and mixed model objects is reproducible +Adding new file snapshot: 'tests/testhat/_snaps/mixed-model-fit-for-saem-object-with-saemix-transformations.svg' + +Warning (test_plot.R:56:3): Plotting mkinfit, mmkin and mixed model objects is reproducible +Adding new file snapshot: 'tests/testhat/_snaps/mixed-model-fit-for-nlme-object.svg' + +Warning (test_plot.R:64:3): Plotting mkinfit, mmkin and mixed model objects is reproducible +Adding new file snapshot: 'tests/testhat/_snaps/mixed-model-fit-for-saem-object-with-mkin-transformations.svg' + +Warning (test_plot.R:68:3): Plotting mkinfit, mmkin and mixed model objects is reproducible +Adding new file snapshot: 'tests/testhat/_snaps/plot-errmod-with-focus-d-obs-eigen.svg' +──────────────────────────────────────────────────────────────────────────────── ✔ | 4 | Residuals extracted from mkinfit models -✔ | 23 | saemix parent models [26.7s] -✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.4s] -✔ | 7 | Fitting the SFORB model [3.7s] +✔ | 23 | saemix parent models [28.9s] +✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.5s] +✔ | 7 | Fitting the SFORB model [3.8s] ✔ | 1 | Summaries of old mkinfit objects ✔ | 4 | Summary [0.1s] -✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.1s] -✔ | 9 | Hypothesis tests [8.1s] -✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.3s] +✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.2s] +✔ | 9 | Hypothesis tests [8.2s] +✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 99.1 s +Duration: 111.6 s ── Skipped tests ────────────────────────────────────────────────────────────── • Fitting this ODE model with saemix takes about 15 minutes on my system (1) • Fitting with saemix takes around 10 minutes when using deSolve (1) -[ FAIL 0 | WARN 0 | SKIP 2 | PASS 221 ] +[ FAIL 0 | WARN 5 | SKIP 2 | PASS 221 ] diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R index 10696082..8ffe0b9d 100644 --- a/tests/testthat/setup_script.R +++ b/tests/testthat/setup_script.R @@ -202,17 +202,3 @@ dfop_saemix_2 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "saemix") saem_biphasic_m <- saem(mmkin_biphasic, transformations = "mkin", quiet = TRUE) saem_biphasic_s <- saem(mmkin_biphasic, transformations = "saemix", quiet = TRUE) -# UBA datasets -ds_uba <- lapply(experimental_data_for_UBA_2019[6:10], - function(x) subset(x$data[c("name", "time", "value")])) -names(ds_uba) <- paste("Dataset", 6:10) -sfo_sfo_uba <- mkinmod(parent = mkinsub("SFO", "A1"), - A1 = mkinsub("SFO"), quiet = TRUE) -dfop_sfo_uba <- mkinmod(parent = mkinsub("DFOP", "A1"), - A1 = mkinsub("SFO"), quiet = TRUE) -f_uba_mmkin <- mmkin(list("SFO-SFO" = sfo_sfo_uba, "DFOP-SFO" = dfop_sfo_uba), - ds_uba, quiet = TRUE, cores = n_cores) -f_uba_dfop_sfo_mixed <- mixed(f_uba_mmkin[2, ]) - -f_uba_sfo_sfo_saem <- saem(f_uba_mmkin["SFO-SFO", ], quiet = TRUE, transformations = "saemix") -f_uba_dfop_sfo_saem <- saem(f_uba_mmkin["DFOP-SFO", ], quiet = TRUE, transformations = "saemix") diff --git a/tests/testthat/test_analytical.R b/tests/testthat/test_analytical.R index 66fb1ace..e6cb7ed3 100644 --- a/tests/testthat/test_analytical.R +++ b/tests/testthat/test_analytical.R @@ -1,9 +1,7 @@ context("Analytical solutions for coupled models") -# We do not want the warnings due to non-normality of residuals here -warn_option <- options(warn=-1) - test_that("The analytical solutions for SFO-SFO are correct", { + skip_on_cran() # No sink, no formation fractions SFO_SFO_nosink <- mkinmod( parent = mkinsub("SFO", to = "m1", sink = FALSE), @@ -50,6 +48,7 @@ test_that("The analytical solutions for SFO-SFO are correct", { }) test_that("The analytical solution for DFOP-SFO are correct", { + skip_on_cran() # With formation fraction f_dfop_sfo_analytical <- mkinfit(DFOP_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE) @@ -61,5 +60,3 @@ test_that("The analytical solution for DFOP-SFO are correct", { tolerance = 5e-6 ) }) - -options(warn = warn_option$warn) diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R index 4f484cf3..58a00662 100644 --- a/tests/testthat/test_plot.R +++ b/tests/testthat/test_plot.R @@ -30,6 +30,20 @@ test_that("Plotting mkinfit, mmkin and mixed model objects is reproducible", { plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve) vdiffr::expect_doppelganger("plot_err for FOCUS D", plot_err_sfo_sfo) + # UBA datasets + ds_uba <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) subset(x$data[c("name", "time", "value")])) + names(ds_uba) <- paste("Dataset", 6:10) + sfo_sfo_uba <- mkinmod(parent = mkinsub("SFO", "A1"), + A1 = mkinsub("SFO"), quiet = TRUE) + dfop_sfo_uba <- mkinmod(parent = mkinsub("DFOP", "A1"), + A1 = mkinsub("SFO"), quiet = TRUE) + f_uba_mmkin <- mmkin(list("DFOP-SFO" = dfop_sfo_uba), + ds_uba, quiet = TRUE, cores = n_cores) + f_uba_dfop_sfo_mixed <- mixed(f_uba_mmkin["DFOP-SFO", ]) + + f_uba_dfop_sfo_saem <- saem(f_uba_mmkin["DFOP-SFO", ], quiet = TRUE, transformations = "saemix") + plot_biphasic_mmkin <- function() plot(f_uba_dfop_sfo_mixed) vdiffr::expect_doppelganger("mixed model fit for mmkin object", plot_biphasic_mmkin) diff --git a/tests/testthat/test_saemix_parent.R b/tests/testthat/test_saemix_parent.R index 8beceba9..340db6f1 100644 --- a/tests/testthat/test_saemix_parent.R +++ b/tests/testthat/test_saemix_parent.R @@ -2,6 +2,7 @@ context("saemix parent models") test_that("Parent fits using saemix are correctly implemented", { + skip_on_cran() expect_error(saem(fits), "Only row objects") # Some fits were done in the setup script mmkin_sfo_2 <- update(mmkin_sfo_1, fixed_initials = c(parent = 100)) |