aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-05-02 16:02:35 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-05-02 16:02:35 +0200
commitce9399d08a05fffe8b003386c445f5ceab25dde5 (patch)
tree5f9aa1ee7f4762c79013278f61760503b1321e3c
parent70591022c07f0e8fb4dd67789b7c8d78af8ebc18 (diff)
Improve tests
- Improve control of the number of cores - Reduce the precision of the correlation matrix in the test summary output, as the exact results are platform dependent
-rw-r--r--check.log6
-rw-r--r--test.log38
-rw-r--r--tests/testthat/summary_DFOP_FOCUS_C.txt12
-rw-r--r--tests/testthat/test_error_models.R19
-rw-r--r--tests/testthat/test_plots_summary_twa.R4
5 files changed, 45 insertions, 34 deletions
diff --git a/check.log b/check.log
index 445fb66b..325b690c 100644
--- a/check.log
+++ b/check.log
@@ -1,11 +1,11 @@
* using log directory ‘/home/jranke/git/mkin/mkin.Rcheck’
-* using R version 3.5.2 (2018-12-20)
+* using R version 3.6.0 (2019-04-26)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using options ‘--no-tests --as-cran’
* checking for file ‘mkin/DESCRIPTION’ ... OK
* checking extension type ... Package
-* this is package ‘mkin’ version ‘0.9.48.1’
+* this is package ‘mkin’ version ‘0.9.49.4’
* package encoding: UTF-8
* checking CRAN incoming feasibility ... Note_to_CRAN_maintainers
Maintainer: ‘Johannes Ranke <jranke@uni-bremen.de>’
@@ -17,10 +17,10 @@ Maintainer: ‘Johannes Ranke <jranke@uni-bremen.de>’
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
-* checking serialization versions ... OK
* checking whether package ‘mkin’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
+* checking for future file timestamps ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
diff --git a/test.log b/test.log
index 04c7f1ce..b1e9b9f3 100644
--- a/test.log
+++ b/test.log
@@ -1,24 +1,24 @@
Loading mkin
Testing mkin
-✔ | OK F W S | Context
- ⠏ | 0 | Export dataset for reading into CAKE ⠋ | 1 | Export dataset for reading into CAKE ✔ | 1 | Export dataset for reading into CAKE
- ⠏ | 0 | Error model fitting ⠋ | 1 | Error model fitting ⠙ | 2 | Error model fitting ⠹ | 3 | Error model fitting ⠸ | 4 | Error model fitting ⠼ | 5 | Error model fitting ⠴ | 6 | Error model fitting ⠦ | 7 | Error model fitting ⠧ | 8 | Error model fitting ⠇ | 9 | Error model fitting ⠏ | 10 | Error model fitting ⠋ | 11 | Error model fitting ⠙ | 12 | Error model fitting ✔ | 12 | Error model fitting [148.0 s]
- ⠏ | 0 | Calculation of FOCUS chi2 error levels ⠋ | 1 | Calculation of FOCUS chi2 error levels ⠙ | 2 | Calculation of FOCUS chi2 error levels ⠹ | 3 | Calculation of FOCUS chi2 error levels ✔ | 3 | Calculation of FOCUS chi2 error levels [2.3 s]
- ⠏ | 0 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠋ | 1 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠙ | 2 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠹ | 3 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠸ | 4 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠼ | 5 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠴ | 6 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠦ | 7 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠧ | 8 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠇ | 9 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠏ | 10 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠋ | 11 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠙ | 12 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠹ | 13 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ✔ | 13 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.7 s]
- ⠏ | 0 | Test fitting the decline of metabolites from their maximum ⠋ | 1 | Test fitting the decline of metabolites from their maximum ⠙ | 2 | Test fitting the decline of metabolites from their maximum ⠹ | 3 | Test fitting the decline of metabolites from their maximum ⠸ | 4 | Test fitting the decline of metabolites from their maximum ⠼ | 5 | Test fitting the decline of metabolites from their maximum ⠴ | 6 | Test fitting the decline of metabolites from their maximum ✔ | 6 | Test fitting the decline of metabolites from their maximum [0.9 s]
- ⠏ | 0 | Fitting the logistic model ⠋ | 1 | Fitting the logistic model ✔ | 1 | Fitting the logistic model [0.9 s]
- ⠏ | 0 | Test dataset class mkinds used in gmkin ⠋ | 1 | Test dataset class mkinds used in gmkin ✔ | 1 | Test dataset class mkinds used in gmkin
- ⠏ | 0 | Special cases of mkinfit calls ⠋ | 1 | Special cases of mkinfit calls ⠙ | 2 | Special cases of mkinfit calls ⠹ | 3 | Special cases of mkinfit calls ⠸ | 4 | Special cases of mkinfit calls ⠼ | 5 | Special cases of mkinfit calls ⠴ | 6 | Special cases of mkinfit calls ⠦ | 7 | Special cases of mkinfit calls ⠧ | 8 | Special cases of mkinfit calls ⠇ | 9 | Special cases of mkinfit calls ⠏ | 10 | Special cases of mkinfit calls ⠋ | 11 | Special cases of mkinfit calls ⠙ | 12 | Special cases of mkinfit calls ✔ | 12 | Special cases of mkinfit calls [2.7 s]
- ⠏ | 0 | mkinmod model generation and printing ⠋ | 1 | mkinmod model generation and printing ⠙ | 2 | mkinmod model generation and printing ⠹ | 3 | mkinmod model generation and printing ⠸ | 4 | mkinmod model generation and printing ⠼ | 5 | mkinmod model generation and printing ⠴ | 6 | mkinmod model generation and printing ⠦ | 7 | mkinmod model generation and printing ⠧ | 8 | mkinmod model generation and printing ⠇ | 9 | mkinmod model generation and printing ✔ | 9 | mkinmod model generation and printing [0.2 s]
- ⠏ | 0 | Model predictions with mkinpredict ⠋ | 1 | Model predictions with mkinpredict ⠙ | 2 | Model predictions with mkinpredict ⠹ | 3 | Model predictions with mkinpredict ✔ | 3 | Model predictions with mkinpredict [0.3 s]
- ⠏ | 0 | Evaluations according to 2015 NAFTA guidance ⠋ | 1 | Evaluations according to 2015 NAFTA guidance ⠙ | 2 | Evaluations according to 2015 NAFTA guidance ⠹ | 3 | Evaluations according to 2015 NAFTA guidance ⠸ | 4 | Evaluations according to 2015 NAFTA guidance ⠼ | 5 | Evaluations according to 2015 NAFTA guidance ⠴ | 6 | Evaluations according to 2015 NAFTA guidance ⠦ | 7 | Evaluations according to 2015 NAFTA guidance ⠧ | 8 | Evaluations according to 2015 NAFTA guidance ⠇ | 9 | Evaluations according to 2015 NAFTA guidance ⠏ | 10 | Evaluations according to 2015 NAFTA guidance ⠋ | 11 | Evaluations according to 2015 NAFTA guidance ⠙ | 12 | Evaluations according to 2015 NAFTA guidance ⠹ | 13 | Evaluations according to 2015 NAFTA guidance ⠸ | 14 | Evaluations according to 2015 NAFTA guidance ⠼ | 15 | Evaluations according to 2015 NAFTA guidance ⠴ | 16 | Evaluations according to 2015 NAFTA guidance ✔ | 16 | Evaluations according to 2015 NAFTA guidance [3.9 s]
- ⠏ | 0 | Fitting of parent only models ⠋ | 1 | Fitting of parent only models ⠙ | 2 | Fitting of parent only models ⠹ | 3 | Fitting of parent only models ⠸ | 4 | Fitting of parent only models ⠼ | 5 | Fitting of parent only models ⠴ | 6 | Fitting of parent only models ⠦ | 7 | Fitting of parent only models ⠧ | 8 | Fitting of parent only models ⠇ | 9 | Fitting of parent only models ⠏ | 10 | Fitting of parent only models ⠋ | 11 | Fitting of parent only models ⠙ | 12 | Fitting of parent only models ⠹ | 13 | Fitting of parent only models ⠸ | 14 | Fitting of parent only models ⠼ | 15 | Fitting of parent only models ⠴ | 16 | Fitting of parent only models ⠦ | 17 | Fitting of parent only models ⠧ | 18 | Fitting of parent only models ⠇ | 19 | Fitting of parent only models ⠏ | 20 | Fitting of parent only models ⠋ | 21 | Fitting of parent only models ✔ | 21 | Fitting of parent only models [40.0 s]
- ⠏ | 0 | Calculation of maximum time weighted average concentrations (TWAs) ⠋ | 1 | Calculation of maximum time weighted average concentrations (TWAs) ⠙ | 2 | Calculation of maximum time weighted average concentrations (TWAs) ⠹ | 3 | Calculation of maximum time weighted average concentrations (TWAs) ⠸ | 4 | Calculation of maximum time weighted average concentrations (TWAs) ✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.3 s]
- ⠏ | 0 | Summary ⠋ | 1 | Summary ✔ | 1 | Summary
- ⠏ | 0 | Plotting ⠋ | 1 | Plotting ⠙ | 2 | Plotting ⠹ | 3 | Plotting ⠸ | 4 | Plotting ✔ | 4 | Plotting [0.3 s]
- ⠏ | 0 | AIC calculation ⠋ | 1 | AIC calculation ⠙ | 2 | AIC calculation ✔ | 2 | AIC calculation
- ⠏ | 0 | Complex test case from Schaefer et al. (2007) Piacenza paper ⠋ | 1 | Complex test case from Schaefer et al. (2007) Piacenza paper ⠙ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper ✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [5.3 s]
- ⠏ | 0 | Results for synthetic data established in expertise for UBA (Ranke 2014) ⠋ | 1 | Results for synthetic data established in expertise for UBA (Ranke 2014) ⠙ | 2 | Results for synthetic data established in expertise for UBA (Ranke 2014) ⠹ | 3 | Results for synthetic data established in expertise for UBA (Ranke 2014) ⠸ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) ✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.1 s]
+✔ | OK F W S | Context
+ ⠏ | 0 | Export dataset for reading into CAKE ✔ | 1 | Export dataset for reading into CAKE
+ ⠏ | 0 | Error model fitting ⠋ | 1 | Error model fitting ⠹ | 3 | Error model fitting ⠸ | 4 | Error model fitting ⠼ | 5 | Error model fitting ⠴ | 6 | Error model fitting ⠧ | 8 | Error model fitting ⠏ | 10 | Error model fitting ⠋ | 11 | Error model fitting ✔ | 12 | Error model fitting [147.8 s]
+ ⠏ | 0 | Calculation of FOCUS chi2 error levels ⠋ | 1 | Calculation of FOCUS chi2 error levels ⠹ | 3 | Calculation of FOCUS chi2 error levels ✔ | 3 | Calculation of FOCUS chi2 error levels [2.3 s]
+ ⠏ | 0 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠋ | 1 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠙ | 2 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠸ | 4 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠇ | 9 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ✔ | 13 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.7 s]
+ ⠏ | 0 | Test fitting the decline of metabolites from their maximum ⠋ | 1 | Test fitting the decline of metabolites from their maximum ⠹ | 3 | Test fitting the decline of metabolites from their maximum ⠼ | 5 | Test fitting the decline of metabolites from their maximum ✔ | 6 | Test fitting the decline of metabolites from their maximum [0.9 s]
+ ⠏ | 0 | Fitting the logistic model ⠋ | 1 | Fitting the logistic model ✔ | 1 | Fitting the logistic model [0.9 s]
+ ⠏ | 0 | Test dataset class mkinds used in gmkin ✔ | 1 | Test dataset class mkinds used in gmkin
+ ⠏ | 0 | Special cases of mkinfit calls ⠋ | 1 | Special cases of mkinfit calls ⠇ | 9 | Special cases of mkinfit calls ⠏ | 10 | Special cases of mkinfit calls ⠋ | 11 | Special cases of mkinfit calls ⠙ | 12 | Special cases of mkinfit calls ✔ | 12 | Special cases of mkinfit calls [2.7 s]
+ ⠏ | 0 | mkinmod model generation and printing ⠇ | 9 | mkinmod model generation and printing ✔ | 9 | mkinmod model generation and printing [0.2 s]
+ ⠏ | 0 | Model predictions with mkinpredict ⠋ | 1 | Model predictions with mkinpredict ✔ | 3 | Model predictions with mkinpredict [0.3 s]
+ ⠏ | 0 | Evaluations according to 2015 NAFTA guidance ⠙ | 2 | Evaluations according to 2015 NAFTA guidance ⠇ | 9 | Evaluations according to 2015 NAFTA guidance ⠏ | 10 | Evaluations according to 2015 NAFTA guidance ⠴ | 16 | Evaluations according to 2015 NAFTA guidance ✔ | 16 | Evaluations according to 2015 NAFTA guidance [3.9 s]
+ ⠏ | 0 | Fitting of parent only models ⠋ | 1 | Fitting of parent only models ⠙ | 2 | Fitting of parent only models ⠹ | 3 | Fitting of parent only models ⠸ | 4 | Fitting of parent only models ⠼ | 5 | Fitting of parent only models ⠴ | 6 | Fitting of parent only models ⠦ | 7 | Fitting of parent only models ⠧ | 8 | Fitting of parent only models ⠇ | 9 | Fitting of parent only models ⠏ | 10 | Fitting of parent only models ⠋ | 11 | Fitting of parent only models ⠙ | 12 | Fitting of parent only models ⠹ | 13 | Fitting of parent only models ⠴ | 16 | Fitting of parent only models ⠧ | 18 | Fitting of parent only models ⠏ | 20 | Fitting of parent only models ✔ | 21 | Fitting of parent only models [40.1 s]
+ ⠏ | 0 | Calculation of maximum time weighted average concentrations (TWAs) ⠋ | 1 | Calculation of maximum time weighted average concentrations (TWAs) ⠙ | 2 | Calculation of maximum time weighted average concentrations (TWAs) ⠹ | 3 | Calculation of maximum time weighted average concentrations (TWAs) ⠸ | 4 | Calculation of maximum time weighted average concentrations (TWAs) ✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2 s]
+ ⠏ | 0 | Summary ✔ | 1 | Summary
+ ⠏ | 0 | Plotting ⠹ | 3 | Plotting ✔ | 4 | Plotting [0.3 s]
+ ⠏ | 0 | AIC calculation ✔ | 2 | AIC calculation
+ ⠏ | 0 | Complex test case from Schaefer et al. (2007) Piacenza paper ⠋ | 1 | Complex test case from Schaefer et al. (2007) Piacenza paper ✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [5.3 s]
+ ⠏ | 0 | Results for synthetic data established in expertise for UBA (Ranke 2014) ⠋ | 1 | Results for synthetic data established in expertise for UBA (Ranke 2014) ⠹ | 3 | Results for synthetic data established in expertise for UBA (Ranke 2014) ✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.1 s]
══ Results ═════════════════════════════════════════════════════════════════════
Duration: 223.4 s
diff --git a/tests/testthat/summary_DFOP_FOCUS_C.txt b/tests/testthat/summary_DFOP_FOCUS_C.txt
index c4800f35..fb8051c5 100644
--- a/tests/testthat/summary_DFOP_FOCUS_C.txt
+++ b/tests/testthat/summary_DFOP_FOCUS_C.txt
@@ -43,12 +43,12 @@ g_ilr 1.2490 0.05811 1.0870 1.4100
sigma 0.6962 0.16410 0.2406 1.1520
Parameter correlation:
- parent_0 log_k1 log_k2 g_ilr sigma
-parent_0 1.000e+00 4.393e-01 8.805e-02 -3.176e-02 5.407e-07
-log_k1 4.393e-01 1.000e+00 4.821e-01 -6.716e-01 4.399e-07
-log_k2 8.805e-02 4.821e-01 1.000e+00 -7.532e-01 -1.143e-07
-g_ilr -3.176e-02 -6.716e-01 -7.532e-01 1.000e+00 -2.196e-08
-sigma 5.407e-07 4.399e-07 -1.143e-07 -2.196e-08 1.000e+00
+ parent_0 log_k1 log_k2 g_ilr sigma
+parent_0 1e+00 4e-01 9e-02 -3e-02 5e-07
+log_k1 4e-01 1e+00 5e-01 -7e-01 4e-07
+log_k2 9e-02 5e-01 1e+00 -8e-01 -1e-07
+g_ilr -3e-02 -7e-01 -8e-01 1e+00 -2e-08
+sigma 5e-07 4e-07 -1e-07 -2e-08 1e+00
Backtransformed parameters:
Confidence intervals for internally transformed parameters are asymmetric.
diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R
index 5a7aa4e8..1ec48605 100644
--- a/tests/testthat/test_error_models.R
+++ b/tests/testthat/test_error_models.R
@@ -72,9 +72,6 @@ test_that("Error model 'tc' works", {
test_that("Reweighting method 'tc' produces reasonable variance estimates", {
- # I need to make the tc method more robust against that
- # skip_on_cran()
-
# Check if we can approximately obtain the parameters and the error model
# components that were used in the data generation
@@ -94,15 +91,25 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", {
sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07),
n = 1, reps = 100, digits = 5, LOD = -Inf, seed = 123456)
+ # Per default (on my box) use all cores minus one
+ n_cores <- parallel::detectCores() - 1
+
+ # We are only allowed one core on travis
+ if (Sys.getenv("TRAVIS") != "") n_cores = 1
+
+ # Also on Windows we would need to make a cluster first,
+ # and I do not know how this would work on winbuilder or CRAN, so
+ if (Sys.info()["sysname"] == "Windows") n_cores = 1
+
# Unweighted fits
f_2_10 <- mmkin("DFOP", d_2_10, error_model = "const", quiet = TRUE,
- cores = if (Sys.getenv("TRAVIS") != "") 1 else 15)
+ cores = n_cores)
parms_2_10 <- apply(sapply(f_2_10, function(x) x$bparms.optim), 1, mean)
parm_errors_2_10 <- (parms_2_10 - parms_DFOP_optim) / parms_DFOP_optim
expect_true(all(abs(parm_errors_2_10) < 0.12))
f_2_10_tc <- mmkin("DFOP", d_2_10, error_model = "tc", quiet = TRUE,
- cores = if (Sys.getenv("TRAVIS") != "") 1 else 15)
+ cores = n_cores)
parms_2_10_tc <- apply(sapply(f_2_10_tc, function(x) x$bparms.optim), 1, mean)
parm_errors_2_10_tc <- (parms_2_10_tc - parms_DFOP_optim) / parms_DFOP_optim
expect_true(all(abs(parm_errors_2_10_tc) < 0.05))
@@ -153,7 +160,7 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", {
# Doing more takes a lot of computing power
skip_on_travis()
f_met_2_15_tc_e4 <- mmkin(list(m_synth_DFOP_lin), d_met_2_15, quiet = TRUE,
- error_model = "tc", cores = 15)
+ error_model = "tc", cores = n_cores)
parms_met_2_15_tc_e4 <- apply(sapply(f_met_2_15_tc_e4, function(x) x$bparms.optim), 1, mean)
parm_errors_met_2_15_tc_e4 <- (parms_met_2_15_tc_e4[names(parms_DFOP_lin_optim)] -
diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R
index cf5715fa..43036f1a 100644
--- a/tests/testthat/test_plots_summary_twa.R
+++ b/tests/testthat/test_plots_summary_twa.R
@@ -58,6 +58,10 @@ test_that("The summary is reproducible", {
test_summary$date.summary <- "Dummy date for testing"
test_summary$calls <- "test 0"
test_summary$time <- c(elapsed = "test time 0")
+ # The correlation matrix is quite platform dependent
+ # It differs between i386 and amd64 on Windows
+ # and between Travis and my own Linux system
+ test_summary$Corr <- signif(test_summary$Corr, 1)
expect_known_output(print(test_summary), "summary_DFOP_FOCUS_C.txt")
})

Contact - Imprint