diff options
Diffstat (limited to 'tests/testthat')
-rw-r--r-- | tests/testthat/DFOP_FOCUS_C_messages.txt | 444 | ||||
-rw-r--r-- | tests/testthat/FOCUS_2006_D.csf | 2 | ||||
-rw-r--r-- | tests/testthat/NAFTA_SOP_Appendix_B.txt | 21 | ||||
-rw-r--r-- | tests/testthat/NAFTA_SOP_Appendix_D.txt | 25 | ||||
-rw-r--r-- | tests/testthat/summary_DFOP_FOCUS_C.txt | 48 | ||||
-rw-r--r-- | tests/testthat/test_FOCUS_D_UBA_expertise.R | 7 | ||||
-rw-r--r-- | tests/testthat/test_FOCUS_chi2_error_level.R | 3 | ||||
-rw-r--r-- | tests/testthat/test_error_models.R | 17 | ||||
-rw-r--r-- | tests/testthat/test_from_max_mean.R | 12 | ||||
-rw-r--r-- | tests/testthat/test_mkinfit_errors.R | 24 | ||||
-rw-r--r-- | tests/testthat/test_nafta.R | 4 | ||||
-rw-r--r-- | tests/testthat/test_plots_summary_twa.R | 4 | ||||
-rw-r--r-- | tests/testthat/test_schaefer07_complex_case.R | 9 |
13 files changed, 381 insertions, 239 deletions
diff --git a/tests/testthat/DFOP_FOCUS_C_messages.txt b/tests/testthat/DFOP_FOCUS_C_messages.txt index 7abde0b6..5327b3f6 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 +parent_0 log_k1 log_k2 g_ilr sigma 85.1 -2.302585 -4.60517 0 -Model cost at call 1 : 7391.39 +Negative log-likelihood at call 1: 7391.39 85.1 -2.302585 -4.60517 0 85.1 -2.302585 -4.60517 0 -Model cost at call 3 : 7391.389 +Negative log-likelihood at call 3: 7391.389 85.1 -2.302585 -4.60517 0 -Model cost at call 4 : 7391.389 +Negative log-likelihood at call 4: 7391.389 85.1 -2.302585 -4.60517 1.490116e-08 85.06371 -1.77328 -4.250366 0.7698268 -Model cost at call 6 : 2000.127 +Negative log-likelihood 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 -Model cost at call 11 : 32.97798 +Negative log-likelihood 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 -Model cost at call 17 : 5.348133 +Negative log-likelihood at call 17: 5.348133 85.03286 -0.7822828 -4.127513 1.312494 -Model cost at call 18 : 5.348132 +Negative log-likelihood at call 18: 5.348132 85.03285 -0.7822828 -4.127513 1.312494 -Model cost at call 19 : 5.348131 +Negative log-likelihood at call 19: 5.348131 85.03285 -0.7822828 -4.127513 1.312494 85.03285 -0.7822828 -4.127513 1.312494 -Model cost at call 21 : 5.348131 +Negative log-likelihood at call 21: 5.348131 85.02325 -0.74968 -4.059 1.14891 85.03127 -0.7909068 -4.114802 1.268157 -Model cost at call 23 : 4.704445 +Negative log-likelihood at call 23: 4.704445 85.03127 -0.7909068 -4.114802 1.268157 -Model cost at call 24 : 4.704444 +Negative log-likelihood at call 24: 4.704444 85.03127 -0.7909068 -4.114802 1.268157 85.03127 -0.7909068 -4.1148 1.268157 -Model cost at call 26 : 4.704433 +Negative log-likelihood at call 26: 4.704433 85.03127 -0.7909068 -4.114802 1.268158 85.03001 -0.7801506 -4.069435 1.262797 -Model cost at call 28 : 4.421625 +Negative log-likelihood at call 28: 4.421625 85.03001 -0.7801506 -4.069435 1.262797 85.03001 -0.7801507 -4.069435 1.262797 -Model cost at call 30 : 4.421624 +Negative log-likelihood 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 -Model cost at call 34 : 4.414346 +Negative log-likelihood at call 34: 4.414346 85.02964 -0.7857352 -4.054587 1.260236 85.02964 -0.7857351 -4.054587 1.260236 -Model cost at call 36 : 4.414346 +Negative log-likelihood 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 -Model cost at call 39 : 4.372463 +Negative log-likelihood at call 39: 4.372463 85.02812 -0.7778128 -4.042219 1.25389 85.02812 -0.7778129 -4.042219 1.25389 -Model cost at call 41 : 4.372462 +Negative log-likelihood 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 -Model cost at call 45 : 4.369313 +Negative log-likelihood at call 45: 4.369313 85.0263 -0.7778419 -4.036021 1.249634 85.0263 -0.7778418 -4.036021 1.249634 -Model cost at call 47 : 4.369313 +Negative log-likelihood at call 47: 4.369313 85.0263 -0.7778419 -4.036022 1.249634 85.0263 -0.7778419 -4.036021 1.249634 -Model cost at call 49 : 4.369313 +Negative log-likelihood at call 49: 4.369313 85.02267 -0.7786811 -4.02967 1.252015 -Model cost at call 50 : 4.365062 +Negative log-likelihood 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 -Model cost at call 53 : 4.365062 +Negative log-likelihood at call 53: 4.365062 85.02267 -0.7786811 -4.02967 1.252015 85.01633 -0.7763163 -4.027611 1.248897 -Model cost at call 55 : 4.364078 +Negative log-likelihood at call 55: 4.364078 85.01633 -0.7763163 -4.027611 1.248897 -Model cost at call 56 : 4.364078 +Negative log-likelihood at call 56: 4.364078 85.01633 -0.7763164 -4.027611 1.248897 -Model cost at call 57 : 4.364077 +Negative log-likelihood 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 -Model cost at call 60 : 4.364052 +Negative log-likelihood at call 60: 4.364052 85.00894 -0.7777917 -4.026307 1.24772 -Model cost at call 61 : 4.364052 +Negative log-likelihood at call 61: 4.364052 85.00894 -0.7777917 -4.026307 1.24772 -Model cost at call 62 : 4.364052 +Negative log-likelihood at call 62: 4.364052 85.00894 -0.7777917 -4.026307 1.24772 85.00894 -0.7777917 -4.026307 1.24772 -Model cost at call 64 : 4.364052 +Negative log-likelihood at call 64: 4.364052 85.00518 -0.7773082 -4.026004 1.248453 -Model cost at call 65 : 4.362751 +Negative log-likelihood at call 65: 4.362751 85.00519 -0.7773082 -4.026004 1.248453 85.00518 -0.7773083 -4.026004 1.248453 -Model cost at call 67 : 4.362751 +Negative log-likelihood 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 -Model cost at call 70 : 4.362721 +Negative log-likelihood at call 70: 4.362721 85.00135 -0.7776046 -4.025878 1.248775 -Model cost at call 71 : 4.362721 +Negative log-likelihood at call 71: 4.362721 85.00134 -0.7776046 -4.025878 1.248775 -Model cost at call 72 : 4.362721 +Negative log-likelihood 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 -Model cost at call 75 : 4.362715 +Negative log-likelihood at call 75: 4.362715 85.0032 -0.7774734 -4.0257 1.248643 85.0032 -0.7774734 -4.0257 1.248643 -Model cost at call 77 : 4.362715 +Negative log-likelihood 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 -Model cost at call 82 : 4.362715 +Negative log-likelihood at call 82: 4.362715 85.0025 -0.7774909 -4.025911 1.248679 -Model cost at call 83 : 4.362715 +Negative log-likelihood 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 -Model cost at call 86 : 4.362715 +Negative log-likelihood 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 -Model cost at call 91 : 4.362714 +Negative log-likelihood at call 91: 4.362714 85.00274 -0.7774922 -4.025821 1.248672 85.00274 -0.7774922 -4.025821 1.248672 -Model cost at call 93 : 4.362714 +Negative log-likelihood at call 93: 4.362714 85.00274 -0.7774921 -4.025821 1.248672 -Model cost at call 94 : 4.362714 +Negative log-likelihood 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 -Model cost at call 100 : 4.362714 +Negative log-likelihood 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 @@ Model cost 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 -Model cost at call 109 : 4.362714 +Negative log-likelihood 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 @@ -162,109 +162,249 @@ Model cost at call 109 : 4.362714 85.00274 -0.7774913 -4.025819 1.248672 85.00274 -0.7774913 -4.025819 1.248669 85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -Model cost at call 123 : 4.362714 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -IRLS based on variance estimates according to the two component error model -Initial variance components are: -sigma_low rsd_high - 1.08984 0.00000 -85.00274 -0.7774913 -4.025819 1.248671 -Model cost at call 129 : 3.673061 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -Model cost at call 132 : 3.673061 -85.00274 -0.7774913 -4.025819 1.248671 -85.00273 -0.7775309 -4.025818 1.24866 -85.00274 -0.7774953 -4.025819 1.24867 -85.00274 -0.7774917 -4.025819 1.248671 -85.00274 -0.7774914 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -Model cost at call 138 : 3.673061 -85.00277 -0.7774913 -4.025819 1.248671 -85.0027 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774744 -4.025819 1.248671 -85.00274 -0.7775083 -4.025819 1.248671 -85.00274 -0.7774913 -4.025779 1.248671 -85.00274 -0.7774913 -4.025858 1.248671 -85.00274 -0.7774913 -4.025819 1.248702 -85.00274 -0.7774913 -4.025819 1.248639 -85.00274 -0.7774913 -4.025819 1.248671 -Model cost at call 147 : 3.673061 -85.00276 -0.7774913 -4.025819 1.248671 -85.00271 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774906 -4.025819 1.248671 -85.00274 -0.7774921 -4.025819 1.248671 -85.00274 -0.7774913 -4.025812 1.248671 -85.00274 -0.7774913 -4.025825 1.248671 -85.00274 -0.7774913 -4.025819 1.248672 -85.00274 -0.7774913 -4.025819 1.248669 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -Model cost at call 159 : 3.673061 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -Iteration 1 yields variance estimates: -sigma_low rsd_high -0.7434091 0.0000000 -Sum of squared differences to last variance (component) estimates: 0.12 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00273 -0.7775366 -4.025821 1.248652 -85.00274 -0.7774959 -4.025819 1.248669 -85.00274 -0.7774918 -4.025819 1.24867 -85.00274 -0.7774914 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00279 -0.7774913 -4.025819 1.248671 -85.00268 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774621 -4.025819 1.248671 -85.00274 -0.7775206 -4.025819 1.248671 -85.00274 -0.7774913 -4.025761 1.248671 -85.00274 -0.7774913 -4.025876 1.248671 -85.00274 -0.7774913 -4.025819 1.248714 -85.00274 -0.7774913 -4.025819 1.248627 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00273 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774908 -4.025819 1.248671 -85.00274 -0.7774919 -4.025819 1.248671 -85.00274 -0.7774913 -4.025816 1.248671 -85.00274 -0.7774913 -4.025822 1.248671 -85.00274 -0.7774913 -4.025819 1.248672 -85.00274 -0.7774913 -4.025819 1.24867 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -85.00274 -0.7774913 -4.025819 1.248671 -Iteration 2 yields variance estimates: -sigma_low rsd_high -0.7434091 0.0000000 -Sum of squared differences to last variance (component) estimates: 2.9e-16 -Optimisation by method Port successfully terminated. +85.00274 -0.7774913 -4.025819 1.248671 0.696237 +85.00274 -0.7774913 -4.025819 1.248671 0.696237 +85.00274 -0.7774913 -4.025819 1.248671 0.696237 +93.50301 -0.7774913 -4.025819 1.248671 0.696237 +76.50246 -0.7774913 -4.025819 1.248671 0.696237 +89.25287 -0.7774913 -4.025819 1.248671 0.696237 +80.7526 -0.7774913 -4.025819 1.248671 0.696237 +87.12781 -0.7774913 -4.025819 1.248671 0.696237 +82.87767 -0.7774913 -4.025819 1.248671 0.696237 +86.06527 -0.7774913 -4.025819 1.248671 0.696237 +83.9402 -0.7774913 -4.025819 1.248671 0.696237 +85.00274 -0.6997422 -4.025819 1.248671 0.696237 +85.00274 -0.8552405 -4.025819 1.248671 0.696237 +85.00274 -0.7386168 -4.025819 1.248671 0.696237 +85.00274 -0.8163659 -4.025819 1.248671 0.696237 +85.00274 -0.758054 -4.025819 1.248671 0.696237 +85.00274 -0.7969286 -4.025819 1.248671 0.696237 +85.00274 -0.7677727 -4.025819 1.248671 0.696237 +85.00274 -0.78721 -4.025819 1.248671 0.696237 +85.00274 -0.7774913 -3.623237 1.248671 0.696237 +85.00274 -0.7774913 -4.428401 1.248671 0.696237 +85.00274 -0.7774913 -3.824528 1.248671 0.696237 +85.00274 -0.7774913 -4.22711 1.248671 0.696237 +85.00274 -0.7774913 -3.925173 1.248671 0.696237 +85.00274 -0.7774913 -4.126464 1.248671 0.696237 +85.00274 -0.7774913 -3.975496 1.248671 0.696237 +85.00274 -0.7774913 -4.076142 1.248671 0.696237 +85.00274 -0.7774913 -4.025819 1.373538 0.696237 +85.00274 -0.7774913 -4.025819 1.123804 0.696237 +85.00274 -0.7774913 -4.025819 1.311104 0.696237 +85.00274 -0.7774913 -4.025819 1.186237 0.696237 +85.00274 -0.7774913 -4.025819 1.279887 0.696237 +85.00274 -0.7774913 -4.025819 1.217454 0.696237 +85.00274 -0.7774913 -4.025819 1.264279 0.696237 +85.00274 -0.7774913 -4.025819 1.233062 0.696237 +85.00274 -0.7774913 -4.025819 1.248671 0.7658608 +85.00274 -0.7774913 -4.025819 1.248671 0.6266133 +85.00274 -0.7774913 -4.025819 1.248671 0.7310489 +85.00274 -0.7774913 -4.025819 1.248671 0.6614252 +85.00274 -0.7774913 -4.025819 1.248671 0.713643 +85.00274 -0.7774913 -4.025819 1.248671 0.6788311 +85.00274 -0.7774913 -4.025819 1.248671 0.70494 +85.00274 -0.7774913 -4.025819 1.248671 0.6875341 +93.50301 -0.6997422 -4.025819 1.248671 0.696237 +76.50246 -0.8552405 -4.025819 1.248671 0.696237 +89.25287 -0.7386168 -4.025819 1.248671 0.696237 +80.7526 -0.8163659 -4.025819 1.248671 0.696237 +87.12781 -0.758054 -4.025819 1.248671 0.696237 +82.87767 -0.7969286 -4.025819 1.248671 0.696237 +86.06527 -0.7677727 -4.025819 1.248671 0.696237 +83.9402 -0.78721 -4.025819 1.248671 0.696237 +93.50301 -0.7774913 -3.623237 1.248671 0.696237 +76.50246 -0.7774913 -4.428401 1.248671 0.696237 +89.25287 -0.7774913 -3.824528 1.248671 0.696237 +80.7526 -0.7774913 -4.22711 1.248671 0.696237 +87.12781 -0.7774913 -3.925173 1.248671 0.696237 +82.87767 -0.7774913 -4.126464 1.248671 0.696237 +86.06527 -0.7774913 -3.975496 1.248671 0.696237 +83.9402 -0.7774913 -4.076142 1.248671 0.696237 +85.00274 -0.6997422 -3.623237 1.248671 0.696237 +85.00274 -0.8552405 -4.428401 1.248671 0.696237 +85.00274 -0.7386168 -3.824528 1.248671 0.696237 +85.00274 -0.8163659 -4.22711 1.248671 0.696237 +85.00274 -0.758054 -3.925173 1.248671 0.696237 +85.00274 -0.7969286 -4.126464 1.248671 0.696237 +85.00274 -0.7677727 -3.975496 1.248671 0.696237 +85.00274 -0.78721 -4.076142 1.248671 0.696237 +93.50301 -0.7774913 -4.025819 1.373538 0.696237 +76.50246 -0.7774913 -4.025819 1.123804 0.696237 +89.25287 -0.7774913 -4.025819 1.311104 0.696237 +80.7526 -0.7774913 -4.025819 1.186237 0.696237 +87.12781 -0.7774913 -4.025819 1.279887 0.696237 +82.87767 -0.7774913 -4.025819 1.217454 0.696237 +86.06527 -0.7774913 -4.025819 1.264279 0.696237 +83.9402 -0.7774913 -4.025819 1.233062 0.696237 +85.00274 -0.6997422 -4.025819 1.373538 0.696237 +85.00274 -0.8552405 -4.025819 1.123804 0.696237 +85.00274 -0.7386168 -4.025819 1.311104 0.696237 +85.00274 -0.8163659 -4.025819 1.186237 0.696237 +85.00274 -0.758054 -4.025819 1.279887 0.696237 +85.00274 -0.7969286 -4.025819 1.217454 0.696237 +85.00274 -0.7677727 -4.025819 1.264279 0.696237 +85.00274 -0.78721 -4.025819 1.233062 0.696237 +85.00274 -0.7774913 -3.623237 1.373538 0.696237 +85.00274 -0.7774913 -4.428401 1.123804 0.696237 +85.00274 -0.7774913 -3.824528 1.311104 0.696237 +85.00274 -0.7774913 -4.22711 1.186237 0.696237 +85.00274 -0.7774913 -3.925173 1.279887 0.696237 +85.00274 -0.7774913 -4.126464 1.217454 0.696237 +85.00274 -0.7774913 -3.975496 1.264279 0.696237 +85.00274 -0.7774913 -4.076142 1.233062 0.696237 +93.50301 -0.7774913 -4.025819 1.248671 0.7658608 +76.50246 -0.7774913 -4.025819 1.248671 0.6266133 +89.25287 -0.7774913 -4.025819 1.248671 0.7310489 +80.7526 -0.7774913 -4.025819 1.248671 0.6614252 +87.12781 -0.7774913 -4.025819 1.248671 0.713643 +82.87767 -0.7774913 -4.025819 1.248671 0.6788311 +86.06527 -0.7774913 -4.025819 1.248671 0.70494 +83.9402 -0.7774913 -4.025819 1.248671 0.6875341 +85.00274 -0.6997422 -4.025819 1.248671 0.7658608 +85.00274 -0.8552405 -4.025819 1.248671 0.6266133 +85.00274 -0.7386168 -4.025819 1.248671 0.7310489 +85.00274 -0.8163659 -4.025819 1.248671 0.6614252 +85.00274 -0.758054 -4.025819 1.248671 0.713643 +85.00274 -0.7969286 -4.025819 1.248671 0.6788311 +85.00274 -0.7677727 -4.025819 1.248671 0.70494 +85.00274 -0.78721 -4.025819 1.248671 0.6875341 +85.00274 -0.7774913 -3.623237 1.248671 0.7658608 +85.00274 -0.7774913 -4.428401 1.248671 0.6266133 +85.00274 -0.7774913 -3.824528 1.248671 0.7310489 +85.00274 -0.7774913 -4.22711 1.248671 0.6614252 +85.00274 -0.7774913 -3.925173 1.248671 0.713643 +85.00274 -0.7774913 -4.126464 1.248671 0.6788311 +85.00274 -0.7774913 -3.975496 1.248671 0.70494 +85.00274 -0.7774913 -4.076142 1.248671 0.6875341 +85.00274 -0.7774913 -4.025819 1.373538 0.7658608 +85.00274 -0.7774913 -4.025819 1.123804 0.6266133 +85.00274 -0.7774913 -4.025819 1.311104 0.7310489 +85.00274 -0.7774913 -4.025819 1.186237 0.6614252 +85.00274 -0.7774913 -4.025819 1.279887 0.713643 +85.00274 -0.7774913 -4.025819 1.217454 0.6788311 +85.00274 -0.7774913 -4.025819 1.264279 0.70494 +85.00274 -0.7774913 -4.025819 1.233062 0.6875341 +85.00274 0.4595574 0.0178488 0.8539454 0.696237 +85.00274 0.4595574 0.0178488 0.8539454 0.696237 +93.50301 0.4595574 0.0178488 0.8539454 0.696237 +76.50246 0.4595574 0.0178488 0.8539454 0.696237 +89.25287 0.4595574 0.0178488 0.8539454 0.696237 +80.7526 0.4595574 0.0178488 0.8539454 0.696237 +87.12781 0.4595574 0.0178488 0.8539454 0.696237 +82.87767 0.4595574 0.0178488 0.8539454 0.696237 +86.06527 0.4595574 0.0178488 0.8539454 0.696237 +83.9402 0.4595574 0.0178488 0.8539454 0.696237 +85.00274 0.5055132 0.0178488 0.8539454 0.696237 +85.00274 0.4136017 0.0178488 0.8539454 0.696237 +85.00274 0.4825353 0.0178488 0.8539454 0.696237 +85.00274 0.4365796 0.0178488 0.8539454 0.696237 +85.00274 0.4710464 0.0178488 0.8539454 0.696237 +85.00274 0.4480685 0.0178488 0.8539454 0.696237 +85.00274 0.4653019 0.0178488 0.8539454 0.696237 +85.00274 0.453813 0.0178488 0.8539454 0.696237 +85.00274 0.4595574 0.01963368 0.8539454 0.696237 +85.00274 0.4595574 0.01606392 0.8539454 0.696237 +85.00274 0.4595574 0.01874124 0.8539454 0.696237 +85.00274 0.4595574 0.01695636 0.8539454 0.696237 +85.00274 0.4595574 0.01829502 0.8539454 0.696237 +85.00274 0.4595574 0.01740258 0.8539454 0.696237 +85.00274 0.4595574 0.01807191 0.8539454 0.696237 +85.00274 0.4595574 0.01762569 0.8539454 0.696237 +85.00274 0.4595574 0.0178488 0.93934 0.696237 +85.00274 0.4595574 0.0178488 0.7685509 0.696237 +85.00274 0.4595574 0.0178488 0.8966427 0.696237 +85.00274 0.4595574 0.0178488 0.8112482 0.696237 +85.00274 0.4595574 0.0178488 0.8752941 0.696237 +85.00274 0.4595574 0.0178488 0.8325968 0.696237 +85.00274 0.4595574 0.0178488 0.8646197 0.696237 +85.00274 0.4595574 0.0178488 0.8432711 0.696237 +85.00274 0.4595574 0.0178488 0.8539454 0.7658608 +85.00274 0.4595574 0.0178488 0.8539454 0.6266133 +85.00274 0.4595574 0.0178488 0.8539454 0.7310489 +85.00274 0.4595574 0.0178488 0.8539454 0.6614252 +85.00274 0.4595574 0.0178488 0.8539454 0.713643 +85.00274 0.4595574 0.0178488 0.8539454 0.6788311 +85.00274 0.4595574 0.0178488 0.8539454 0.70494 +85.00274 0.4595574 0.0178488 0.8539454 0.6875341 +93.50301 0.5055132 0.0178488 0.8539454 0.696237 +76.50246 0.4136017 0.0178488 0.8539454 0.696237 +89.25287 0.4825353 0.0178488 0.8539454 0.696237 +80.7526 0.4365796 0.0178488 0.8539454 0.696237 +87.12781 0.4710464 0.0178488 0.8539454 0.696237 +82.87767 0.4480685 0.0178488 0.8539454 0.696237 +86.06527 0.4653019 0.0178488 0.8539454 0.696237 +83.9402 0.453813 0.0178488 0.8539454 0.696237 +93.50301 0.4595574 0.01963368 0.8539454 0.696237 +76.50246 0.4595574 0.01606392 0.8539454 0.696237 +89.25287 0.4595574 0.01874124 0.8539454 0.696237 +80.7526 0.4595574 0.01695636 0.8539454 0.696237 +87.12781 0.4595574 0.01829502 0.8539454 0.696237 +82.87767 0.4595574 0.01740258 0.8539454 0.696237 +86.06527 0.4595574 0.01807191 0.8539454 0.696237 +83.9402 0.4595574 0.01762569 0.8539454 0.696237 +85.00274 0.5055132 0.01963368 0.8539454 0.696237 +85.00274 0.4136017 0.01606392 0.8539454 0.696237 +85.00274 0.4825353 0.01874124 0.8539454 0.696237 +85.00274 0.4365796 0.01695636 0.8539454 0.696237 +85.00274 0.4710464 0.01829502 0.8539454 0.696237 +85.00274 0.4480685 0.01740258 0.8539454 0.696237 +85.00274 0.4653019 0.01807191 0.8539454 0.696237 +85.00274 0.453813 0.01762569 0.8539454 0.696237 +93.50301 0.4595574 0.0178488 0.93934 0.696237 +76.50246 0.4595574 0.0178488 0.7685509 0.696237 +89.25287 0.4595574 0.0178488 0.8966427 0.696237 +80.7526 0.4595574 0.0178488 0.8112482 0.696237 +87.12781 0.4595574 0.0178488 0.8752941 0.696237 +82.87767 0.4595574 0.0178488 0.8325968 0.696237 +86.06527 0.4595574 0.0178488 0.8646197 0.696237 +83.9402 0.4595574 0.0178488 0.8432711 0.696237 +85.00274 0.5055132 0.0178488 0.93934 0.696237 +85.00274 0.4136017 0.0178488 0.7685509 0.696237 +85.00274 0.4825353 0.0178488 0.8966427 0.696237 +85.00274 0.4365796 0.0178488 0.8112482 0.696237 +85.00274 0.4710464 0.0178488 0.8752941 0.696237 +85.00274 0.4480685 0.0178488 0.8325968 0.696237 +85.00274 0.4653019 0.0178488 0.8646197 0.696237 +85.00274 0.453813 0.0178488 0.8432711 0.696237 +85.00274 0.4595574 0.01963368 0.93934 0.696237 +85.00274 0.4595574 0.01606392 0.7685509 0.696237 +85.00274 0.4595574 0.01874124 0.8966427 0.696237 +85.00274 0.4595574 0.01695636 0.8112482 0.696237 +85.00274 0.4595574 0.01829502 0.8752941 0.696237 +85.00274 0.4595574 0.01740258 0.8325968 0.696237 +85.00274 0.4595574 0.01807191 0.8646197 0.696237 +85.00274 0.4595574 0.01762569 0.8432711 0.696237 +93.50301 0.4595574 0.0178488 0.8539454 0.7658608 +76.50246 0.4595574 0.0178488 0.8539454 0.6266133 +89.25287 0.4595574 0.0178488 0.8539454 0.7310489 +80.7526 0.4595574 0.0178488 0.8539454 0.6614252 +87.12781 0.4595574 0.0178488 0.8539454 0.713643 +82.87767 0.4595574 0.0178488 0.8539454 0.6788311 +86.06527 0.4595574 0.0178488 0.8539454 0.70494 +83.9402 0.4595574 0.0178488 0.8539454 0.6875341 +85.00274 0.5055132 0.0178488 0.8539454 0.7658608 +85.00274 0.4136017 0.0178488 0.8539454 0.6266133 +85.00274 0.4825353 0.0178488 0.8539454 0.7310489 +85.00274 0.4365796 0.0178488 0.8539454 0.6614252 +85.00274 0.4710464 0.0178488 0.8539454 0.713643 +85.00274 0.4480685 0.0178488 0.8539454 0.6788311 +85.00274 0.4653019 0.0178488 0.8539454 0.70494 +85.00274 0.453813 0.0178488 0.8539454 0.6875341 +85.00274 0.4595574 0.01963368 0.8539454 0.7658608 +85.00274 0.4595574 0.01606392 0.8539454 0.6266133 +85.00274 0.4595574 0.01874124 0.8539454 0.7310489 +85.00274 0.4595574 0.01695636 0.8539454 0.6614252 +85.00274 0.4595574 0.01829502 0.8539454 0.713643 +85.00274 0.4595574 0.01740258 0.8539454 0.6788311 +85.00274 0.4595574 0.01807191 0.8539454 0.70494 +85.00274 0.4595574 0.01762569 0.8539454 0.6875341 +85.00274 0.4595574 0.0178488 0.93934 0.7658608 +85.00274 0.4595574 0.0178488 0.7685509 0.6266133 +85.00274 0.4595574 0.0178488 0.8966427 0.7310489 +85.00274 0.4595574 0.0178488 0.8112482 0.6614252 +85.00274 0.4595574 0.0178488 0.8752941 0.713643 +85.00274 0.4595574 0.0178488 0.8325968 0.6788311 +85.00274 0.4595574 0.0178488 0.8646197 0.70494 +85.00274 0.4595574 0.0178488 0.8432711 0.6875341 +Optimisation successfully terminated. diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf index c14aab4d..84500b54 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-03-04 +Date: 2019-04-10 Optimiser: IRLS [Data] diff --git a/tests/testthat/NAFTA_SOP_Appendix_B.txt b/tests/testthat/NAFTA_SOP_Appendix_B.txt index 26a340c5..9c072d58 100644 --- a/tests/testthat/NAFTA_SOP_Appendix_B.txt +++ b/tests/testthat/NAFTA_SOP_Appendix_B.txt @@ -8,21 +8,24 @@ Critical sum of squares for checking the SFO model: Parameters: $SFO Estimate Pr(>t) Lower Upper -parent_0 51.243 1.18e-10 45.404 57.082 -k_parent_sink 0.253 1.61e-06 0.194 0.331 +parent_0 51.243 2.12e-10 45.724 56.762 +k_parent_sink 0.253 2.95e-06 0.193 0.332 +sigma 3.529 1.28e-04 2.061 4.997 $IORE Estimate Pr(>t) Lower Upper -parent_0 51.71053 8.52e-15 4.95e+01 53.90735 -k__iore_parent_sink 0.00135 6.84e-02 3.42e-04 0.00531 -N_parent 2.66147 3.98e-08 2.19e+00 3.13193 +parent_0 51.71053 2.60e-14 4.97e+01 53.68122 +k__iore_parent_sink 0.00135 5.21e-02 3.88e-04 0.00469 +N_parent 2.66147 3.67e-08 2.23e+00 3.08855 +sigma 1.25124 1.76e-04 7.24e-01 1.77811 $DFOP Estimate Pr(>t) Lower Upper -parent_0 51.7055 3.46e-14 49.67793 53.7330 -k1 0.4157 1.00e-06 0.33077 0.5224 -k2 0.0127 1.39e-03 0.00723 0.0224 -g 0.8338 5.72e-12 0.77182 0.8815 +parent_0 51.7055 8.99e-14 49.96593 53.4450 +k1 0.4157 5.65e-07 0.34129 0.5063 +k2 0.0127 7.78e-04 0.00768 0.0211 +g 0.8338 1.09e-11 0.78030 0.8763 +sigma 1.0880 2.50e-04 0.62286 1.5531 DTx values: diff --git a/tests/testthat/NAFTA_SOP_Appendix_D.txt b/tests/testthat/NAFTA_SOP_Appendix_D.txt index 1e846a16..ad650a5f 100644 --- a/tests/testthat/NAFTA_SOP_Appendix_D.txt +++ b/tests/testthat/NAFTA_SOP_Appendix_D.txt @@ -7,22 +7,25 @@ Critical sum of squares for checking the SFO model: Parameters: $SFO - Estimate Pr(>t) Lower Upper -parent_0 83.7558 8.08e-15 76.92822 90.58328 -k_parent_sink 0.0017 7.45e-05 0.00111 0.00262 + Estimate Pr(>t) Lower Upper +parent_0 83.7558 1.80e-14 77.18268 90.3288 +k_parent_sink 0.0017 7.43e-05 0.00112 0.0026 +sigma 8.7518 1.22e-05 5.64278 11.8608 $IORE Estimate Pr(>t) Lower Upper -parent_0 9.69e+01 NA 8.75e+01 1.06e+02 -k__iore_parent_sink 8.40e-14 NA 1.09e-19 6.47e-08 -N_parent 6.68e+00 NA 3.54e+00 9.83e+00 +parent_0 9.69e+01 NA 8.88e+01 1.05e+02 +k__iore_parent_sink 8.40e-14 NA 1.79e-18 3.94e-09 +N_parent 6.68e+00 NA 4.19e+00 9.17e+00 +sigma 5.85e+00 NA 3.76e+00 7.94e+00 $DFOP Estimate Pr(>t) Lower Upper -parent_0 9.76e+01 4.44e-13 8.88e+01 1.06e+02 -k1 4.24e-02 3.55e-02 1.41e-02 1.27e-01 -k2 8.24e-04 2.06e-02 3.17e-04 2.14e-03 -g 2.88e-01 1.31e-04 1.78e-01 4.30e-01 +parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02 +k1 4.24e-02 5.92e-03 2.03e-02 8.88e-02 +k2 8.24e-04 6.48e-03 3.89e-04 1.75e-03 +g 2.88e-01 2.47e-05 1.95e-01 4.03e-01 +sigma 5.36e+00 2.22e-05 3.43e+00 7.30e+00 DTx values: @@ -32,4 +35,4 @@ IORE 541 5190000 1560000 DFOP 429 2380 841 Representative half-life: -[1] 841.4096 +[1] 841.4094 diff --git a/tests/testthat/summary_DFOP_FOCUS_C.txt b/tests/testthat/summary_DFOP_FOCUS_C.txt index 33d55ebc..1d669d43 100644 --- a/tests/testthat/summary_DFOP_FOCUS_C.txt +++ b/tests/testthat/summary_DFOP_FOCUS_C.txt @@ -10,16 +10,18 @@ d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * Model predictions using solution type analytical -Fitted with method Port using test 0 model solutions performed in test time 0 s +Fitted with method using test 0 model solutions performed in test time 0 s -Weighting: none +Error model: +NULL 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 + value type +parent_0 85.100000 state +k1 0.100000 deparm +k2 0.010000 deparm +g 0.500000 deparm +sigma 0.696237 error Starting values for the transformed parameters actually optimised: value lower upper @@ -27,35 +29,37 @@ parent_0 85.100000 -Inf Inf log_k1 -2.302585 -Inf Inf log_k2 -4.605170 -Inf Inf g_ilr 0.000000 -Inf Inf +sigma 0.696237 0 Inf Fixed parameter values: None Optimised, transformed parameters with symmetric confidence intervals: Estimate Std. Error Lower Upper -parent_0 85.0000 0.89070 82.7100 87.2900 -log_k1 -0.7775 0.04430 -0.8914 -0.6636 -log_k2 -4.0260 0.17030 -4.4640 -3.5880 -g_ilr 1.2490 0.07619 1.0530 1.4450 +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: - parent_0 log_k1 log_k2 g_ilr -parent_0 1.00000 0.4338 0.07924 -0.01897 -log_k1 0.43380 1.0000 0.46567 -0.66010 -log_k2 0.07924 0.4657 1.00000 -0.74183 -g_ilr -0.01897 -0.6601 -0.74183 1.00000 - -Residual standard error: 0.9341 on 5 degrees of freedom + parent_0 log_k1 log_k2 g_ilr sigma +parent_0 1.000e+00 4.393e-01 8.805e-02 -3.176e-02 5.405e-07 +log_k1 4.393e-01 1.000e+00 4.821e-01 -6.716e-01 4.395e-07 +log_k2 8.805e-02 4.821e-01 1.000e+00 -7.532e-01 -1.151e-07 +g_ilr -3.176e-02 -6.716e-01 -7.532e-01 1.000e+00 -2.142e-08 +sigma 5.405e-07 4.395e-07 -1.151e-07 -2.142e-08 1.000e+00 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 95.440 1.197e-09 82.71000 87.29000 -k1 0.45960 22.570 1.586e-06 0.41010 0.51500 -k2 0.01785 5.873 1.016e-03 0.01152 0.02765 -g 0.85390 63.540 9.135e-09 0.81590 0.88520 +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 Chi2 error levels in percent: err.min n.optim df diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R index 42c4fcfb..3a49078c 100644 --- a/tests/testthat/test_FOCUS_D_UBA_expertise.R +++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R @@ -27,20 +27,18 @@ SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"), test_that("Fits without formation fractions are correct for FOCUS D", { - fit.default <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) + fit.default <- expect_warning(mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE), "value of zero") expect_equal(round(as.numeric(endpoints(fit.default)$distimes["parent", ]), 2), c(7.02, 23.33)) expect_equal(round(as.numeric(endpoints(fit.default)$distimes["m1", ]), 1), c(131.8, 437.7)) - expect_equal(signif(summary(fit.default)$bpar[, "t value"], 5), - c(parent_0 = 61.720, k_parent_sink = 12.777, k_parent_m1 = 24.248, k_m1_sink = 7.3486)) }) test_that("Fits with formation fractions are correct for FOCUS D", { skip_on_cran() - fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE) + fit.ff <- expect_warning(mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE), "value of zero") expect_equivalent(round(fit.ff$bparms.optim, c(2, 4, 4, 4)), c(99.60, 0.0987, 0.0053, 0.5145)) @@ -88,6 +86,7 @@ test_that("The t-value for fits using internal transformations corresponds with 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, diff --git a/tests/testthat/test_FOCUS_chi2_error_level.R b/tests/testthat/test_FOCUS_chi2_error_level.R index 1f1e2a06..69a8c2ad 100644 --- a/tests/testthat/test_FOCUS_chi2_error_level.R +++ b/tests/testthat/test_FOCUS_chi2_error_level.R @@ -26,7 +26,8 @@ SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"), test_that("Chi2 error levels for FOCUS D are as in mkin 0.9-33", { - fit <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE) + fit <- expect_warning(mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE), + "Observations with value of zero") errmin.FOCUS_2006_D_rounded = data.frame( err.min = c(0.0640, 0.0646, 0.0469), diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R index bda8ca7f..5a7aa4e8 100644 --- a/tests/testthat/test_error_models.R +++ b/tests/testthat/test_error_models.R @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Johannes Ranke +# Copyright (C) 2018,2019 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -70,13 +70,6 @@ test_that("Error model 'tc' works", { expect_equivalent(parms_3, c(102.1, 0.7393, 0.2992, 0.0202, 0.7687, 0.7229)) }) -test_that("Error model 'obs_tc' works", { - skip_on_cran() - fit_obs_tc_1 <- expect_warning(mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "obs_tc", quiet = TRUE), "NaN") - # Here the error model is overparameterised - expect_warning(summary(fit_obs_tc_1), "singular system") -}) - test_that("Reweighting method 'tc' produces reasonable variance estimates", { # I need to make the tc method more robust against that @@ -148,7 +141,7 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", { d_met_2_15 <- add_err(d_synth_DFOP_lin, sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), - n = 15, reps = 100, digits = 5, LOD = -Inf, seed = 123456) + n = 15, reps = 100, digits = 5, LOD = 0.01, seed = 123456) # For a single fit, we get a relative error of less than 10% in the error # model components @@ -165,14 +158,14 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", { 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)] - parms_DFOP_lin_optim) / parms_DFOP_lin_optim - expect_true(all(abs(parm_errors_met_2_15_tc_e4) < 0.01)) + expect_true(all(abs(parm_errors_met_2_15_tc_e4) < 0.015)) tcf_met_2_15_tc <- apply(sapply(f_met_2_15_tc_e4, function(x) x$errparms), 1, mean, na.rm = TRUE) tcf_met_2_15_tc_error_model_errors <- (tcf_met_2_15_tc - c(0.5, 0.07)) / c(0.5, 0.07) - # Here we get a precision < 15% for retrieving the original error model components + # Here we get a precision < 10% for retrieving the original error model components # from 15 datasets - expect_true(all(abs(tcf_met_2_15_tc_error_model_errors) < 0.15)) + expect_true(all(abs(tcf_met_2_15_tc_error_model_errors) < 0.10)) }) diff --git a/tests/testthat/test_from_max_mean.R b/tests/testthat/test_from_max_mean.R index 7529c5f2..c4d6bfe4 100644 --- a/tests/testthat/test_from_max_mean.R +++ b/tests/testthat/test_from_max_mean.R @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Johannes Ranke +# Copyright (C) 2018,2019 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -21,15 +21,19 @@ context("Test fitting the decline of metabolites from their maximum") test_that("Fitting from maximum mean value works", { SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) - expect_error(mkinfit(SFO_SFO, FOCUS_2006_D, from_max_mean = TRUE)) + expect_warning( + expect_error(mkinfit(SFO_SFO, FOCUS_2006_D, from_max_mean = TRUE), + "only implemented for models with a single observed variable"), + "Observations with value of zero were removed") # We can either explicitly create a model for m1, or subset the data SFO_m1 <- mkinmod(m1 = mkinsub("SFO")) - f.1 <- mkinfit(SFO_m1, FOCUS_2006_D, from_max_mean = TRUE, quiet = TRUE) + f.1 <- expect_warning(mkinfit(SFO_m1, FOCUS_2006_D, from_max_mean = TRUE, quiet = TRUE)) expect_equivalent(endpoints(f.1)$distimes["m1", ], c(170.8, 567.5), scale = 1, tolerance = 0.1) - f.2 <- mkinfit("SFO", subset(FOCUS_2006_D, name == "m1"), from_max_mean = TRUE, quiet = TRUE) + f.2 <- expect_warning(mkinfit("SFO", subset(FOCUS_2006_D, name == "m1"), + from_max_mean = TRUE, quiet = TRUE)) expect_equivalent(endpoints(f.2)$distimes["m1", ], c(170.8, 567.5), scale = 1, tolerance = 0.1) }) diff --git a/tests/testthat/test_mkinfit_errors.R b/tests/testthat/test_mkinfit_errors.R index f1b4618c..fa029d93 100644 --- a/tests/testthat/test_mkinfit_errors.R +++ b/tests/testthat/test_mkinfit_errors.R @@ -30,6 +30,9 @@ test_that("mkinfit stops to prevent and/or explain user errors", { expect_error(mkinfit("foo", FOCUS_2006_A)) expect_error(mkinfit(3, FOCUS_2006_A)) + # We remove zero observations from FOCUS_2006_D beforehand in + # order to avoid another expect_warning in the code + FOCUS_2006_D <- subset(FOCUS_2006_D, value != 0) # We get a warning if we use transform_fractions = FALSE with formation fractions # and an error if any pathway to sink is turned off as well expect_warning( @@ -50,26 +53,16 @@ test_that("mkinfit stops to prevent and/or explain user errors", { expect_error(mkinfit(SFO_SFO.ff, FOCUS_2006_D, solution_type = "analytical"), "not implemented") expect_error(mkinfit("FOMC", FOCUS_2006_A, solution_type = "eigen"), "coefficient matrix not present") - - # We suppress a message stemming from the interrupted call to system.time() - expect_error(suppressMessages(mkinfit("SFO", FOCUS_2006_A, reweight.method = - "foo", quiet = TRUE), "implemented")) - }) test_that("mkinfit stops early when a low maximum number of iterations is specified", { - expect_warning(mkinfit("SFO", FOCUS_2006_A, maxit.modFit = 1, quiet = TRUE)) - expect_warning(mkinfit("SFO", FOCUS_2006_A, maxit.modFit = 1, quiet = TRUE, method.modFit = "Marq")) -}) - -test_that("mkinfit warns if the user chooses the SANN method", { - expect_warning(mkinfit("SFO", FOCUS_2006_A, method.modFit = "SANN", maxit.modFit = 10, quiet = TRUE)) - skip("The SANN algorithm takes very long with the default maximum number of iterations of 10000") - expect_warning(mkinfit("SFO", FOCUS_2006_A, method.modFit = "SANN")) + expect_warning(mkinfit("SFO", FOCUS_2006_A, control = list(iter.max = 1), quiet = TRUE), + "iteration limit reached without convergence") }) test_that("mkinfit warns if a specified initial parameter value is not in the model", { - expect_warning(mkinfit("SFO", FOCUS_2006_A, parms.ini = c(k_xy = 0.1), quiet = TRUE)) + expect_warning(mkinfit("SFO", FOCUS_2006_A, parms.ini = c(k_xy = 0.1), quiet = TRUE), + "not used in the model") }) test_that("We get reproducible output if quiet = FALSE", { @@ -83,5 +76,6 @@ test_that("We get reproducible output if quiet = FALSE", { test_that("We get warnings in case of overparameterisation", { skip_on_cran() # On winbuilder the following fit does not give a warning expect_warning(f <- mkinfit("FOMC", FOCUS_2006_A, quiet = TRUE), "not converge") - s2 <- expect_warning(summary(mkinfit("DFOP", FOCUS_2006_A, quiet = TRUE)), "singular system") + # We do get Hessians and the related output after the switch to using numDeriv::hessian() + #s2 <- expect_warning(summary(mkinfit("DFOP", FOCUS_2006_A, quiet = TRUE)), "singular system") }) diff --git a/tests/testthat/test_nafta.R b/tests/testthat/test_nafta.R index 9528200d..096287aa 100644 --- a/tests/testthat/test_nafta.R +++ b/tests/testthat/test_nafta.R @@ -43,8 +43,8 @@ test_that("Test data from Appendix B are correctly evaluated", { }) test_that("Test data from Appendix D are correctly evaluated", { - expect_warning(res <- nafta(NAFTA_SOP_Appendix_D, "MRID 555555", - cores = 1, quiet = TRUE)) + res <- nafta(NAFTA_SOP_Appendix_D, "MRID 555555", + cores = 1, quiet = TRUE) # From Figure D.1 dtx_sop <- matrix(c(407, 541, 429, 1352, 5192066, 2383), nrow = 3, ncol = 2) diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R index 201faa73..cf5715fa 100644 --- a/tests/testthat/test_plots_summary_twa.R +++ b/tests/testthat/test_plots_summary_twa.R @@ -79,8 +79,8 @@ test_that("Plotting mmkin objects is reproducible", { context("AIC calculation") test_that("The AIC is reproducible", { - expect_equivalent(AIC(fits[["SFO", "FOCUS_C"]]), 59.8, scale = 1, tolerance = 0.1) + expect_equivalent(AIC(fits[["SFO", "FOCUS_C"]]), 59.3, scale = 1, tolerance = 0.1) expect_equivalent(AIC(fits[, "FOCUS_C"]), - data.frame(df = c(3, 4, 5, 5), AIC = c(59.8, 44.7, 29.1, 39.3)), + data.frame(df = c(3, 4, 5, 5), AIC = c(59.3, 44.7, 29.0, 39.2)), scale = 1, tolerance = 0.1) }) diff --git a/tests/testthat/test_schaefer07_complex_case.R b/tests/testthat/test_schaefer07_complex_case.R index 844dd88f..66ebc03b 100644 --- a/tests/testthat/test_schaefer07_complex_case.R +++ b/tests/testthat/test_schaefer07_complex_case.R @@ -57,10 +57,11 @@ test_that("Complex test case from Schaefer (2007) can be reproduced (10% toleran r$mkin.deviation <- abs(round(100 * ((r$mkin - r$means)/r$means), digits=1))
expect_equal(r$mkin.deviation < 10, rep(TRUE, 14))
- # If we use optimisation algorithm 'Marq' we get a local minimum with a
- # sum of squared residuals of 273.3707
- # When using 'Marq', we need to give a good starting estimate e.g. for k_A2 in
+ # In previous versions of mkinfit, if we used optimisation algorithm 'Marq'
+ # we got a local minimum with a sum of squared residuals of 273.3707
+ # When using 'Marq', we needed to give a good starting estimate e.g. for k_A2 in
# order to get the optimum with sum of squared residuals 240.5686
- expect_equal(round(fit.default$ssr, 4), 240.5686)
+ ssr <- sum(fit.default$data$residual^2)
+ expect_equal(round(ssr, 4), 240.5686)
})
|