From 3cddc58e6fcdd5341b354dc5b5f784ec8190f62b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 14 Mar 2022 15:41:56 +0100 Subject: Reduce check time for CRAN, release --- R/create_deg_func.R | 2 +- R/nlme.mmkin.R | 7 +++-- R/summary.nlme.mmkin.R | 2 ++ check.log | 2 +- docs/pkgdown.yml | 2 +- docs/reference/Rplot001.png | Bin 14083 -> 1011 bytes docs/reference/Rplot002.png | Bin 13699 -> 57977 bytes docs/reference/Rplot003.png | Bin 48687 -> 59128 bytes docs/reference/create_deg_func.html | 10 +++---- docs/reference/nlme.mmkin.html | 9 +++---- docs/reference/summary.nlme.mmkin.html | 17 +++++++----- man/create_deg_func.Rd | 2 +- man/nlme.mmkin.Rd | 7 +++-- man/summary.nlme.mmkin.Rd | 2 ++ test.log | 48 ++++++++++++++++++++++----------- tests/testthat/setup_script.R | 14 ---------- tests/testthat/test_analytical.R | 7 ++--- tests/testthat/test_plot.R | 14 ++++++++++ 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, ...) { diff --git a/check.log b/check.log index 89847aab..807e2f33 100644 --- a/check.log +++ b/check.log @@ -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 index ca982688..17a35806 100644 Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png index de2d61aa..ddd3a0d7 100644 Binary files a/docs/reference/Rplot002.png and b/docs/reference/Rplot002.png differ diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png index f8bf10bb..fa29fc43 100644 Binary files a/docs/reference/Rplot003.png and b/docs/reference/Rplot003.png differ 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 @@ #> Temporary DLL for differentials generated and loaded 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), @@ -120,8 +120,8 @@ replications = 2) #> Loading required package: rbenchmark #> test replications elapsed relative user.self sys.self user.child -#> 1 analytical 2 0.406 1.000 0.407 0.000 0 -#> 2 deSolve 2 0.698 1.719 0.695 0.003 0 +#> 1 analytical 2 0.394 1.000 0.393 0 0 +#> 2 deSolve 2 0.678 1.721 0.677 0 0 #> sys.child #> 1 0 #> 2 0 @@ -134,8 +134,8 @@ deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), replications = 2) #> test replications elapsed relative user.self sys.self user.child -#> 1 analytical 2 0.855 1.000 0.856 0 0 -#> 2 deSolve 2 1.588 1.857 1.587 0 0 +#> 1 analytical 2 0.829 1.000 0.829 0 0 +#> 2 deSolve 2 1.559 1.881 1.559 0 0 #> sys.child #> 1 0 #> 2 0 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.

data = "auto", fixed = lapply(as.list(names(mean_degparms(model))), function(el) eval(parse(text = paste(el, 1, sep = "~")))), - random = pdDiag(fixed), + random = pdDiag(fixed), groups, start = mean_degparms(model, random = TRUE, test_log_parms = TRUE), correlation = NULL, @@ -187,12 +187,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)
 #>             Model df      AIC      BIC    logLik   Test  L.Ratio p-value
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
 
     
# S3 method for nlme.mmkin
-summary(
+summary(
   object,
   data = FALSE,
   verbose = FALSE,
@@ -193,16 +193,20 @@ José Pinheiro and Douglas Bates for the components inherited from nlme

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) +#> Warning: Optimisation did not converge: +#> iteration limit reached without convergence (10) f_nlme <- nlme(f_mmkin) -summary(f_nlme, data = TRUE) +#> Warning: Iteration 4, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8) +summary(f_nlme, data = TRUE) #> nlme version used for fitting: 3.1.155 #> mkin version used for pre-fitting: 1.1.0 -#> R version used for fitting: 4.1.2 -#> Date of fit: Mon Mar 7 13:15:33 2022 -#> Date of summary: Mon Mar 7 13:15:33 2022 +#> R version used for fitting: 4.1.3 +#> Date of fit: Mon Mar 14 08:58:29 2022 +#> Date of summary: Mon Mar 14 08:58:29 2022 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -212,7 +216,7 @@ José Pinheiro and Douglas Bates for the components inherited from nlme

#> #> Model predictions using solution type analytical #> -#> Fitted in 0.528 s using 4 iterations +#> Fitted in 0.527 s using 4 iterations #> #> Variance model: Two-component variance function #> @@ -352,6 +356,7 @@ José Pinheiro and Douglas Bates for the components inherited from nlme

#> ds 5 parent 90 20.8 22.692 -1.89165 1.7926 -1.055273 #> ds 5 parent 120 13.4 13.768 -0.36790 1.0876 -0.338259 #> ds 5 parent 120 13.8 13.768 0.03210 1.0876 0.029517 +# }
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{ diff --git a/test.log b/test.log index a02ab432..cd168e7f 100644 --- a/test.log +++ b/test.log @@ -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)) -- cgit v1.2.1