From 380a29e81f88cd80c9c6915200ddc7054c8a085a Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 24 Apr 2019 21:03:43 +0200 Subject: Improve output and update tests Remove skipped tests as I do not intend to reactivate them --- tests/testthat/DFOP_FOCUS_C_messages.txt | 90 ++++++++++++++--------------- tests/testthat/FOCUS_2006_D.csf | 2 +- tests/testthat/summary_DFOP_FOCUS_C.txt | 6 +- tests/testthat/test_FOCUS_D_UBA_expertise.R | 19 ------ tests/testthat/test_logistic.R | 10 ---- 5 files changed, 49 insertions(+), 78 deletions(-) (limited to 'tests') diff --git a/tests/testthat/DFOP_FOCUS_C_messages.txt b/tests/testthat/DFOP_FOCUS_C_messages.txt index 5327b3f6..9abde683 100644 --- a/tests/testthat/DFOP_FOCUS_C_messages.txt +++ b/tests/testthat/DFOP_FOCUS_C_messages.txt @@ -1,148 +1,148 @@ parent_0 log_k1 log_k2 g_ilr sigma 85.1 -2.302585 -4.60517 0 -Negative log-likelihood at call 1: 7391.39 +Sum of squared residuals at call 1: 7391.39 85.1 -2.302585 -4.60517 0 85.1 -2.302585 -4.60517 0 -Negative log-likelihood at call 3: 7391.389 +Sum of squared residuals at call 3: 7391.389 85.1 -2.302585 -4.60517 0 -Negative log-likelihood at call 4: 7391.389 +Sum of squared residuals at call 4: 7391.389 85.1 -2.302585 -4.60517 1.490116e-08 85.06371 -1.77328 -4.250366 0.7698268 -Negative log-likelihood at call 6: 2000.127 +Sum of squared residuals at call 6: 2000.127 85.06375 -1.77328 -4.250366 0.7698268 85.06371 -1.773322 -4.250366 0.7698268 85.06371 -1.77328 -4.250408 0.7698268 85.06371 -1.77328 -4.250366 0.7697847 85.03542 -0.9608523 -4.11546 1.336361 -Negative log-likelihood at call 11: 32.97798 +Sum of squared residuals at call 11: 32.97798 85.03542 -0.9608523 -4.11546 1.336361 85.03542 -0.9608526 -4.11546 1.336361 85.03542 -0.9608523 -4.11546 1.336361 85.03542 -0.9608523 -4.11546 1.336361 85.03704 -0.256064 -4.273512 0.6447755 85.03285 -0.7822828 -4.127513 1.312494 -Negative log-likelihood at call 17: 5.348133 +Sum of squared residuals at call 17: 5.348133 85.03286 -0.7822828 -4.127513 1.312494 -Negative log-likelihood at call 18: 5.348132 +Sum of squared residuals at call 18: 5.348132 85.03285 -0.7822828 -4.127513 1.312494 -Negative log-likelihood at call 19: 5.348131 +Sum of squared residuals at call 19: 5.348131 85.03285 -0.7822828 -4.127513 1.312494 85.03285 -0.7822828 -4.127513 1.312494 -Negative log-likelihood at call 21: 5.348131 +Sum of squared residuals at call 21: 5.348131 85.02325 -0.74968 -4.059 1.14891 85.03127 -0.7909068 -4.114802 1.268157 -Negative log-likelihood at call 23: 4.704445 +Sum of squared residuals at call 23: 4.704445 85.03127 -0.7909068 -4.114802 1.268157 -Negative log-likelihood at call 24: 4.704444 +Sum of squared residuals at call 24: 4.704444 85.03127 -0.7909068 -4.114802 1.268157 85.03127 -0.7909068 -4.1148 1.268157 -Negative log-likelihood at call 26: 4.704433 +Sum of squared residuals at call 26: 4.704433 85.03127 -0.7909068 -4.114802 1.268158 85.03001 -0.7801506 -4.069435 1.262797 -Negative log-likelihood at call 28: 4.421625 +Sum of squared residuals at call 28: 4.421625 85.03001 -0.7801506 -4.069435 1.262797 85.03001 -0.7801507 -4.069435 1.262797 -Negative log-likelihood at call 30: 4.421624 +Sum of squared residuals at call 30: 4.421624 85.03001 -0.7801506 -4.069435 1.262797 85.03001 -0.7801506 -4.069435 1.262797 85.02878 -0.7900844 -4.023945 1.256918 85.02964 -0.7857352 -4.054587 1.260236 -Negative log-likelihood at call 34: 4.414346 +Sum of squared residuals at call 34: 4.414346 85.02964 -0.7857352 -4.054587 1.260236 85.02964 -0.7857351 -4.054587 1.260236 -Negative log-likelihood at call 36: 4.414346 +Sum of squared residuals at call 36: 4.414346 85.02964 -0.7857352 -4.054588 1.260236 85.02964 -0.7857352 -4.054587 1.260236 85.02812 -0.7778128 -4.042219 1.25389 -Negative log-likelihood at call 39: 4.372463 +Sum of squared residuals at call 39: 4.372463 85.02812 -0.7778128 -4.042219 1.25389 85.02812 -0.7778129 -4.042219 1.25389 -Negative log-likelihood at call 41: 4.372462 +Sum of squared residuals at call 41: 4.372462 85.02812 -0.7778128 -4.042219 1.25389 85.02812 -0.7778128 -4.042219 1.25389 85.02419 -0.7765144 -4.02942 1.245094 85.0263 -0.7778419 -4.036021 1.249634 -Negative log-likelihood at call 45: 4.369313 +Sum of squared residuals at call 45: 4.369313 85.0263 -0.7778419 -4.036021 1.249634 85.0263 -0.7778418 -4.036021 1.249634 -Negative log-likelihood at call 47: 4.369313 +Sum of squared residuals at call 47: 4.369313 85.0263 -0.7778419 -4.036022 1.249634 85.0263 -0.7778419 -4.036021 1.249634 -Negative log-likelihood at call 49: 4.369313 +Sum of squared residuals at call 49: 4.369313 85.02267 -0.7786811 -4.02967 1.252015 -Negative log-likelihood at call 50: 4.365062 +Sum of squared residuals at call 50: 4.365062 85.02268 -0.7786811 -4.02967 1.252015 85.02267 -0.7786812 -4.02967 1.252015 85.02267 -0.7786811 -4.02967 1.252015 -Negative log-likelihood at call 53: 4.365062 +Sum of squared residuals at call 53: 4.365062 85.02267 -0.7786811 -4.02967 1.252015 85.01633 -0.7763163 -4.027611 1.248897 -Negative log-likelihood at call 55: 4.364078 +Sum of squared residuals at call 55: 4.364078 85.01633 -0.7763163 -4.027611 1.248897 -Negative log-likelihood at call 56: 4.364078 +Sum of squared residuals at call 56: 4.364078 85.01633 -0.7763164 -4.027611 1.248897 -Negative log-likelihood at call 57: 4.364077 +Sum of squared residuals at call 57: 4.364077 85.01633 -0.7763163 -4.027611 1.248897 85.01633 -0.7763163 -4.027611 1.248897 85.00894 -0.7777917 -4.026307 1.24772 -Negative log-likelihood at call 60: 4.364052 +Sum of squared residuals at call 60: 4.364052 85.00894 -0.7777917 -4.026307 1.24772 -Negative log-likelihood at call 61: 4.364052 +Sum of squared residuals at call 61: 4.364052 85.00894 -0.7777917 -4.026307 1.24772 -Negative log-likelihood at call 62: 4.364052 +Sum of squared residuals at call 62: 4.364052 85.00894 -0.7777917 -4.026307 1.24772 85.00894 -0.7777917 -4.026307 1.24772 -Negative log-likelihood at call 64: 4.364052 +Sum of squared residuals at call 64: 4.364052 85.00518 -0.7773082 -4.026004 1.248453 -Negative log-likelihood at call 65: 4.362751 +Sum of squared residuals at call 65: 4.362751 85.00519 -0.7773082 -4.026004 1.248453 85.00518 -0.7773083 -4.026004 1.248453 -Negative log-likelihood at call 67: 4.362751 +Sum of squared residuals at call 67: 4.362751 85.00518 -0.7773082 -4.026005 1.248453 85.00518 -0.7773082 -4.026004 1.248453 85.00134 -0.7776046 -4.025878 1.248775 -Negative log-likelihood at call 70: 4.362721 +Sum of squared residuals at call 70: 4.362721 85.00135 -0.7776046 -4.025878 1.248775 -Negative log-likelihood at call 71: 4.362721 +Sum of squared residuals at call 71: 4.362721 85.00134 -0.7776046 -4.025878 1.248775 -Negative log-likelihood at call 72: 4.362721 +Sum of squared residuals at call 72: 4.362721 85.00134 -0.7776046 -4.025878 1.248775 85.00134 -0.7776046 -4.025878 1.248775 85.0032 -0.7774734 -4.0257 1.248643 -Negative log-likelihood at call 75: 4.362715 +Sum of squared residuals at call 75: 4.362715 85.0032 -0.7774734 -4.0257 1.248643 85.0032 -0.7774734 -4.0257 1.248643 -Negative log-likelihood at call 77: 4.362715 +Sum of squared residuals at call 77: 4.362715 85.0032 -0.7774735 -4.0257 1.248643 85.0032 -0.7774734 -4.0257 1.248643 85.0032 -0.7774734 -4.0257 1.248643 85.0032 -0.7774734 -4.0257 1.248643 85.00249 -0.7774909 -4.025911 1.248679 -Negative log-likelihood at call 82: 4.362715 +Sum of squared residuals at call 82: 4.362715 85.0025 -0.7774909 -4.025911 1.248679 -Negative log-likelihood at call 83: 4.362715 +Sum of squared residuals at call 83: 4.362715 85.00249 -0.7774909 -4.025911 1.248679 85.00249 -0.7774905 -4.025911 1.248679 85.00249 -0.7774914 -4.025911 1.248679 -Negative log-likelihood at call 86: 4.362715 +Sum of squared residuals at call 86: 4.362715 85.00249 -0.7774909 -4.025911 1.248679 85.00249 -0.7774909 -4.025911 1.248679 85.00249 -0.7774909 -4.025911 1.248679 85.00249 -0.7774909 -4.025911 1.248679 85.00274 -0.7774922 -4.025821 1.248672 -Negative log-likelihood at call 91: 4.362714 +Sum of squared residuals at call 91: 4.362714 85.00274 -0.7774922 -4.025821 1.248672 85.00274 -0.7774922 -4.025821 1.248672 -Negative log-likelihood at call 93: 4.362714 +Sum of squared residuals at call 93: 4.362714 85.00274 -0.7774921 -4.025821 1.248672 -Negative log-likelihood at call 94: 4.362714 +Sum of squared residuals at call 94: 4.362714 85.00274 -0.7774922 -4.025821 1.248672 85.00274 -0.7774922 -4.025821 1.248672 85.00274 -0.7774922 -4.025821 1.248672 85.00274 -0.7774922 -4.025821 1.248672 85.00274 -0.7774922 -4.025821 1.248672 85.00273 -0.7774912 -4.025817 1.24867 -Negative log-likelihood at call 100: 4.362714 +Sum of squared residuals at call 100: 4.362714 85.00275 -0.7774912 -4.025817 1.24867 85.00271 -0.7774912 -4.025817 1.24867 85.00273 -0.7774905 -4.025817 1.24867 @@ -152,7 +152,7 @@ Negative log-likelihood at call 100: 4.362714 85.00273 -0.7774912 -4.025817 1.248671 85.00273 -0.7774912 -4.025817 1.248669 85.00274 -0.7774913 -4.025819 1.248671 -Negative log-likelihood at call 109: 4.362714 +Sum of squared residuals at call 109: 4.362714 85.00276 -0.7774913 -4.025819 1.248671 85.00272 -0.7774913 -4.025819 1.248671 85.00274 -0.7774904 -4.025819 1.248671 diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf index 84500b54..9e912a28 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: 2019-04-10 +Date: 2019-04-24 Optimiser: IRLS [Data] diff --git a/tests/testthat/summary_DFOP_FOCUS_C.txt b/tests/testthat/summary_DFOP_FOCUS_C.txt index 1d669d43..b0a6bb6d 100644 --- a/tests/testthat/summary_DFOP_FOCUS_C.txt +++ b/tests/testthat/summary_DFOP_FOCUS_C.txt @@ -10,10 +10,10 @@ d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * Model predictions using solution type analytical -Fitted with method using test 0 model solutions performed in test time 0 s +Fitted using test 0 model solutions performed in test time 0 s Error model: -NULL +Constant variance Starting values for parameters to be optimised: value type @@ -61,7 +61,7 @@ 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 -Chi2 error levels in percent: +FOCUS Chi2 error levels in percent: err.min n.optim df All data 2.661 4 5 parent 2.661 4 5 diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R index 3a49078c..a282f5e7 100644 --- a/tests/testthat/test_FOCUS_D_UBA_expertise.R +++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R @@ -74,22 +74,3 @@ test_that("Fits without internal transformations are correct for FOCUS D", { # References: # Ranke (2014) Prüfung und Validierung von Modellierungssoftware als Alternative # zu ModelMaker 4.0, Umweltbundesamt Projektnummer 27452 - -test_that("The t-value for fits using internal transformations corresponds with results from FME, synthetic data", { - skip_on_cran() - m_synth_DFOP_par.minff <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), - M1 = mkinsub("SFO"), - M2 = mkinsub("SFO"), - use_of_ff = "min", quiet = TRUE) - - fit_DFOP_par_c_2 <- mkinfit(m_synth_DFOP_par.minff, - synthetic_data_for_UBA_2014[[12]]$data, - quiet = TRUE) - - skip("Hessian matrices and df calculations differ from those in FME") - # Note that the k1 and k2 are exchanged in the untransformed fit evaluated with FME for this test - expect_equal(signif(summary(fit_DFOP_par_c_2)$bpar[1:7, "t value"], 5), - c(parent_0 = 80.054, k_M1_sink = 12.291, k_M2_sink = 10.588, - f_parent_to_M1 = 21.4960, f_parent_to_M2 = 24.0890, - k1 = 16.1450, k2 = 8.1747)) -}) diff --git a/tests/testthat/test_logistic.R b/tests/testthat/test_logistic.R index 9f50f32e..5a89fbf5 100644 --- a/tests/testthat/test_logistic.R +++ b/tests/testthat/test_logistic.R @@ -34,13 +34,3 @@ test_that("The logistic model fit is reproducible", { dtx <- endpoints(m)$distimes["parent", ] expect_equivalent(dtx, c(36.865, 62.415, 4297.854, 10.833), tolerance = 0.001) }) - -test_that("The logistic fit can be done via differential equation", { - # This is slow as we did not implement conversion to C - # because it is unlikely we will use the logistic model with metabolites - skip("Skip slow fit of logistic model using deSolve without compilation") - m_2 <- mkinfit("logistic", d_2_1[[1]], solution_type = "deSolve", - quiet = TRUE) - dtx_2 <- endpoints(m_2)$distimes["parent", ] - expect_equivalent(dtx_2, c(36.865, 62.415, 4297.854, 10.833), tolerance = 0.001) -}) -- cgit v1.2.1