From 3cddc58e6fcdd5341b354dc5b5f784ec8190f62b Mon Sep 17 00:00:00 2001
From: Johannes Ranke
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