aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-07-15 14:11:25 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-07-15 14:16:29 +0200
commit39b0b93b5d15a3a0e9126f29c753e2fef75dc701 (patch)
treefcb5527b86595b7c077cb574aecc62ff99a26e26
parent9f8e1eb33b586beb7e889212bdababa081b6ff67 (diff)
Improve tests
- Reduce significant digits for the objective function output in mkinfit(..., quiet = FALSE) as R and R-devel gave different output on my system - Add makefile target 'devtest' for testing with R-devel, in order to fix problems showing up with R-devel on Travis
-rw-r--r--GNUmakefile8
-rw-r--r--R/mkinfit.R2
-rw-r--r--man/mmkin.Rd5
-rw-r--r--test_dev.log36
-rw-r--r--tests/testthat/DFOP_FOCUS_C_messages.txt88
5 files changed, 90 insertions, 49 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 8108704a..1adac4e0 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -10,7 +10,7 @@ WINBIN := $(PKGSRC)_$(PKGVERS).zip
# If no alternate bin folder is specified, the default is to use the folder
# containing the first instance of R on the PATH.
RBIN ?= $(shell dirname "`which R`")
-#RBIN=/home/jranke/svn/R/r-devel/build/bin
+RDEVBIN=/home/jranke/svn/R/r-devel/build/bin
# Specify package and static documentation directories for subversion on r-forge
RFSVN ?= $(HOME)/svn/r-forge/kinfit
@@ -78,12 +78,16 @@ test: install
"$(RBIN)/Rscript" -e 'devtools::test()' 2>&1 | tee test.log
sed -i -e "s/\r.*\r//" test.log
+devtest: install
+ "$(RDEVBIN)/Rscript" -e 'devtools::test()' 2>&1 | tee test_dev.log
+ sed -i -e "s/\r.*\r//" test.log
+
slowtests: install
NOT_CRAN=true "$(RBIN)/Rscript" -e 'library(mkin); testthat::test_dir("tests/testthat/slow")' 2>&1 | tee tests_slow.log
sed -i -e "s/\r.*\r//" tests_slow.log
vdiffr:
- /home/jranke/svn/R/r-devel/build/bin/Rscript -e 'vdiffr::manage_cases(filter = "plot|nafta")'
+ "$(RDEVBIN)/Rscript" -e 'vdiffr::manage_cases(filter = "plot|nafta")'
testcheck: test check
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 73fe43e0..12df0325 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -637,7 +637,7 @@ mkinfit <- function(mkinmod, observed,
if (cost < cost.current) {
assign("cost.current", cost, inherits = TRUE)
if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"),
- " at call ", calls, ": ", cost.current, "\n", sep = "")
+ " at call ", calls, ": ", signif(cost.current, 6), "\n", sep = "")
}
}
return(cost)
diff --git a/man/mmkin.Rd b/man/mmkin.Rd
index 9a74a9cd..e06f6cd1 100644
--- a/man/mmkin.Rd
+++ b/man/mmkin.Rd
@@ -34,8 +34,9 @@ for parallel execution.}
}
\value{
A two-dimensional \code{\link{array}} of \code{\link{mkinfit}}
-objects that can be indexed using the model names for the first index (row index)
-and the dataset names for the second index (column index).
+objects and/or try-errors that can be indexed using the model names for the
+first index (row index) and the dataset names for the second index (column
+index).
}
\description{
This function calls \code{\link{mkinfit}} on all combinations of models and
diff --git a/test_dev.log b/test_dev.log
new file mode 100644
index 00000000..b68a7e56
--- /dev/null
+++ b/test_dev.log
@@ -0,0 +1,36 @@
+Loading mkin
+Testing mkin
+✔ | OK F W S | Context
+ ⠏ | 0 | AIC calculation ✔ | 4 | AIC calculation
+ ⠏ | 0 | Export dataset for reading into CAKE ✔ | 2 | Export dataset for reading into CAKE
+ ⠏ | 0 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠋ | 1 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠹ | 3 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ⠏ | 10 | Results for FOCUS D established in expertise for UBA (Ranke 2014) ✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.8 s]
+ ⠏ | 0 | Calculation of FOCUS chi2 error levels ⠙ | 2 | Calculation of FOCUS chi2 error levels ⠸ | 4 | Calculation of FOCUS chi2 error levels ✔ | 4 | Calculation of FOCUS chi2 error levels [0.4 s]
+ ⠏ | 0 | Fitting the SFORB model ⠋ | 1 | Fitting the SFORB model ⠼ | 5 | Fitting the SFORB model ✔ | 7 | Fitting the SFORB model [3.0 s]
+ ⠏ | 0 | Analytical solutions for coupled models ⠋ | 1 | Analytical solutions for coupled models ⠙ | 2 | Analytical solutions for coupled models ⠹ | 3 | Analytical solutions for coupled models ⠸ | 4 | Analytical solutions for coupled models ⠼ | 5 | Analytical solutions for coupled models ✔ | 5 | Analytical solutions for coupled models [2.9 s]
+ ⠏ | 0 | Calculation of Akaike weights ✔ | 5 | Calculation of Akaike weights
+ ⠏ | 0 | Confidence intervals and p-values ⠙ | 2 | Confidence intervals and p-values ⠏ | 10 | Confidence intervals and p-values ✔ | 10 | Confidence intervals and p-values [0.9 s]
+ ⠏ | 0 | 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 ⠙ | 12 | Error model fitting ⠸ | 13 1 | Error model fitting ⠸ | 13 1 | Error model fitting ⠸ | 13 1 | Error model fitting ⠸ | 13 1 | Error model fitting ⠸ | 14 | Error model fitting ✔ | 14 | Error model fitting [3.7 s]
+ ⠏ | 0 | 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 ✔ | 4 | Test fitting the decline of metabolites from their maximum [0.2 s]
+ ⠏ | 0 | Fitting the logistic model ⠋ | 1 | Fitting the logistic model ✔ | 1 | Fitting the logistic model [0.2 s]
+ ⠏ | 0 | Test dataset class mkinds used in gmkin ✔ | 1 | Test dataset class mkinds used in gmkin
+ ⠏ | 0 | 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 [0.6 s]
+ ⠏ | 0 | mkinmod model generation and printing ⠧ | 8 | mkinmod model generation and printing ✔ | 8 | 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 [1.4 s]
+ ⠏ | 0 | Nonlinear mixed-effects models ⠋ | 1 | Nonlinear mixed-effects models ⠙ | 2 | Nonlinear mixed-effects models ⠸ | 4 | Nonlinear mixed-effects models ⠼ | 5 | Nonlinear mixed-effects models ⠴ | 6 | Nonlinear mixed-effects models ⠧ | 8 | Nonlinear mixed-effects models ⠇ | 9 | Nonlinear mixed-effects models ✔ | 9 | Nonlinear mixed-effects models [7.0 s]
+ ⠏ | 0 | Plotting ⠋ | 1 | Plotting ⠸ | 4 | Plotting ⠦ | 7 | Plotting ⠇ | 9 | Plotting ⠙ | 12 | Plotting ✔ | 14 | Plotting [1.3 s]
+ ⠏ | 0 | Residuals extracted from mkinfit models ✔ | 4 | Residuals extracted from mkinfit models
+ ⠏ | 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 [1.3 s]
+ ⠏ | 0 | Summary ✔ | 4 | Summary
+ ⠏ | 0 | Summaries of old mkinfit objects ✔ | 1 | Summaries of old mkinfit objects
+ ⠏ | 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) [2.0 s]
+ ⠏ | 0 | Hypothesis tests ⠼ | 5 | Hypothesis tests ⠴ | 6 | Hypothesis tests ⠧ | 8 | Hypothesis tests ⠇ | 9 | Hypothesis tests ✔ | 9 | Hypothesis tests [7.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]
+
+══ Results ═════════════════════════════════════════════════════════════════════
+Duration: 35.7 s
+
+OK: 161
+Failed: 0
+Warnings: 0
+Skipped: 0
diff --git a/tests/testthat/DFOP_FOCUS_C_messages.txt b/tests/testthat/DFOP_FOCUS_C_messages.txt
index 6aa73e01..b5a83146 100644
--- a/tests/testthat/DFOP_FOCUS_C_messages.txt
+++ b/tests/testthat/DFOP_FOCUS_C_messages.txt
@@ -3,146 +3,146 @@ parent_0 log_k1 log_k2 g_ilr
Sum of squared residuals at call 1: 7391.39
85.10000 -2.30259 -4.60517 0.00000
85.10000 -2.30259 -4.60517 0.00000
-Sum of squared residuals at call 3: 7391.389
+Sum of squared residuals at call 3: 7391.39
85.10000 -2.30259 -4.60517 0.00000
-Sum of squared residuals at call 4: 7391.389
+Sum of squared residuals at call 4: 7391.39
8.51000e+01 -2.30259e+00 -4.60517e+00 1.49012e-08
85.063710 -1.773280 -4.250366 0.769827
-Sum of squared residuals at call 6: 2000.127
+Sum of squared residuals at call 6: 2000.13
85.063752 -1.773280 -4.250366 0.769827
85.063710 -1.773322 -4.250366 0.769827
85.063710 -1.773280 -4.250408 0.769827
85.063710 -1.773280 -4.250366 0.769785
85.035419 -0.960852 -4.115460 1.336361
-Sum of squared residuals at call 11: 32.97798
+Sum of squared residuals at call 11: 32.978
85.035421 -0.960852 -4.115460 1.336361
85.035419 -0.960853 -4.115460 1.336361
85.035419 -0.960852 -4.115460 1.336361
85.035419 -0.960852 -4.115460 1.336361
85.037040 -0.256064 -4.273512 0.644775
85.032855 -0.782283 -4.127513 1.312494
-Sum of squared residuals at call 17: 5.348133
+Sum of squared residuals at call 17: 5.34813
85.032856 -0.782283 -4.127513 1.312494
-Sum of squared residuals at call 18: 5.348132
+Sum of squared residuals at call 18: 5.34813
85.032855 -0.782283 -4.127513 1.312494
-Sum of squared residuals at call 19: 5.348131
+Sum of squared residuals at call 19: 5.34813
85.032855 -0.782283 -4.127513 1.312494
85.032855 -0.782283 -4.127513 1.312494
-Sum of squared residuals at call 21: 5.348131
+Sum of squared residuals at call 21: 5.34813
85.02325 -0.74968 -4.05900 1.14891
85.031268 -0.790907 -4.114802 1.268157
-Sum of squared residuals at call 23: 4.704445
+Sum of squared residuals at call 23: 4.70444
85.031266 -0.790907 -4.114802 1.268157
-Sum of squared residuals at call 24: 4.704444
+Sum of squared residuals at call 24: 4.70444
85.031268 -0.790907 -4.114802 1.268157
85.031268 -0.790907 -4.114800 1.268157
-Sum of squared residuals at call 26: 4.704433
+Sum of squared residuals at call 26: 4.70443
85.031268 -0.790907 -4.114802 1.268158
85.030010 -0.780151 -4.069435 1.262797
-Sum of squared residuals at call 28: 4.421625
+Sum of squared residuals at call 28: 4.42162
85.030012 -0.780151 -4.069435 1.262797
85.030010 -0.780151 -4.069435 1.262797
-Sum of squared residuals at call 30: 4.421624
+Sum of squared residuals at call 30: 4.42162
85.030010 -0.780151 -4.069435 1.262797
85.030010 -0.780151 -4.069435 1.262797
85.028777 -0.790084 -4.023945 1.256918
85.029639 -0.785735 -4.054587 1.260236
-Sum of squared residuals at call 34: 4.414346
+Sum of squared residuals at call 34: 4.41435
85.029641 -0.785735 -4.054587 1.260236
85.029639 -0.785735 -4.054587 1.260236
-Sum of squared residuals at call 36: 4.414346
+Sum of squared residuals at call 36: 4.41435
85.029639 -0.785735 -4.054588 1.260236
85.029639 -0.785735 -4.054587 1.260236
85.028119 -0.777813 -4.042219 1.253890
-Sum of squared residuals at call 39: 4.372463
+Sum of squared residuals at call 39: 4.37246
85.028121 -0.777813 -4.042219 1.253890
85.028119 -0.777813 -4.042219 1.253890
-Sum of squared residuals at call 41: 4.372462
+Sum of squared residuals at call 41: 4.37246
85.028119 -0.777813 -4.042219 1.253890
85.028119 -0.777813 -4.042219 1.253890
85.024185 -0.776514 -4.029420 1.245094
85.026297 -0.777842 -4.036021 1.249634
-Sum of squared residuals at call 45: 4.369313
+Sum of squared residuals at call 45: 4.36931
85.026298 -0.777842 -4.036021 1.249634
85.026297 -0.777842 -4.036021 1.249634
-Sum of squared residuals at call 47: 4.369313
+Sum of squared residuals at call 47: 4.36931
85.026297 -0.777842 -4.036022 1.249634
85.026297 -0.777842 -4.036021 1.249634
-Sum of squared residuals at call 49: 4.369313
+Sum of squared residuals at call 49: 4.36931
85.022674 -0.778681 -4.029670 1.252015
-Sum of squared residuals at call 50: 4.365062
+Sum of squared residuals at call 50: 4.36506
85.022676 -0.778681 -4.029670 1.252015
85.022674 -0.778681 -4.029670 1.252015
85.022674 -0.778681 -4.029670 1.252015
-Sum of squared residuals at call 53: 4.365062
+Sum of squared residuals at call 53: 4.36506
85.022674 -0.778681 -4.029670 1.252015
85.016327 -0.776316 -4.027611 1.248897
-Sum of squared residuals at call 55: 4.364078
+Sum of squared residuals at call 55: 4.36408
85.016328 -0.776316 -4.027611 1.248897
-Sum of squared residuals at call 56: 4.364078
+Sum of squared residuals at call 56: 4.36408
85.016327 -0.776316 -4.027611 1.248897
-Sum of squared residuals at call 57: 4.364077
+Sum of squared residuals at call 57: 4.36408
85.016327 -0.776316 -4.027611 1.248897
85.016327 -0.776316 -4.027611 1.248897
85.008939 -0.777792 -4.026307 1.247720
-Sum of squared residuals at call 60: 4.364052
+Sum of squared residuals at call 60: 4.36405
85.008938 -0.777792 -4.026307 1.247720
-Sum of squared residuals at call 61: 4.364052
+Sum of squared residuals at call 61: 4.36405
85.008939 -0.777792 -4.026307 1.247720
-Sum of squared residuals at call 62: 4.364052
+Sum of squared residuals at call 62: 4.36405
85.008939 -0.777792 -4.026307 1.247720
85.008939 -0.777792 -4.026307 1.247720
-Sum of squared residuals at call 64: 4.364052
+Sum of squared residuals at call 64: 4.36405
85.005185 -0.777308 -4.026004 1.248453
-Sum of squared residuals at call 65: 4.362751
+Sum of squared residuals at call 65: 4.36275
85.005186 -0.777308 -4.026004 1.248453
85.005185 -0.777308 -4.026004 1.248453
-Sum of squared residuals at call 67: 4.362751
+Sum of squared residuals at call 67: 4.36275
85.005185 -0.777308 -4.026005 1.248453
85.005185 -0.777308 -4.026004 1.248453
85.001344 -0.777605 -4.025878 1.248775
-Sum of squared residuals at call 70: 4.362721
+Sum of squared residuals at call 70: 4.36272
85.001345 -0.777605 -4.025878 1.248775
-Sum of squared residuals at call 71: 4.362721
+Sum of squared residuals at call 71: 4.36272
85.001344 -0.777605 -4.025878 1.248775
-Sum of squared residuals at call 72: 4.362721
+Sum of squared residuals at call 72: 4.36272
85.001344 -0.777605 -4.025878 1.248775
85.001344 -0.777605 -4.025878 1.248775
85.003200 -0.777473 -4.025700 1.248643
-Sum of squared residuals at call 75: 4.362715
+Sum of squared residuals at call 75: 4.36271
85.003201 -0.777473 -4.025700 1.248643
85.003200 -0.777473 -4.025700 1.248643
-Sum of squared residuals at call 77: 4.362715
+Sum of squared residuals at call 77: 4.36271
85.003200 -0.777473 -4.025700 1.248643
85.003200 -0.777473 -4.025700 1.248643
85.003200 -0.777473 -4.025700 1.248643
85.003200 -0.777473 -4.025700 1.248643
85.002495 -0.777491 -4.025911 1.248679
-Sum of squared residuals at call 82: 4.362715
+Sum of squared residuals at call 82: 4.36271
85.002496 -0.777491 -4.025911 1.248679
-Sum of squared residuals at call 83: 4.362715
+Sum of squared residuals at call 83: 4.36271
85.002494 -0.777491 -4.025911 1.248679
85.00249 -0.77749 -4.02591 1.24868
85.002495 -0.777491 -4.025911 1.248679
-Sum of squared residuals at call 86: 4.362715
+Sum of squared residuals at call 86: 4.36271
85.002495 -0.777491 -4.025911 1.248679
85.002495 -0.777491 -4.025911 1.248679
85.002495 -0.777491 -4.025911 1.248679
85.002495 -0.777491 -4.025911 1.248679
85.002737 -0.777492 -4.025821 1.248672
-Sum of squared residuals at call 91: 4.362714
+Sum of squared residuals at call 91: 4.36271
85.002739 -0.777492 -4.025821 1.248672
85.002736 -0.777492 -4.025821 1.248672
-Sum of squared residuals at call 93: 4.362714
+Sum of squared residuals at call 93: 4.36271
85.002737 -0.777492 -4.025821 1.248672
-Sum of squared residuals at call 94: 4.362714
+Sum of squared residuals at call 94: 4.36271
85.002737 -0.777492 -4.025821 1.248672
85.002737 -0.777492 -4.025821 1.248672
85.002737 -0.777492 -4.025821 1.248672
85.002737 -0.777492 -4.025821 1.248672
85.002737 -0.777492 -4.025821 1.248672
85.002731 -0.777491 -4.025817 1.248670
-Sum of squared residuals at call 100: 4.362714
+Sum of squared residuals at call 100: 4.36271
85.002752 -0.777491 -4.025817 1.248670
85.002710 -0.777491 -4.025817 1.248670
85.00273 -0.77749 -4.02582 1.24867
@@ -152,7 +152,7 @@ Sum of squared residuals at call 100: 4.362714
85.002731 -0.777491 -4.025817 1.248671
85.002731 -0.777491 -4.025817 1.248669
85.002737 -0.777491 -4.025819 1.248671
-Sum of squared residuals at call 109: 4.362714
+Sum of squared residuals at call 109: 4.36271
85.002758 -0.777491 -4.025819 1.248671
85.002716 -0.777491 -4.025819 1.248671
85.00274 -0.77749 -4.02582 1.24867

Contact - Imprint