From b5b446b718b15ccaae5b197e147fc1358f0f564e Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 6 Nov 2020 00:03:29 +0100 Subject: Fast analytical solutions for saemix, update.mmkin Also, use logit transformation for g and for solitary formation fractions, addressing #10. --- tests/testthat/DFOP_FOCUS_C_messages.txt | 349 ++++++++++++++------------ tests/testthat/FOCUS_2006_D.csf | 2 +- tests/testthat/summary_DFOP_FOCUS_C.txt | 4 +- tests/testthat/test_schaefer07_complex_case.R | 4 +- 4 files changed, 197 insertions(+), 162 deletions(-) (limited to 'tests') diff --git a/tests/testthat/DFOP_FOCUS_C_messages.txt b/tests/testthat/DFOP_FOCUS_C_messages.txt index b5a83146..88e9ad5c 100644 --- a/tests/testthat/DFOP_FOCUS_C_messages.txt +++ b/tests/testthat/DFOP_FOCUS_C_messages.txt @@ -1,4 +1,4 @@ -parent_0 log_k1 log_k2 g_ilr +parent_0 log_k1 log_k2 g_qlogis 85.10000 -2.30259 -4.60517 0.00000 Sum of squared residuals at call 1: 7391.39 85.10000 -2.30259 -4.60517 0.00000 @@ -7,159 +7,194 @@ 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.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.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.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.34813 - 85.032856 -0.782283 -4.127513 1.312494 -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.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.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.70444 - 85.031266 -0.790907 -4.114802 1.268157 -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.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.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.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.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.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.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.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.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.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.36931 - 85.022674 -0.778681 -4.029670 1.252015 -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.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.36408 - 85.016328 -0.776316 -4.027611 1.248897 -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.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.36405 - 85.008938 -0.777792 -4.026307 1.247720 -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.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.36405 - 85.005185 -0.777308 -4.026004 1.248453 -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.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.36272 - 85.001345 -0.777605 -4.025878 1.248775 -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.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.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.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.36271 - 85.002496 -0.777491 -4.025911 1.248679 -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.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.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.36271 - 85.002737 -0.777492 -4.025821 1.248672 -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.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 - 85.002731 -0.777492 -4.025817 1.248670 - 85.002731 -0.777491 -4.025814 1.248670 - 85.002731 -0.777491 -4.025821 1.248670 - 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.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 - 85.002737 -0.777492 -4.025819 1.248671 - 85.002737 -0.777491 -4.025815 1.248671 - 85.002737 -0.777491 -4.025822 1.248671 - 85.002737 -0.777491 -4.025819 1.248672 - 85.002737 -0.777491 -4.025819 1.248669 - 85.002737 -0.777491 -4.025819 1.248671 - 85.002737 -0.777491 -4.025819 1.248671 0.696237 + 85.056739 -1.671603 -4.182209 0.648917 +Sum of squared residuals at call 6: 2451.52 + 84.991262 -0.716611 -3.542058 1.631054 +Sum of squared residuals at call 7: 13.7829 + 84.991267 -0.716611 -3.542058 1.631054 +Sum of squared residuals at call 8: 13.7829 + 84.991262 -0.716614 -3.542058 1.631054 +Sum of squared residuals at call 9: 13.7826 + 84.991262 -0.716611 -3.542062 1.631054 + 84.991262 -0.716611 -3.542058 1.631050 + 84.71288 -2.59069 -3.32179 3.26796 + 84.965536 -0.926698 -3.537257 1.766536 + 84.992033 -0.743768 -3.556304 1.612681 +Sum of squared residuals at call 14: 11.2376 + 84.992032 -0.743768 -3.556304 1.612681 + 84.992033 -0.743768 -3.556304 1.612681 + 84.992033 -0.743768 -3.556304 1.612681 + 84.992033 -0.743768 -3.556304 1.612681 + 84.992597 -0.750733 -3.585098 1.592663 +Sum of squared residuals at call 19: 10.0865 + 84.992595 -0.750733 -3.585098 1.592663 +Sum of squared residuals at call 20: 10.0865 + 84.992597 -0.750733 -3.585098 1.592663 +Sum of squared residuals at call 21: 10.0865 + 84.992597 -0.750733 -3.585097 1.592663 + 84.992597 -0.750733 -3.585098 1.592664 + 84.992421 -0.703782 -3.638466 1.584800 +Sum of squared residuals at call 24: 9.53394 + 84.992423 -0.703782 -3.638466 1.584800 +Sum of squared residuals at call 25: 9.53394 + 84.992421 -0.703782 -3.638466 1.584800 +Sum of squared residuals at call 26: 9.53394 + 84.992421 -0.703782 -3.638465 1.584800 + 84.992421 -0.703782 -3.638466 1.584800 + 84.994457 -0.747193 -3.694957 1.590668 +Sum of squared residuals at call 29: 7.68535 + 84.994455 -0.747193 -3.694957 1.590668 +Sum of squared residuals at call 30: 7.68535 + 84.994457 -0.747193 -3.694957 1.590668 +Sum of squared residuals at call 31: 7.68535 + 84.994457 -0.747193 -3.694956 1.590668 + 84.994457 -0.747193 -3.694957 1.590668 +Sum of squared residuals at call 33: 7.68534 + 84.99561 -0.74145 -3.74977 1.63623 +Sum of squared residuals at call 34: 6.54485 + 84.99561 -0.74145 -3.74977 1.63623 +Sum of squared residuals at call 35: 6.54485 + 84.99561 -0.74145 -3.74977 1.63623 + 84.99561 -0.74145 -3.74977 1.63623 + 84.99561 -0.74145 -3.74977 1.63623 + 84.999195 -0.781375 -3.871798 1.699156 +Sum of squared residuals at call 39: 5.4816 + 84.999193 -0.781375 -3.871798 1.699156 +Sum of squared residuals at call 40: 5.4816 + 84.999195 -0.781375 -3.871798 1.699156 +Sum of squared residuals at call 41: 5.48159 + 84.999195 -0.781375 -3.871798 1.699156 + 84.999195 -0.781375 -3.871798 1.699157 + 85.000245 -0.729263 -3.998464 1.657965 + 84.999165 -0.745628 -3.914855 1.691551 +Sum of squared residuals at call 45: 4.96084 + 84.999167 -0.745628 -3.914855 1.691551 +Sum of squared residuals at call 46: 4.96084 + 84.999165 -0.745628 -3.914855 1.691551 +Sum of squared residuals at call 47: 4.96084 + 84.999165 -0.745628 -3.914854 1.691551 + 84.999165 -0.745628 -3.914855 1.691551 + 85.000818 -0.765542 -3.951557 1.729540 +Sum of squared residuals at call 50: 4.5314 + 85.000816 -0.765542 -3.951557 1.729540 + 85.000818 -0.765542 -3.951557 1.729540 + 85.000818 -0.765542 -3.951557 1.729540 + 85.000818 -0.765542 -3.951557 1.729540 + 85.002931 -0.771499 -4.054666 1.683855 + 85.001154 -0.773816 -3.960228 1.725768 + 85.000960 -0.769949 -3.954277 1.728373 +Sum of squared residuals at call 57: 4.51486 + 85.000959 -0.769949 -3.954277 1.728373 +Sum of squared residuals at call 58: 4.51486 + 85.000960 -0.769949 -3.954277 1.728373 +Sum of squared residuals at call 59: 4.51486 + 85.000960 -0.769949 -3.954277 1.728373 + 85.000960 -0.769949 -3.954277 1.728373 +Sum of squared residuals at call 61: 4.51485 + 85.001004 -0.767037 -3.958449 1.729895 +Sum of squared residuals at call 62: 4.49757 + 85.001005 -0.767037 -3.958449 1.729895 +Sum of squared residuals at call 63: 4.49757 + 85.001004 -0.767037 -3.958449 1.729895 + 85.001004 -0.767037 -3.958448 1.729895 + 85.001004 -0.767037 -3.958449 1.729895 + 85.001424 -0.769932 -3.968566 1.731267 +Sum of squared residuals at call 67: 4.46771 + 85.001423 -0.769932 -3.968566 1.731267 +Sum of squared residuals at call 68: 4.46771 + 85.001424 -0.769932 -3.968566 1.731267 +Sum of squared residuals at call 69: 4.46771 + 85.001424 -0.769932 -3.968565 1.731267 + 85.001424 -0.769932 -3.968566 1.731267 + 85.002318 -0.774584 -3.980034 1.748508 +Sum of squared residuals at call 72: 4.42694 + 85.002319 -0.774584 -3.980034 1.748508 +Sum of squared residuals at call 73: 4.42694 + 85.002318 -0.774584 -3.980034 1.748508 + 85.002318 -0.774584 -3.980034 1.748508 + 85.002318 -0.774584 -3.980034 1.748508 +Sum of squared residuals at call 76: 4.42694 + 85.002323 -0.762339 -3.996975 1.744734 + 85.00232 -0.77126 -3.98463 1.74748 +Sum of squared residuals at call 78: 4.41527 + 85.00232 -0.77126 -3.98463 1.74748 +Sum of squared residuals at call 79: 4.41527 + 85.00232 -0.77126 -3.98463 1.74748 + 85.00232 -0.77126 -3.98463 1.74748 +Sum of squared residuals at call 81: 4.41527 + 85.00232 -0.77126 -3.98463 1.74748 + 85.00232 -0.77126 -3.98463 1.74748 + 85.002462 -0.773523 -3.989759 1.748837 +Sum of squared residuals at call 84: 4.39987 + 85.002461 -0.773523 -3.989759 1.748837 + 85.002462 -0.773523 -3.989759 1.748837 +Sum of squared residuals at call 86: 4.39987 + 85.002462 -0.773523 -3.989759 1.748837 + 85.002462 -0.773523 -3.989759 1.748837 + 85.00261 -0.77140 -4.00108 1.74936 +Sum of squared residuals at call 89: 4.38752 + 85.00261 -0.77140 -4.00108 1.74936 + 85.00261 -0.77140 -4.00108 1.74936 +Sum of squared residuals at call 91: 4.38752 + 85.00261 -0.77140 -4.00108 1.74936 + 85.00261 -0.77140 -4.00108 1.74936 + 85.002849 -0.775911 -4.019460 1.762547 +Sum of squared residuals at call 94: 4.36452 + 85.002848 -0.775911 -4.019460 1.762547 + 85.002849 -0.775911 -4.019460 1.762547 + 85.002849 -0.775911 -4.019460 1.762547 + 85.002849 -0.775911 -4.019460 1.762547 +Sum of squared residuals at call 98: 4.36452 + 85.002513 -0.777516 -4.025854 1.765855 +Sum of squared residuals at call 99: 4.36272 + 85.002512 -0.777516 -4.025854 1.765855 +Sum of squared residuals at call 100: 4.36272 + 85.002513 -0.777516 -4.025854 1.765855 +Sum of squared residuals at call 101: 4.36272 + 85.002513 -0.777516 -4.025854 1.765855 + 85.002513 -0.777516 -4.025854 1.765855 +Sum of squared residuals at call 103: 4.36272 + 85.002996 -0.777486 -4.025817 1.765889 +Sum of squared residuals at call 104: 4.36271 + 85.002997 -0.777486 -4.025817 1.765889 + 85.002995 -0.777486 -4.025817 1.765889 +Sum of squared residuals at call 106: 4.36271 + 85.002996 -0.777486 -4.025817 1.765889 + 85.002996 -0.777486 -4.025817 1.765889 + 85.002996 -0.777486 -4.025817 1.765889 + 85.002517 -0.777495 -4.025820 1.765890 +Sum of squared residuals at call 110: 4.36271 + 85.002519 -0.777495 -4.025820 1.765890 +Sum of squared residuals at call 111: 4.36271 + 85.002516 -0.777495 -4.025820 1.765890 + 85.002517 -0.777494 -4.025820 1.765890 + 85.002517 -0.777495 -4.025820 1.765890 +Sum of squared residuals at call 114: 4.36271 + 85.002517 -0.777495 -4.025818 1.765890 + 85.002517 -0.777495 -4.025823 1.765890 + 85.002517 -0.777495 -4.025820 1.765891 + 85.002517 -0.777495 -4.025820 1.765890 + 85.002736 -0.777491 -4.025819 1.765887 +Sum of squared residuals at call 119: 4.36271 + 85.002737 -0.777491 -4.025819 1.765887 + 85.002734 -0.777491 -4.025819 1.765887 +Sum of squared residuals at call 121: 4.36271 + 85.002736 -0.777491 -4.025819 1.765887 + 85.002736 -0.777492 -4.025819 1.765887 + 85.002736 -0.777491 -4.025818 1.765887 + 85.002736 -0.777491 -4.025820 1.765887 + 85.002736 -0.777491 -4.025819 1.765887 +Sum of squared residuals at call 126: 4.36271 + 85.002736 -0.777491 -4.025819 1.765886 + 85.002736 -0.777491 -4.025819 1.765887 +Sum of squared residuals at call 128: 4.36271 + 85.002759 -0.777491 -4.025819 1.765887 + 85.002713 -0.777491 -4.025819 1.765887 + 85.002736 -0.777491 -4.025819 1.765887 + 85.002736 -0.777492 -4.025819 1.765887 + 85.002736 -0.777491 -4.025815 1.765887 + 85.002736 -0.777491 -4.025822 1.765887 + 85.002736 -0.777491 -4.025819 1.765889 + 85.002736 -0.777491 -4.025819 1.765885 + 85.002736 -0.777491 -4.025819 1.765887 + 85.002736 -0.777491 -4.025819 1.765887 0.696237 diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf index c7cb6d41..8da4cd91 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-11-04 +Date: 2020-11-05 Optimiser: IRLS [Data] diff --git a/tests/testthat/summary_DFOP_FOCUS_C.txt b/tests/testthat/summary_DFOP_FOCUS_C.txt index b9ba7c17..2b0210c0 100644 --- a/tests/testthat/summary_DFOP_FOCUS_C.txt +++ b/tests/testthat/summary_DFOP_FOCUS_C.txt @@ -28,7 +28,7 @@ Starting values for the transformed parameters actually optimised: parent_0 85.100000 -Inf Inf log_k1 -2.302585 -Inf Inf log_k2 -4.605170 -Inf Inf -g_ilr 0.000000 -Inf Inf +g_qlogis 0.000000 -Inf Inf Fixed parameter values: None @@ -43,7 +43,7 @@ Optimised, transformed parameters with symmetric confidence intervals: 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 +g_qlogis 1.7660 0.08218 1.5380 1.9940 sigma 0.6962 0.16410 0.2406 1.1520 Parameter correlation: diff --git a/tests/testthat/test_schaefer07_complex_case.R b/tests/testthat/test_schaefer07_complex_case.R index 703298d5..60f5d600 100644 --- a/tests/testthat/test_schaefer07_complex_case.R +++ b/tests/testthat/test_schaefer07_complex_case.R @@ -1,8 +1,8 @@ context("Complex test case from Schaefer et al. (2007) Piacenza paper") test_that("Complex test case from Schaefer (2007) can be reproduced (10% tolerance)", { - - skip_on_cran() + + skip_on_cran() schaefer07_complex_model <- mkinmod( parent = list(type = "SFO", to = c("A1", "B1", "C1"), sink = FALSE), A1 = list(type = "SFO", to = "A2"), -- cgit v1.2.1