From 068b168d78c9550a77514e0c39923f8d40b48b03 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 15 Jun 2020 09:05:27 +0200 Subject: Fix a bug, update for current vdiffr Vignette FOCUS_L failed as I had introduced a bug in the handling of warnings. Current vdiffr only runs visual tests if R < 4.1.0, skipping r-devel for now, see https://github.com/r-lib/vdiffr/commit/630a29d013361fd63fea242f531e2db6aef37919 --- R/mkinfit.R | 2 +- R/summary_DFOP_FOCUS_C.txt | 82 ----------------------------------------- build.log | 24 ++---------- test.log | 22 +++++------ tests/testthat/FOCUS_2006_D.csf | 2 +- tests/testthat/test_nafta.R | 2 - tests/testthat/test_plot.R | 1 - 7 files changed, 17 insertions(+), 118 deletions(-) delete mode 100644 R/summary_DFOP_FOCUS_C.txt diff --git a/R/mkinfit.R b/R/mkinfit.R index ec2d3412..154c2a18 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -853,7 +853,7 @@ mkinfit <- function(mkinmod, observed, if (fit$convergence != 0) { convergence_warning = paste0("Optimisation did not converge:\n", fit$message) - summary_warnings <- c(warnings, convergence_warning) + summary_warnings <- c(summary_warnings, convergence_warning) warning(convergence_warning) } else { if(!quiet) message("Optimisation successfully terminated.\n") diff --git a/R/summary_DFOP_FOCUS_C.txt b/R/summary_DFOP_FOCUS_C.txt deleted file mode 100644 index ab64a588..00000000 --- a/R/summary_DFOP_FOCUS_C.txt +++ /dev/null @@ -1,82 +0,0 @@ -mkin version used for fitting: Dummy 0.0 for testing -R version used for fitting: Dummy R version for testing -Date of fit: Dummy date for testing -Date of summary: Dummy date for testing - -Equations: -d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * - time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time))) - * parent - -Model predictions using solution type analytical - -Fitted using test 0 model solutions performed in test time 0 s - -Error model: Constant variance - -Error model algorithm: OLS - -Starting values for parameters to be optimised: - value type -parent_0 85.10 state -k1 0.10 deparm -k2 0.01 deparm -g 0.50 deparm - -Starting values for the transformed parameters actually optimised: - value lower upper -parent_0 85.100000 -Inf Inf -log_k1 -2.302585 -Inf Inf -log_k2 -4.605170 -Inf Inf -g_ilr 0.000000 -Inf Inf - -Fixed parameter values: -None - -Results: - - AIC BIC logLik - 29.02372 30.00984 -9.511861 - -Optimised, transformed parameters with symmetric confidence intervals: - Estimate Std. Error Lower Upper -parent_0 85.0000 0.66620 83.1500 86.8500 -log_k1 -0.7775 0.03380 -0.8713 -0.6836 -log_k2 -4.0260 0.13100 -4.3890 -3.6620 -g_ilr 1.2490 0.05811 1.0870 1.4100 -sigma 0.6962 0.16410 0.2406 1.1520 - -Parameter correlation: -[1] "Correlation matrix is platform dependent, not tested" - -Backtransformed parameters: -Confidence intervals for internally transformed parameters are asymmetric. -t-test (unrealistically) based on the assumption of normal distribution -for estimators of untransformed parameters. - Estimate t value Pr(>t) Lower Upper -parent_0 85.00000 127.600 1.131e-08 83.15000 86.85000 -k1 0.45960 29.580 3.887e-06 0.41840 0.50480 -k2 0.01785 7.636 7.901e-04 0.01241 0.02568 -g 0.85390 83.310 6.221e-08 0.82310 0.88020 -sigma 0.69620 4.243 6.618e-03 0.24060 1.15200 - -FOCUS Chi2 error levels in percent: - err.min n.optim df -All data 2.661 4 5 -parent 2.661 4 5 - -Estimated disappearance times: - DT50 DT90 DT50_k1 DT50_k2 -parent 1.887 21.25 1.508 38.83 - -Data: - time variable observed predicted residual - 0 parent 85.1 85.003 0.09726 - 1 parent 57.9 58.039 -0.13912 - 3 parent 29.9 30.054 -0.15351 - 7 parent 14.6 13.866 0.73388 - 14 parent 9.7 9.787 -0.08657 - 28 parent 6.6 7.532 -0.93205 - 63 parent 4.0 4.033 -0.03269 - 91 parent 3.9 2.447 1.45348 - 119 parent 0.6 1.484 -0.88424 diff --git a/build.log b/build.log index 0ed7b19a..b94e6450 100644 --- a/build.log +++ b/build.log @@ -2,24 +2,8 @@ * preparing ‘mkin’: * checking DESCRIPTION meta-information ... OK * installing the package to build vignettes -* creating vignettes ... ERROR ---- re-building ‘FOCUS_D.rmd’ using rmarkdown ---- finished re-building ‘FOCUS_D.rmd’ +* creating vignettes ... OK +* checking for LF line-endings in source and make files and shell scripts +* checking for empty or unneeded directories +* building ‘mkin_0.9.50.3.tar.gz’ ---- re-building ‘FOCUS_L.rmd’ using rmarkdown -Quitting from lines 80-83 (FOCUS_L.rmd) -Error: processing vignette 'FOCUS_L.rmd' failed with diagnostics: -argument 1 (type 'list') cannot be handled by 'cat' ---- failed re-building ‘FOCUS_L.rmd’ - ---- re-building ‘mkin.rmd’ using rmarkdown ---- finished re-building ‘mkin.rmd’ - ---- re-building ‘twa.rmd’ using rmarkdown ---- finished re-building ‘twa.rmd’ - -SUMMARY: processing the following file failed: - ‘FOCUS_L.rmd’ - -Error: Vignette re-building failed. -Execution halted diff --git a/test.log b/test.log index c5f0e526..b4e97d72 100644 --- a/test.log +++ b/test.log @@ -5,11 +5,11 @@ Testing mkin ✔ | 2 | Export dataset for reading into CAKE ✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.9 s] ✔ | 4 | Calculation of FOCUS chi2 error levels [0.4 s] -✔ | 7 | Fitting the SFORB model [3.4 s] -✔ | 5 | Analytical solutions for coupled models [3.2 s] +✔ | 7 | Fitting the SFORB model [3.5 s] +✔ | 5 | Analytical solutions for coupled models [3.3 s] ✔ | 5 | Calculation of Akaike weights -✔ | 10 | Confidence intervals and p-values [1.0 s] -✔ | 14 | Error model fitting [4.1 s] +✔ | 10 | Confidence intervals and p-values [1.2 s] +✔ | 14 | Error model fitting [4.0 s] ✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3 s] ✔ | 1 | Fitting the logistic model [0.2 s] ✔ | 1 | Test dataset class mkinds used in gmkin @@ -17,18 +17,18 @@ Testing mkin ✔ | 8 | mkinmod model generation and printing [0.3 s] ✔ | 3 | Model predictions with mkinpredict [0.4 s] ✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.5 s] -✔ | 9 | Nonlinear mixed-effects models [7.7 s] -✔ | 14 | Plotting [1.4 s] +✔ | 9 | Nonlinear mixed-effects models [8.0 s] +✔ | 14 | Plotting [1.5 s] ✔ | 4 | Residuals extracted from mkinfit models -✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.4 s] -✔ | 4 | Summary [0.2 s] +✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.5 s] +✔ | 4 | Summary [0.1 s] ✔ | 1 | Summaries of old mkinfit objects -✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.1 s] -✔ | 9 | Hypothesis tests [6.6 s] +✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.3 s] +✔ | 9 | Hypothesis tests [7.0 s] ✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 38.2 s +Duration: 39.7 s OK: 161 Failed: 0 diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf index 7c8340cd..aa9fc233 100644 --- a/tests/testthat/FOCUS_2006_D.csf +++ b/tests/testthat/FOCUS_2006_D.csf @@ -5,7 +5,7 @@ Description: MeasurementUnits: % AR TimeUnits: days Comments: Created using mkin::CAKE_export -Date: 2020-05-29 +Date: 2020-06-15 Optimiser: IRLS [Data] diff --git a/tests/testthat/test_nafta.R b/tests/testthat/test_nafta.R index 595db999..dad6d84c 100644 --- a/tests/testthat/test_nafta.R +++ b/tests/testthat/test_nafta.R @@ -22,7 +22,6 @@ test_that("Test data from Appendix B are correctly evaluated", { plot_nafta <- function() plot(res) if(requireNamespace("vdiffr", quietly = TRUE)) { - skip_if(getRversion() > 4.0) vdiffr::expect_doppelganger("NAFTA SOP Appendix B", plot_nafta) } }) @@ -50,7 +49,6 @@ test_that("Test data from Appendix D are correctly evaluated", { plot_nafta <- function() plot(res) if(requireNamespace("vdiffr", quietly = TRUE)) { - skip_if(getRversion() > 4.0) vdiffr::expect_doppelganger("Plot NAFTA analysis", plot_nafta) } }) diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R index a33de07f..c6a187be 100644 --- a/tests/testthat/test_plot.R +++ b/tests/testthat/test_plot.R @@ -21,7 +21,6 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", { plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE) plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE) - skip_if(getRversion() > 4.0) vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with defaults", plot_default_FOCUS_C_SFO) vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with residuals like in gmkin", plot_res_FOCUS_C_SFO) vdiffr::expect_doppelganger("plot_res for FOCUS C", plot_res_FOCUS_C_SFO_2) -- cgit v1.2.1