aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/_snaps/multistart/llhist-for-dfop-sfo-fit.svg (renamed from tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg)0
-rw-r--r--tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg30
-rw-r--r--tests/testthat/_snaps/multistart/mixed-model-fit-for-saem-object-with-mkin-transformations.svg (renamed from tests/testthat/_snaps/plot/mixed-model-fit-for-saem-object-with-mkin-transformations.svg)0
-rw-r--r--tests/testthat/_snaps/multistart/parplot-for-dfop-sfo-fit.svg (renamed from tests/testthat/_snaps/multistart/parplot-for-biphasic-saemix-fit.svg)171
-rw-r--r--tests/testthat/_snaps/multistart/parplot-for-sfo-fit.svg92
-rw-r--r--tests/testthat/anova_sfo_saem.txt10
-rw-r--r--tests/testthat/illparms_hfits_synth.txt10
-rw-r--r--tests/testthat/illparms_hfits_synth_no_ranef_auto.txt4
-rw-r--r--tests/testthat/print_dfop_saem_1.txt (renamed from tests/testthat/print_dfop_saemix_1.txt)21
-rw-r--r--tests/testthat/print_fits_synth_const.txt4
-rw-r--r--tests/testthat/print_hfits_synth_no_ranef_auto.txt9
-rw-r--r--tests/testthat/print_mmkin_sfo_1_mixed.txt4
-rw-r--r--tests/testthat/print_multistart_dfop_sfo.txt (renamed from tests/testthat/print_multistart_biphasic.txt)0
-rw-r--r--tests/testthat/print_sfo_saem_1_reduced.txt12
-rw-r--r--tests/testthat/setup_script.R120
-rw-r--r--tests/testthat/summary_hfit_sfo_tc.txt43
-rw-r--r--tests/testthat/summary_saem_dfop_sfo_s.txt (renamed from tests/testthat/summary_saem_biphasic_s.txt)15
-rw-r--r--tests/testthat/test_AIC.R2
-rw-r--r--tests/testthat/test_dmta.R8
-rw-r--r--tests/testthat/test_mhmkin.R44
-rw-r--r--tests/testthat/test_mixed.R34
-rw-r--r--tests/testthat/test_multistart.R46
-rw-r--r--tests/testthat/test_nafta.R2
-rw-r--r--tests/testthat/test_plot.R22
-rw-r--r--tests/testthat/test_saemix_parent.R42
25 files changed, 344 insertions, 401 deletions
diff --git a/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg b/tests/testthat/_snaps/multistart/llhist-for-dfop-sfo-fit.svg
index 6015aed8..6015aed8 100644
--- a/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg
+++ b/tests/testthat/_snaps/multistart/llhist-for-dfop-sfo-fit.svg
diff --git a/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg b/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg
index 98513d06..028c69de 100644
--- a/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg
+++ b/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg
@@ -25,20 +25,22 @@
<line x1='374.40' y1='502.56' x2='374.40' y2='509.76' style='stroke-width: 0.75;' />
<line x1='520.40' y1='502.56' x2='520.40' y2='509.76' style='stroke-width: 0.75;' />
<line x1='666.40' y1='502.56' x2='666.40' y2='509.76' style='stroke-width: 0.75;' />
-<text x='82.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-649.836</text>
-<text x='228.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-649.834</text>
-<text x='374.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-649.832</text>
-<text x='520.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-649.830</text>
-<text x='666.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-649.828</text>
+<text x='82.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-646.124</text>
+<text x='228.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-646.123</text>
+<text x='374.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-646.122</text>
+<text x='520.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-646.121</text>
+<text x='666.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='47.38px' lengthAdjust='spacingAndGlyphs'>-646.120</text>
<line x1='59.04' y1='486.13' x2='59.04' y2='75.47' style='stroke-width: 0.75;' />
<line x1='59.04' y1='486.13' x2='51.84' y2='486.13' style='stroke-width: 0.75;' />
-<line x1='59.04' y1='349.24' x2='51.84' y2='349.24' style='stroke-width: 0.75;' />
-<line x1='59.04' y1='212.36' x2='51.84' y2='212.36' style='stroke-width: 0.75;' />
+<line x1='59.04' y1='383.47' x2='51.84' y2='383.47' style='stroke-width: 0.75;' />
+<line x1='59.04' y1='280.80' x2='51.84' y2='280.80' style='stroke-width: 0.75;' />
+<line x1='59.04' y1='178.13' x2='51.84' y2='178.13' style='stroke-width: 0.75;' />
<line x1='59.04' y1='75.47' x2='51.84' y2='75.47' style='stroke-width: 0.75;' />
<text x='44.64' y='490.26' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>0</text>
-<text x='44.64' y='353.37' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>1</text>
-<text x='44.64' y='216.48' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>2</text>
-<text x='44.64' y='79.60' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>3</text>
+<text x='44.64' y='387.60' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>1</text>
+<text x='44.64' y='284.93' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>2</text>
+<text x='44.64' y='182.26' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>3</text>
+<text x='44.64' y='79.60' text-anchor='end' style='font-size: 12.00px; font-family: sans;' textLength='6.67px' lengthAdjust='spacingAndGlyphs'>4</text>
</g>
<defs>
<clipPath id='cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng=='>
@@ -46,11 +48,11 @@
</clipPath>
</defs>
<g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'>
-<rect x='82.40' y='349.24' width='146.00' height='136.89' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='82.40' y='280.80' width='146.00' height='205.33' style='stroke-width: 0.75; fill: #D3D3D3;' />
<rect x='228.40' y='75.47' width='146.00' height='410.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<rect x='374.40' y='75.47' width='146.00' height='410.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<rect x='520.40' y='349.24' width='146.00' height='136.89' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<line x1='232.06' y1='502.56' x2='232.06' y2='59.04' style='stroke-width: 0.75; stroke: #DF536B;' />
+<rect x='374.40' y='383.47' width='146.00' height='102.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='520.40' y='383.47' width='146.00' height='102.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<line x1='110.97' y1='502.56' x2='110.97' y2='59.04' style='stroke-width: 0.75; stroke: #DF536B;' />
<line x1='101.38' y1='95.62' x2='122.98' y2='95.62' style='stroke-width: 0.75; stroke: #DF536B;' />
<text x='133.78' y='99.75' style='font-size: 12.00px; font-family: sans;' textLength='51.35px' lengthAdjust='spacingAndGlyphs'>original fit</text>
</g>
diff --git a/tests/testthat/_snaps/plot/mixed-model-fit-for-saem-object-with-mkin-transformations.svg b/tests/testthat/_snaps/multistart/mixed-model-fit-for-saem-object-with-mkin-transformations.svg
index 69fa6a4d..69fa6a4d 100644
--- a/tests/testthat/_snaps/plot/mixed-model-fit-for-saem-object-with-mkin-transformations.svg
+++ b/tests/testthat/_snaps/multistart/mixed-model-fit-for-saem-object-with-mkin-transformations.svg
diff --git a/tests/testthat/_snaps/multistart/parplot-for-biphasic-saemix-fit.svg b/tests/testthat/_snaps/multistart/parplot-for-dfop-sfo-fit.svg
index c0332fd5..b01dac74 100644
--- a/tests/testthat/_snaps/multistart/parplot-for-biphasic-saemix-fit.svg
+++ b/tests/testthat/_snaps/multistart/parplot-for-dfop-sfo-fit.svg
@@ -25,109 +25,104 @@
</clipPath>
</defs>
<g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'>
-<polygon points='86.57,280.95 119.94,280.95 119.94,280.68 86.57,280.68 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='86.57' y1='280.78' x2='119.94' y2='280.78' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='103.26' y1='281.01' x2='103.26' y2='280.95' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='103.26' y1='280.63' x2='103.26' y2='280.68' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<polygon points='86.57,280.91 119.94,280.91 119.94,280.26 86.57,280.26 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='86.57' y1='280.71' x2='119.94' y2='280.71' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='103.26' y1='281.01' x2='103.26' y2='280.91' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='103.26' y1='279.89' x2='103.26' y2='280.26' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='94.91' y1='281.01' x2='111.60' y2='281.01' style='stroke-width: 0.75;' />
-<line x1='94.91' y1='280.63' x2='111.60' y2='280.63' style='stroke-width: 0.75;' />
-<polygon points='86.57,280.95 119.94,280.95 119.94,280.68 86.57,280.68 ' style='stroke-width: 0.75; fill: none;' />
-<circle cx='103.26' cy='281.66' r='2.70' style='stroke-width: 0.75;' />
-<circle cx='103.26' cy='279.89' r='2.70' style='stroke-width: 0.75;' />
-<polygon points='128.29,282.46 161.66,282.46 161.66,280.33 128.29,280.33 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='128.29' y1='280.88' x2='161.66' y2='280.88' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='144.97' y1='282.96' x2='144.97' y2='282.46' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='144.97' y1='279.72' x2='144.97' y2='280.33' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='94.91' y1='279.89' x2='111.60' y2='279.89' style='stroke-width: 0.75;' />
+<polygon points='86.57,280.91 119.94,280.91 119.94,280.26 86.57,280.26 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='128.29,281.88 161.66,281.88 161.66,280.33 128.29,280.33 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='128.29' y1='280.61' x2='161.66' y2='280.61' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='144.97' y1='282.96' x2='144.97' y2='281.88' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='144.97' y1='280.24' x2='144.97' y2='280.33' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='136.63' y1='282.96' x2='153.31' y2='282.96' style='stroke-width: 0.75;' />
-<line x1='136.63' y1='279.72' x2='153.31' y2='279.72' style='stroke-width: 0.75;' />
-<polygon points='128.29,282.46 161.66,282.46 161.66,280.33 128.29,280.33 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='170.00,281.20 203.37,281.20 203.37,280.53 170.00,280.53 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='170.00' y1='280.84' x2='203.37' y2='280.84' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='186.69' y1='281.48' x2='186.69' y2='281.20' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='136.63' y1='280.24' x2='153.31' y2='280.24' style='stroke-width: 0.75;' />
+<polygon points='128.29,281.88 161.66,281.88 161.66,280.33 128.29,280.33 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='170.00,281.69 203.37,281.69 203.37,280.53 170.00,280.53 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='170.00' y1='280.75' x2='203.37' y2='280.75' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='186.69' y1='282.58' x2='186.69' y2='281.69' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='186.69' y1='280.35' x2='186.69' y2='280.53' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='178.34' y1='281.48' x2='195.03' y2='281.48' style='stroke-width: 0.75;' />
+<line x1='178.34' y1='282.58' x2='195.03' y2='282.58' style='stroke-width: 0.75;' />
<line x1='178.34' y1='280.35' x2='195.03' y2='280.35' style='stroke-width: 0.75;' />
-<polygon points='170.00,281.20 203.37,281.20 203.37,280.53 170.00,280.53 ' style='stroke-width: 0.75; fill: none;' />
-<circle cx='186.69' cy='279.30' r='2.70' style='stroke-width: 0.75;' />
-<circle cx='186.69' cy='282.58' r='2.70' style='stroke-width: 0.75;' />
-<polygon points='211.71,281.98 245.09,281.98 245.09,280.03 211.71,280.03 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='211.71' y1='281.46' x2='245.09' y2='281.46' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='228.40' y1='282.40' x2='228.40' y2='281.98' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='228.40' y1='279.21' x2='228.40' y2='280.03' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='220.06' y1='282.40' x2='236.74' y2='282.40' style='stroke-width: 0.75;' />
-<line x1='220.06' y1='279.21' x2='236.74' y2='279.21' style='stroke-width: 0.75;' />
-<polygon points='211.71,281.98 245.09,281.98 245.09,280.03 211.71,280.03 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='253.43,281.94 286.80,281.94 286.80,280.63 253.43,280.63 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='253.43' y1='281.42' x2='286.80' y2='281.42' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='270.11' y1='282.62' x2='270.11' y2='281.94' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='270.11' y1='280.34' x2='270.11' y2='280.63' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<polygon points='170.00,281.69 203.37,281.69 203.37,280.53 170.00,280.53 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='211.71,281.83 245.09,281.83 245.09,280.03 211.71,280.03 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='211.71' y1='281.14' x2='245.09' y2='281.14' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='228.40' y1='282.17' x2='228.40' y2='281.83' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='228.40' y1='279.26' x2='228.40' y2='280.03' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='220.06' y1='282.17' x2='236.74' y2='282.17' style='stroke-width: 0.75;' />
+<line x1='220.06' y1='279.26' x2='236.74' y2='279.26' style='stroke-width: 0.75;' />
+<polygon points='211.71,281.83 245.09,281.83 245.09,280.03 211.71,280.03 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='253.43,282.21 286.80,282.21 286.80,280.57 253.43,280.57 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='253.43' y1='281.30' x2='286.80' y2='281.30' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='270.11' y1='282.62' x2='270.11' y2='282.21' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='270.11' y1='280.34' x2='270.11' y2='280.57' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='261.77' y1='282.62' x2='278.46' y2='282.62' style='stroke-width: 0.75;' />
<line x1='261.77' y1='280.34' x2='278.46' y2='280.34' style='stroke-width: 0.75;' />
-<polygon points='253.43,281.94 286.80,281.94 286.80,280.63 253.43,280.63 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='295.14,281.17 328.51,281.17 328.51,278.99 295.14,278.99 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='295.14' y1='280.18' x2='328.51' y2='280.18' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='311.83' y1='282.20' x2='311.83' y2='281.17' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='311.83' y1='277.75' x2='311.83' y2='278.99' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<polygon points='253.43,282.21 286.80,282.21 286.80,280.57 253.43,280.57 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='295.14,281.50 328.51,281.50 328.51,278.14 295.14,278.14 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='295.14' y1='279.67' x2='328.51' y2='279.67' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='311.83' y1='282.20' x2='311.83' y2='281.50' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='311.83' y1='277.75' x2='311.83' y2='278.14' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='303.49' y1='282.20' x2='320.17' y2='282.20' style='stroke-width: 0.75;' />
<line x1='303.49' y1='277.75' x2='320.17' y2='277.75' style='stroke-width: 0.75;' />
-<polygon points='295.14,281.17 328.51,281.17 328.51,278.99 295.14,278.99 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='336.86,281.95 370.23,281.95 370.23,281.00 336.86,281.00 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='336.86' y1='281.48' x2='370.23' y2='281.48' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='353.54' y1='282.69' x2='353.54' y2='281.95' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='353.54' y1='280.80' x2='353.54' y2='281.00' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='345.20' y1='282.69' x2='361.89' y2='282.69' style='stroke-width: 0.75;' />
+<polygon points='295.14,281.50 328.51,281.50 328.51,278.14 295.14,278.14 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='336.86,281.52 370.23,281.52 370.23,280.88 336.86,280.88 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='336.86' y1='281.06' x2='370.23' y2='281.06' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='353.54' y1='281.89' x2='353.54' y2='281.52' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='353.54' y1='280.80' x2='353.54' y2='280.88' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='345.20' y1='281.89' x2='361.89' y2='281.89' style='stroke-width: 0.75;' />
<line x1='345.20' y1='280.80' x2='361.89' y2='280.80' style='stroke-width: 0.75;' />
-<polygon points='336.86,281.95 370.23,281.95 370.23,281.00 336.86,281.00 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='378.57,280.93 411.94,280.93 411.94,280.50 378.57,280.50 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='378.57' y1='280.72' x2='411.94' y2='280.72' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='395.26' y1='281.09' x2='395.26' y2='280.93' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='395.26' y1='280.44' x2='395.26' y2='280.50' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<polygon points='336.86,281.52 370.23,281.52 370.23,280.88 336.86,280.88 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='378.57,281.06 411.94,281.06 411.94,280.72 378.57,280.72 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='378.57' y1='280.91' x2='411.94' y2='280.91' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='395.26' y1='281.09' x2='395.26' y2='281.06' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='395.26' y1='280.64' x2='395.26' y2='280.72' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='386.91' y1='281.09' x2='403.60' y2='281.09' style='stroke-width: 0.75;' />
-<line x1='386.91' y1='280.44' x2='403.60' y2='280.44' style='stroke-width: 0.75;' />
-<polygon points='378.57,280.93 411.94,280.93 411.94,280.50 378.57,280.50 ' style='stroke-width: 0.75; fill: none;' />
-<circle cx='395.26' cy='279.72' r='2.70' style='stroke-width: 0.75;' />
-<polygon points='420.29,409.00 453.66,409.00 453.66,-49.57 420.29,-49.57 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='420.29' y1='94.54' x2='453.66' y2='94.54' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='436.97' y1='656.81' x2='436.97' y2='409.00' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='436.97' y1='-136.13' x2='436.97' y2='-49.57' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='428.63' y1='656.81' x2='445.31' y2='656.81' style='stroke-width: 0.75;' />
+<line x1='386.91' y1='280.64' x2='403.60' y2='280.64' style='stroke-width: 0.75;' />
+<polygon points='378.57,281.06 411.94,281.06 411.94,280.72 378.57,280.72 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='420.29,106.59 453.66,106.59 453.66,-114.09 420.29,-114.09 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='420.29' y1='-49.57' x2='453.66' y2='-49.57' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='436.97' y1='280.80' x2='436.97' y2='106.59' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='436.97' y1='-136.13' x2='436.97' y2='-114.09' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='428.63' y1='280.80' x2='445.31' y2='280.80' style='stroke-width: 0.75;' />
<line x1='428.63' y1='-136.13' x2='445.31' y2='-136.13' style='stroke-width: 0.75;' />
-<polygon points='420.29,409.00 453.66,409.00 453.66,-49.57 420.29,-49.57 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='462.00,280.54 495.37,280.54 495.37,275.74 462.00,275.74 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='462.00' y1='278.14' x2='495.37' y2='278.14' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='478.69' y1='281.75' x2='478.69' y2='280.54' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='478.69' y1='272.26' x2='478.69' y2='275.74' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<polygon points='420.29,106.59 453.66,106.59 453.66,-114.09 420.29,-114.09 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='462.00,281.28 495.37,281.28 495.37,276.14 462.00,276.14 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='462.00' y1='278.79' x2='495.37' y2='278.79' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='478.69' y1='281.75' x2='478.69' y2='281.28' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='478.69' y1='275.48' x2='478.69' y2='276.14' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='470.34' y1='281.75' x2='487.03' y2='281.75' style='stroke-width: 0.75;' />
-<line x1='470.34' y1='272.26' x2='487.03' y2='272.26' style='stroke-width: 0.75;' />
-<polygon points='462.00,280.54 495.37,280.54 495.37,275.74 462.00,275.74 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='503.71,282.63 537.09,282.63 537.09,280.69 503.71,280.69 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='503.71' y1='282.10' x2='537.09' y2='282.10' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='520.40' y1='283.13' x2='520.40' y2='282.63' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='520.40' y1='280.04' x2='520.40' y2='280.69' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='470.34' y1='275.48' x2='487.03' y2='275.48' style='stroke-width: 0.75;' />
+<polygon points='462.00,281.28 495.37,281.28 495.37,276.14 462.00,276.14 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='503.71,282.81 537.09,282.81 537.09,281.44 503.71,281.44 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='503.71' y1='282.28' x2='537.09' y2='282.28' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='520.40' y1='283.13' x2='520.40' y2='282.81' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='520.40' y1='280.80' x2='520.40' y2='281.44' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='512.06' y1='283.13' x2='528.74' y2='283.13' style='stroke-width: 0.75;' />
-<line x1='512.06' y1='280.04' x2='528.74' y2='280.04' style='stroke-width: 0.75;' />
-<polygon points='503.71,282.63 537.09,282.63 537.09,280.69 503.71,280.69 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='545.43,283.04 578.80,283.04 578.80,278.99 545.43,278.99 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='545.43' y1='281.15' x2='578.80' y2='281.15' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='562.11' y1='283.53' x2='562.11' y2='283.04' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='562.11' y1='275.97' x2='562.11' y2='278.99' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='512.06' y1='280.80' x2='528.74' y2='280.80' style='stroke-width: 0.75;' />
+<polygon points='503.71,282.81 537.09,282.81 537.09,281.44 503.71,281.44 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='545.43,282.16 578.80,282.16 578.80,276.63 545.43,276.63 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='545.43' y1='279.04' x2='578.80' y2='279.04' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='562.11' y1='283.53' x2='562.11' y2='282.16' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='562.11' y1='275.97' x2='562.11' y2='276.63' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='553.77' y1='283.53' x2='570.46' y2='283.53' style='stroke-width: 0.75;' />
<line x1='553.77' y1='275.97' x2='570.46' y2='275.97' style='stroke-width: 0.75;' />
-<polygon points='545.43,283.04 578.80,283.04 578.80,278.99 545.43,278.99 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='587.14,284.59 620.51,284.59 620.51,281.02 587.14,281.02 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='587.14' y1='282.38' x2='620.51' y2='282.38' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='603.83' y1='288.19' x2='603.83' y2='284.59' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='603.83' y1='279.95' x2='603.83' y2='281.02' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='595.49' y1='288.19' x2='612.17' y2='288.19' style='stroke-width: 0.75;' />
+<polygon points='545.43,282.16 578.80,282.16 578.80,276.63 545.43,276.63 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='587.14,283.70 620.51,283.70 620.51,280.38 587.14,280.38 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='587.14' y1='281.36' x2='620.51' y2='281.36' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='603.83' y1='285.50' x2='603.83' y2='283.70' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='603.83' y1='279.95' x2='603.83' y2='280.38' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='595.49' y1='285.50' x2='612.17' y2='285.50' style='stroke-width: 0.75;' />
<line x1='595.49' y1='279.95' x2='612.17' y2='279.95' style='stroke-width: 0.75;' />
-<polygon points='587.14,284.59 620.51,284.59 620.51,281.02 587.14,281.02 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='628.86,292.70 662.23,292.70 662.23,264.27 628.86,264.27 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='628.86' y1='282.03' x2='662.23' y2='282.03' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='645.54' y1='297.26' x2='645.54' y2='292.70' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='645.54' y1='258.13' x2='645.54' y2='264.27' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<polygon points='587.14,283.70 620.51,283.70 620.51,280.38 587.14,280.38 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='628.86,288.92 662.23,288.92 662.23,261.71 628.86,261.71 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='628.86' y1='272.96' x2='662.23' y2='272.96' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='645.54' y1='297.26' x2='645.54' y2='288.92' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='645.54' y1='258.13' x2='645.54' y2='261.71' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='637.20' y1='297.26' x2='653.89' y2='297.26' style='stroke-width: 0.75;' />
<line x1='637.20' y1='258.13' x2='653.89' y2='258.13' style='stroke-width: 0.75;' />
-<polygon points='628.86,292.70 662.23,292.70 662.23,264.27 628.86,264.27 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='628.86,288.92 662.23,288.92 662.23,261.71 628.86,261.71 ' style='stroke-width: 0.75; fill: none;' />
</g>
<g clip-path='url(#cpMC4wMHw3MjAuMDB8MC4wMHw1NzYuMDA=)'>
<line x1='103.26' y1='502.56' x2='645.54' y2='502.56' style='stroke-width: 0.75;' />
@@ -173,6 +168,8 @@
<circle cx='228.40' cy='269.36' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
<circle cx='270.11' cy='283.47' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
<circle cx='311.83' cy='285.42' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
+<circle cx='353.54' cy='258.25' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
+<circle cx='395.26' cy='-596.36' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
<circle cx='103.26' cy='280.60' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
<circle cx='144.97' cy='281.94' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
<circle cx='186.69' cy='281.42' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
@@ -192,8 +189,8 @@
<circle cx='104.62' cy='437.18' r='2.70' style='stroke-width: 0.75; stroke: #61D04F;' />
<circle cx='104.62' cy='451.58' r='2.70' style='stroke-width: 0.75; stroke: #DF536B;' />
<circle cx='104.62' cy='465.98' r='2.70' style='stroke-width: 0.75;' />
-<text x='126.22' y='441.31' style='font-size: 12.00px; font-family: sans;' textLength='105.39px' lengthAdjust='spacingAndGlyphs'>Starting parameters</text>
-<text x='126.22' y='455.71' style='font-size: 12.00px; font-family: sans;' textLength='62.03px' lengthAdjust='spacingAndGlyphs'>Original run</text>
+<text x='126.22' y='441.31' style='font-size: 12.00px; font-family: sans;' textLength='68.03px' lengthAdjust='spacingAndGlyphs'>Original start</text>
+<text x='126.22' y='455.71' style='font-size: 12.00px; font-family: sans;' textLength='80.04px' lengthAdjust='spacingAndGlyphs'>Original results</text>
<text x='126.22' y='470.11' style='font-size: 12.00px; font-family: sans;' textLength='75.36px' lengthAdjust='spacingAndGlyphs'>Multistart runs</text>
</g>
</svg>
diff --git a/tests/testthat/_snaps/multistart/parplot-for-sfo-fit.svg b/tests/testthat/_snaps/multistart/parplot-for-sfo-fit.svg
index f3373901..c8d4970b 100644
--- a/tests/testthat/_snaps/multistart/parplot-for-sfo-fit.svg
+++ b/tests/testthat/_snaps/multistart/parplot-for-sfo-fit.svg
@@ -25,42 +25,44 @@
</clipPath>
</defs>
<g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'>
-<polygon points='94.08,280.80 187.52,280.80 187.52,280.77 94.08,280.77 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<polygon points='94.08,280.80 187.52,280.80 187.52,280.79 94.08,280.79 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
<line x1='94.08' y1='280.79' x2='187.52' y2='280.79' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='140.80' y1='280.81' x2='140.80' y2='280.80' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='140.80' y1='280.74' x2='140.80' y2='280.77' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='117.44' y1='280.81' x2='164.16' y2='280.81' style='stroke-width: 0.75;' />
-<line x1='117.44' y1='280.74' x2='164.16' y2='280.74' style='stroke-width: 0.75;' />
-<polygon points='94.08,280.80 187.52,280.80 187.52,280.77 94.08,280.77 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='210.88,280.81 304.32,280.81 304.32,280.73 210.88,280.73 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='210.88' y1='280.78' x2='304.32' y2='280.78' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='257.60' y1='280.82' x2='257.60' y2='280.81' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='257.60' y1='280.65' x2='257.60' y2='280.73' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='234.24' y1='280.82' x2='280.96' y2='280.82' style='stroke-width: 0.75;' />
-<line x1='234.24' y1='280.65' x2='280.96' y2='280.65' style='stroke-width: 0.75;' />
-<polygon points='210.88,280.81 304.32,280.81 304.32,280.73 210.88,280.73 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='327.68,280.90 421.12,280.90 421.12,280.70 327.68,280.70 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='327.68' y1='280.84' x2='421.12' y2='280.84' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='374.40' y1='280.92' x2='374.40' y2='280.90' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='374.40' y1='280.67' x2='374.40' y2='280.70' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='351.04' y1='280.92' x2='397.76' y2='280.92' style='stroke-width: 0.75;' />
-<line x1='351.04' y1='280.67' x2='397.76' y2='280.67' style='stroke-width: 0.75;' />
-<polygon points='327.68,280.90 421.12,280.90 421.12,280.70 327.68,280.70 ' style='stroke-width: 0.75; fill: none;' />
-<circle cx='374.40' cy='280.36' r='2.70' style='stroke-width: 0.75;' />
-<polygon points='444.48,280.85 537.92,280.85 537.92,280.79 444.48,280.79 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='444.48' y1='280.82' x2='537.92' y2='280.82' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='491.20' y1='280.88' x2='491.20' y2='280.85' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='491.20' y1='280.74' x2='491.20' y2='280.79' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='467.84' y1='280.88' x2='514.56' y2='280.88' style='stroke-width: 0.75;' />
-<line x1='467.84' y1='280.74' x2='514.56' y2='280.74' style='stroke-width: 0.75;' />
-<polygon points='444.48,280.85 537.92,280.85 537.92,280.79 444.48,280.79 ' style='stroke-width: 0.75; fill: none;' />
-<polygon points='561.28,280.75 654.72,280.75 654.72,280.57 561.28,280.57 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
-<line x1='561.28' y1='280.65' x2='654.72' y2='280.65' style='stroke-width: 2.25; stroke-linecap: butt;' />
-<line x1='608.00' y1='280.80' x2='608.00' y2='280.75' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='608.00' y1='280.45' x2='608.00' y2='280.57' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
-<line x1='584.64' y1='280.80' x2='631.36' y2='280.80' style='stroke-width: 0.75;' />
-<line x1='584.64' y1='280.45' x2='631.36' y2='280.45' style='stroke-width: 0.75;' />
-<polygon points='561.28,280.75 654.72,280.75 654.72,280.57 561.28,280.57 ' style='stroke-width: 0.75; fill: none;' />
+<line x1='140.80' y1='280.80' x2='140.80' y2='280.80' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='140.80' y1='280.79' x2='140.80' y2='280.79' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='117.44' y1='280.80' x2='164.16' y2='280.80' style='stroke-width: 0.75;' />
+<line x1='117.44' y1='280.79' x2='164.16' y2='280.79' style='stroke-width: 0.75;' />
+<polygon points='94.08,280.80 187.52,280.80 187.52,280.79 94.08,280.79 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='210.88,280.80 304.32,280.80 304.32,280.77 210.88,280.77 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='210.88' y1='280.79' x2='304.32' y2='280.79' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='257.60' y1='280.81' x2='257.60' y2='280.80' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='257.60' y1='280.77' x2='257.60' y2='280.77' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='234.24' y1='280.81' x2='280.96' y2='280.81' style='stroke-width: 0.75;' />
+<line x1='234.24' y1='280.77' x2='280.96' y2='280.77' style='stroke-width: 0.75;' />
+<polygon points='210.88,280.80 304.32,280.80 304.32,280.77 210.88,280.77 ' style='stroke-width: 0.75; fill: none;' />
+<polygon points='327.68,280.94 421.12,280.94 421.12,280.80 327.68,280.80 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='327.68' y1='280.82' x2='421.12' y2='280.82' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='374.40' y1='280.98' x2='374.40' y2='280.94' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='374.40' y1='280.80' x2='374.40' y2='280.80' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='351.04' y1='280.98' x2='397.76' y2='280.98' style='stroke-width: 0.75;' />
+<line x1='351.04' y1='280.80' x2='397.76' y2='280.80' style='stroke-width: 0.75;' />
+<polygon points='327.68,280.94 421.12,280.94 421.12,280.80 327.68,280.80 ' style='stroke-width: 0.75; fill: none;' />
+<circle cx='374.40' cy='280.60' r='2.70' style='stroke-width: 0.75;' />
+<polygon points='444.48,280.81 537.92,280.81 537.92,280.78 444.48,280.78 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='444.48' y1='280.80' x2='537.92' y2='280.80' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='491.20' y1='280.82' x2='491.20' y2='280.81' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='491.20' y1='280.77' x2='491.20' y2='280.78' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='467.84' y1='280.82' x2='514.56' y2='280.82' style='stroke-width: 0.75;' />
+<line x1='467.84' y1='280.77' x2='514.56' y2='280.77' style='stroke-width: 0.75;' />
+<polygon points='444.48,280.81 537.92,280.81 537.92,280.78 444.48,280.78 ' style='stroke-width: 0.75; fill: none;' />
+<circle cx='491.20' cy='280.87' r='2.70' style='stroke-width: 0.75;' />
+<polygon points='561.28,280.89 654.72,280.89 654.72,280.79 561.28,280.79 ' style='stroke-width: 0.75; stroke: none; fill: #D3D3D3;' />
+<line x1='561.28' y1='280.84' x2='654.72' y2='280.84' style='stroke-width: 2.25; stroke-linecap: butt;' />
+<line x1='608.00' y1='280.92' x2='608.00' y2='280.89' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='608.00' y1='280.70' x2='608.00' y2='280.79' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
+<line x1='584.64' y1='280.92' x2='631.36' y2='280.92' style='stroke-width: 0.75;' />
+<line x1='584.64' y1='280.70' x2='631.36' y2='280.70' style='stroke-width: 0.75;' />
+<polygon points='561.28,280.89 654.72,280.89 654.72,280.79 561.28,280.79 ' style='stroke-width: 0.75; fill: none;' />
+<circle cx='608.00' cy='281.12' r='2.70' style='stroke-width: 0.75;' />
</g>
<g clip-path='url(#cpMC4wMHw3MjAuMDB8MC4wMHw1NzYuMDA=)'>
<line x1='140.80' y1='502.56' x2='608.00' y2='502.56' style='stroke-width: 0.75;' />
@@ -87,20 +89,22 @@
<polygon points='59.04,502.56 689.76,502.56 689.76,59.04 59.04,59.04 ' style='stroke-width: 0.75; fill: none;' />
</g>
<g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'>
-<circle cx='140.80' cy='280.97' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
-<circle cx='257.60' cy='281.05' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
-<circle cx='140.80' cy='280.75' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
-<circle cx='257.60' cy='280.67' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
-<circle cx='374.40' cy='280.50' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
-<circle cx='491.20' cy='280.92' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
-<circle cx='608.00' cy='280.49' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
+<circle cx='140.80' cy='280.66' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
+<circle cx='257.60' cy='280.66' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
+<circle cx='374.40' cy='243.83' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
+<circle cx='491.20' cy='-614.23' r='8.10' style='stroke-width: 0.75; stroke: #61D04F;' />
+<circle cx='140.80' cy='280.82' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
+<circle cx='257.60' cy='280.85' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
+<circle cx='374.40' cy='280.96' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
+<circle cx='491.20' cy='280.75' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
+<circle cx='608.00' cy='280.97' r='5.40' style='stroke-width: 0.75; stroke: #DF536B;' />
<line x1='59.04' y1='280.80' x2='689.76' y2='280.80' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' />
<line x1='93.82' y1='465.98' x2='115.42' y2='465.98' style='stroke-width: 0.75;' />
<circle cx='104.62' cy='437.18' r='2.70' style='stroke-width: 0.75; stroke: #61D04F;' />
<circle cx='104.62' cy='451.58' r='2.70' style='stroke-width: 0.75; stroke: #DF536B;' />
<circle cx='104.62' cy='465.98' r='2.70' style='stroke-width: 0.75;' />
-<text x='126.22' y='441.31' style='font-size: 12.00px; font-family: sans;' textLength='105.39px' lengthAdjust='spacingAndGlyphs'>Starting parameters</text>
-<text x='126.22' y='455.71' style='font-size: 12.00px; font-family: sans;' textLength='62.03px' lengthAdjust='spacingAndGlyphs'>Original run</text>
+<text x='126.22' y='441.31' style='font-size: 12.00px; font-family: sans;' textLength='68.03px' lengthAdjust='spacingAndGlyphs'>Original start</text>
+<text x='126.22' y='455.71' style='font-size: 12.00px; font-family: sans;' textLength='80.04px' lengthAdjust='spacingAndGlyphs'>Original results</text>
<text x='126.22' y='470.11' style='font-size: 12.00px; font-family: sans;' textLength='75.36px' lengthAdjust='spacingAndGlyphs'>Multistart runs</text>
</g>
</svg>
diff --git a/tests/testthat/anova_sfo_saem.txt b/tests/testthat/anova_sfo_saem.txt
index 9e4bf71f..0ccd6d5c 100644
--- a/tests/testthat/anova_sfo_saem.txt
+++ b/tests/testthat/anova_sfo_saem.txt
@@ -1,7 +1,7 @@
-Data: 262 observations of 1 variable(s) grouped in 15 datasets
+Data: 263 observations of 1 variable(s) grouped in 15 datasets
npar AIC BIC Lik Chisq Df Pr(>Chisq)
-sfo_saem_1_reduced 5 1310 1313 -650
-sfo_saem_1_reduced_mkin 5 1310 1313 -650 0 0
-sfo_saem_1 6 1312 1316 -650 0 1 1
-sfo_saem_1_mkin 6 1312 1316 -650 0 0
+sfo_saem_1_reduced 5 1302 1306 -646
+sfo_saem_1_reduced_mkin 5 1302 1306 -646 0 0
+sfo_saem_1 6 1304 1308 -646 0 1 1
+sfo_saem_1_mkin 6 1303 1308 -646 1 0
diff --git a/tests/testthat/illparms_hfits_synth.txt b/tests/testthat/illparms_hfits_synth.txt
index affd1318..7a69645b 100644
--- a/tests/testthat/illparms_hfits_synth.txt
+++ b/tests/testthat/illparms_hfits_synth.txt
@@ -1,8 +1,4 @@
error
-degradation const
- SFO
- FOMC sd(log_alpha), sd(log_beta)
- error
-degradation tc
- SFO sd(parent_0)
- FOMC sd(parent_0), sd(log_alpha), sd(log_beta)
+degradation const tc
+ SFO sd(parent_0) sd(parent_0)
+ FOMC sd(log_beta) sd(parent_0), sd(log_beta)
diff --git a/tests/testthat/illparms_hfits_synth_no_ranef_auto.txt b/tests/testthat/illparms_hfits_synth_no_ranef_auto.txt
deleted file mode 100644
index a64ed222..00000000
--- a/tests/testthat/illparms_hfits_synth_no_ranef_auto.txt
+++ /dev/null
@@ -1,4 +0,0 @@
- error
-degradation const tc
- SFO sd(parent_0)
- FOMC b.1
diff --git a/tests/testthat/print_dfop_saemix_1.txt b/tests/testthat/print_dfop_saem_1.txt
index f6fda37c..bdc40065 100644
--- a/tests/testthat/print_dfop_saemix_1.txt
+++ b/tests/testthat/print_dfop_saem_1.txt
@@ -9,16 +9,15 @@ Data:
Likelihood computed by importance sampling
AIC BIC logLik
- 1409 1415 -695
+ 1409 1415 -696
Fitted parameters:
- estimate lower upper
-parent_0 100.09 98.94 101.25
-log_k1 -2.68 -2.91 -2.45
-log_k2 -4.12 -4.24 -4.00
-g_qlogis -0.41 -0.63 -0.20
-a.1 0.91 0.67 1.15
-b.1 0.05 0.04 0.06
-SD.log_k1 0.36 0.21 0.50
-SD.log_k2 0.22 0.13 0.30
-SD.g_qlogis 0.15 -0.09 0.40
+ estimate lower upper
+parent_0 99.92 98.77 101.06
+log_k1 -2.72 -2.95 -2.50
+log_k2 -4.14 -4.27 -4.01
+g_qlogis -0.35 -0.53 -0.16
+a.1 0.92 0.68 1.16
+b.1 0.05 0.04 0.06
+SD.log_k1 0.37 0.23 0.51
+SD.log_k2 0.23 0.14 0.31
diff --git a/tests/testthat/print_fits_synth_const.txt b/tests/testthat/print_fits_synth_const.txt
index 2ea1f133..5d076d3d 100644
--- a/tests/testthat/print_fits_synth_const.txt
+++ b/tests/testthat/print_fits_synth_const.txt
@@ -4,8 +4,6 @@ Status of individual fits:
dataset
model 1 2 3 4 5 6
SFO OK OK OK OK OK OK
- FOMC C C OK OK OK OK
+ FOMC OK OK OK OK OK OK
-C: Optimisation did not converge:
-false convergence (8)
OK: No warnings
diff --git a/tests/testthat/print_hfits_synth_no_ranef_auto.txt b/tests/testthat/print_hfits_synth_no_ranef_auto.txt
deleted file mode 100644
index 9af1cbcd..00000000
--- a/tests/testthat/print_hfits_synth_no_ranef_auto.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-<mhmkin> object
-Status of individual fits:
-
- error
-degradation const tc
- SFO OK OK
- FOMC OK OK
-
-OK: Fit terminated successfully
diff --git a/tests/testthat/print_mmkin_sfo_1_mixed.txt b/tests/testthat/print_mmkin_sfo_1_mixed.txt
index 33e5bf5c..c12cfe2b 100644
--- a/tests/testthat/print_mmkin_sfo_1_mixed.txt
+++ b/tests/testthat/print_mmkin_sfo_1_mixed.txt
@@ -3,7 +3,7 @@ Structural model:
d_parent/dt = - k_parent * parent
Data:
-262 observations of 1 variable(s) grouped in 15 datasets
+263 observations of 1 variable(s) grouped in 15 datasets
<mmkin> object
Status of individual fits:
@@ -16,4 +16,4 @@ OK: No warnings
Mean fitted parameters:
parent_0 log_k_parent
- 99.9 -3.3
+ 100.0 -3.4
diff --git a/tests/testthat/print_multistart_biphasic.txt b/tests/testthat/print_multistart_dfop_sfo.txt
index b4344f22..b4344f22 100644
--- a/tests/testthat/print_multistart_biphasic.txt
+++ b/tests/testthat/print_multistart_dfop_sfo.txt
diff --git a/tests/testthat/print_sfo_saem_1_reduced.txt b/tests/testthat/print_sfo_saem_1_reduced.txt
index bac8848e..1c7fb588 100644
--- a/tests/testthat/print_sfo_saem_1_reduced.txt
+++ b/tests/testthat/print_sfo_saem_1_reduced.txt
@@ -3,16 +3,16 @@ Structural model:
d_parent/dt = - k_parent * parent
Data:
-262 observations of 1 variable(s) grouped in 15 datasets
+263 observations of 1 variable(s) grouped in 15 datasets
Likelihood computed by importance sampling
AIC BIC logLik
- 1310 1313 -650
+ 1302 1306 -646
Fitted parameters:
estimate lower upper
-parent_0 1e+02 99.08 1e+02
-k_parent 4e-02 0.03 4e-02
-a.1 9e-01 0.75 1e+00
+parent_0 1e+02 99.03 1e+02
+k_parent 3e-02 0.03 4e-02
+a.1 9e-01 0.71 1e+00
b.1 5e-02 0.04 5e-02
-SD.k_parent 3e-01 0.20 4e-01
+SD.k_parent 2e-01 0.14 3e-01
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index 777c998a..4e2f76ab 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -2,17 +2,23 @@ require(mkin)
require(testthat)
# Per default (on my box where I set NOT_CRAN in .Rprofile) use all cores minus one
+# Otherwise (CRAN check systems) use the allowed maximum of two cores
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
n_cores <- parallel::detectCores() - 1
} else {
- n_cores <- 1
+ n_cores <- 2
}
# Use the two available cores on travis
if (Sys.getenv("TRAVIS") != "") n_cores = 2
-# On Windows we would need to make a cluster first
-if (Sys.info()["sysname"] == "Windows") n_cores = 1
+# On Windows we need to make a cluster, or use one core
+if (Sys.info()["sysname"] == "Windows") {
+ cl <- parallel::makePSOCKcluster(n_cores)
+ n_cores = 1
+} else {
+ cl <- parallel::makeForkCluster(n_cores)
+}
# Very simple example fits
f_1_mkin_trans <- mkinfit("SFO", FOCUS_2006_A, quiet = TRUE)
@@ -24,7 +30,7 @@ models <- c("SFO", "FOMC", "DFOP", "HS")
fits <- suppressWarnings( # FOCUS A FOMC was, it seems, in testthat output
mmkin(models,
list(FOCUS_A = FOCUS_2006_A, FOCUS_C = FOCUS_2006_C, FOCUS_D = FOCUS_2006_D),
- quiet = TRUE, cores = n_cores))
+ quiet = TRUE, cluster = cl))
# One metabolite
SFO_SFO <- mkinmod(parent = mkinsub("SFO", to = "m1"),
@@ -81,112 +87,26 @@ fit_obs_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "obs", quiet = TR
fit_tc_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "tc", quiet = TRUE,
error_model_algorithm = "threestep")
-# Mixed models data and fits
-sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
-n <- n_biphasic <- 15
-log_sd <- 0.3
-err_1 = list(const = 1, prop = 0.05)
-tc <- function(value) sigma_twocomp(value, err_1$const, err_1$prop)
-const <- function(value) 2
-
-set.seed(123456)
-SFO <- mkinmod(parent = mkinsub("SFO"))
-k_parent = rlnorm(n, log(0.03), log_sd)
-set.seed(123456)
-ds_sfo <- lapply(1:n, function(i) {
- ds_mean <- mkinpredict(SFO, c(k_parent = k_parent[i]),
- c(parent = 100), sampling_times)
- add_err(ds_mean, tc, n = 1)[[1]]
-})
-
-set.seed(123456)
-FOMC <- mkinmod(parent = mkinsub("FOMC"))
-fomc_pop <- list(parent_0 = 100, alpha = 2, beta = 8)
-fomc_parms <- as.matrix(data.frame(
- alpha = rlnorm(n, log(fomc_pop$alpha), 0.4),
- beta = rlnorm(n, log(fomc_pop$beta), 0.2)))
-set.seed(123456)
-ds_fomc <- lapply(1:3, function(i) {
- ds_mean <- mkinpredict(FOMC, fomc_parms[i, ],
- c(parent = 100), sampling_times)
- add_err(ds_mean, tc, n = 1)[[1]]
-})
-
-set.seed(123456)
-DFOP <- mkinmod(parent = mkinsub("DFOP"))
-dfop_pop <- list(parent_0 = 100, k1 = 0.06, k2 = 0.015, g = 0.4)
-dfop_parms <- as.matrix(data.frame(
- k1 = rlnorm(n, log(dfop_pop$k1), log_sd),
- k2 = rlnorm(n, log(dfop_pop$k2), log_sd),
- g = plogis(rnorm(n, qlogis(dfop_pop$g), log_sd))))
-set.seed(123456)
-ds_dfop <- lapply(1:n, function(i) {
- ds_mean <- mkinpredict(DFOP, dfop_parms[i, ],
- c(parent = dfop_pop$parent_0), sampling_times)
- add_err(ds_mean, tc, n = 1)[[1]]
-})
-
-set.seed(123456)
-HS <- mkinmod(parent = mkinsub("HS"))
-hs_pop <- list(parent_0 = 100, k1 = 0.08, k2 = 0.01, tb = 15)
-hs_parms <- as.matrix(data.frame(
- k1 = rlnorm(n, log(hs_pop$k1), log_sd),
- k2 = rlnorm(n, log(hs_pop$k2), log_sd),
- tb = rlnorm(n, log(hs_pop$tb), 0.1)))
-set.seed(123456)
-ds_hs <- lapply(1:10, function(i) {
- ds_mean <- mkinpredict(HS, hs_parms[i, ],
- c(parent = hs_pop$parent_0), sampling_times)
- add_err(ds_mean, const, n = 1)[[1]]
-})
-
-set.seed(123456)
-DFOP_SFO <- mkinmod(
- parent = mkinsub("DFOP", "m1"),
- m1 = mkinsub("SFO"),
- quiet = TRUE)
-dfop_sfo_pop <- list(parent_0 = 100,
- k_m1 = 0.007, f_parent_to_m1 = 0.5,
- k1 = 0.1, k2 = 0.02, g = 0.5)
-syn_biphasic_parms <- as.matrix(data.frame(
- k1 = rlnorm(n_biphasic, log(dfop_sfo_pop$k1), log_sd),
- k2 = rlnorm(n_biphasic, log(dfop_sfo_pop$k2), log_sd),
- g = plogis(rnorm(n_biphasic, qlogis(dfop_sfo_pop$g), log_sd)),
- f_parent_to_m1 = plogis(rnorm(n_biphasic,
- qlogis(dfop_sfo_pop$f_parent_to_m1), log_sd)),
- k_m1 = rlnorm(n_biphasic, log(dfop_sfo_pop$k_m1), log_sd)))
-ds_biphasic_mean <- lapply(1:n_biphasic,
- function(i) {
- mkinpredict(DFOP_SFO, syn_biphasic_parms[i, ],
- c(parent = 100, m1 = 0), sampling_times)
- }
-)
-set.seed(123456)
-ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
- add_err(ds,
- sdfunc = function(value) sqrt(err_1$const^2 + value^2 * err_1$prop^2),
- n = 1, secondary = "m1")[[1]]
-})
-
# Mixed model fits
-mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc", cores = n_cores)
-mmkin_dfop_1 <- mmkin("DFOP", ds_dfop, quiet = TRUE, cores = n_cores,
+mmkin_sfo_1 <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc", cluster = cl)
+mmkin_dfop_1 <- mmkin("DFOP", ds_dfop, quiet = TRUE, cluster = cl,
error_model = "tc")
-mmkin_biphasic <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_biphasic, quiet = TRUE, cores = n_cores,
+DFOP_SFO <- mkinmod(parent = mkinsub("DFOP", "m1"),
+ m1 = mkinsub("SFO"), quiet = TRUE)
+mmkin_dfop_sfo <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_dfop_sfo, quiet = TRUE,
+ cluster = cl,
control = list(eval.max = 500, iter.max = 400),
error_model = "tc")
# nlme
dfop_nlme_1 <- suppressWarnings(nlme(mmkin_dfop_1))
-nlme_biphasic <- suppressWarnings(nlme(mmkin_biphasic))
+nlme_dfop_sfo <- suppressWarnings(nlme(mmkin_dfop_sfo))
# saemix
sfo_saem_1 <- saem(mmkin_sfo_1, quiet = TRUE, transformations = "saemix")
sfo_saem_1_reduced <- update(sfo_saem_1, no_random_effect = "parent_0")
-dfop_saemix_1 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin",
- no_random_effect = "parent_0")
-
-saem_biphasic_m <- saem(mmkin_biphasic, transformations = "mkin", quiet = TRUE)
-saem_biphasic_s <- saem(mmkin_biphasic, transformations = "saemix", quiet = TRUE)
+dfop_saem_1 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin",
+ no_random_effect = c("parent_0", "g_qlogis"))
+parallel::stopCluster(cl)
diff --git a/tests/testthat/summary_hfit_sfo_tc.txt b/tests/testthat/summary_hfit_sfo_tc.txt
index 41743091..0618c715 100644
--- a/tests/testthat/summary_hfit_sfo_tc.txt
+++ b/tests/testthat/summary_hfit_sfo_tc.txt
@@ -8,7 +8,7 @@ Equations:
d_parent/dt = - k_parent * parent
Data:
-106 observations of 1 variable(s) grouped in 6 datasets
+95 observations of 1 variable(s) grouped in 6 datasets
Model predictions using solution type analytical
@@ -17,26 +17,35 @@ Using 300, 100 iterations and 9 chains
Variance model: Two-component variance function
-Mean of starting values for individual parameters:
+Starting values for degradation parameters:
parent_0 log_k_parent
- 101 -3
+ 94 -2
Fixed degradation parameter values:
None
+Starting values for random effects (square root of initial entries in omega):
+ parent_0 log_k_parent
+parent_0 4 0.0
+log_k_parent 0 0.7
+
+Starting values for error model parameters:
+a.1 b.1
+ 1 1
+
Results:
Likelihood computed by importance sampling
AIC BIC logLik
- 533 531 -261
+ 542 541 -266
Optimised parameters:
- est. lower upper
-parent_0 101.02 99.58 102.46
-log_k_parent -3.32 -3.53 -3.11
-a.1 0.91 0.64 1.17
-b.1 0.05 0.04 0.06
-SD.log_k_parent 0.27 0.11 0.42
+ est. lower upper
+parent_0 92.52 89.11 95.9
+log_k_parent -1.66 -2.07 -1.3
+a.1 2.03 1.60 2.5
+b.1 0.09 0.07 0.1
+SD.log_k_parent 0.51 0.22 0.8
Correlation:
pr_0
@@ -44,18 +53,18 @@ log_k_parent 0.1
Random effects:
est. lower upper
-SD.log_k_parent 0.3 0.1 0.4
+SD.log_k_parent 0.5 0.2 0.8
Variance model:
est. lower upper
-a.1 0.91 0.64 1.17
-b.1 0.05 0.04 0.06
+a.1 2.03 1.60 2.5
+b.1 0.09 0.07 0.1
Backtransformed parameters:
- est. lower upper
-parent_0 1e+02 1e+02 1e+02
-k_parent 4e-02 3e-02 4e-02
+ est. lower upper
+parent_0 92.5 89.1 95.9
+k_parent 0.2 0.1 0.3
Estimated disappearance times:
DT50 DT90
-parent 19 64
+parent 4 12
diff --git a/tests/testthat/summary_saem_biphasic_s.txt b/tests/testthat/summary_saem_dfop_sfo_s.txt
index 7c337843..6468ff17 100644
--- a/tests/testthat/summary_saem_biphasic_s.txt
+++ b/tests/testthat/summary_saem_dfop_sfo_s.txt
@@ -22,7 +22,7 @@ Using 300, 100 iterations and 4 chains
Variance model: Two-component variance function
-Mean of starting values for individual parameters:
+Starting values for degradation parameters:
parent_0 k_m1 f_parent_to_m1 k1 k2
1e+02 7e-03 5e-01 1e-01 2e-02
g
@@ -31,6 +31,19 @@ Mean of starting values for individual parameters:
Fixed degradation parameter values:
None
+Starting values for random effects (square root of initial entries in omega):
+ parent_0 k_m1 f_parent_to_m1 k1 k2 g
+parent_0 101 0 0 0 0 0
+k_m1 0 1 0 0 0 0
+f_parent_to_m1 0 0 1 0 0 0
+k1 0 0 0 1 0 0
+k2 0 0 0 0 1 0
+g 0 0 0 0 0 1
+
+Starting values for error model parameters:
+a.1 b.1
+ 1 1
+
Results:
Likelihood computed by importance sampling
diff --git a/tests/testthat/test_AIC.R b/tests/testthat/test_AIC.R
index 57b9a673..7e97904d 100644
--- a/tests/testthat/test_AIC.R
+++ b/tests/testthat/test_AIC.R
@@ -8,6 +8,6 @@ test_that("The AIC is reproducible", {
expect_error(AIC(fits["SFO", ]), "column object")
expect_error(BIC(fits["SFO", ]), "column object")
expect_equivalent(BIC(fits[, "FOCUS_C"]),
- data.frame(df = c(3, 4, 5, 5), AIC = c(59.9, 45.5, 30.0, 40.2)),
+ data.frame(df = c(3, 4, 5, 5), BIC = c(59.9, 45.5, 30.0, 40.2)),
scale = 1, tolerance = 0.1)
})
diff --git a/tests/testthat/test_dmta.R b/tests/testthat/test_dmta.R
index 5cfc61d2..825c6e80 100644
--- a/tests/testthat/test_dmta.R
+++ b/tests/testthat/test_dmta.R
@@ -11,13 +11,13 @@ names(dmta_ds) <- sapply(dimethenamid_2018$ds, function(ds) ds$title)
dmta_ds[["Elliot"]] <- rbind(dmta_ds[["Elliot 1"]], dmta_ds[["Elliot 2"]])
dmta_ds[["Elliot 1"]] <- dmta_ds[["Elliot 2"]] <- NULL
-# mkin
-dmta_dfop <- mmkin("DFOP", dmta_ds, quiet = TRUE, cores = n_cores)
-dmta_dfop_tc <- mmkin("DFOP", dmta_ds, error_model = "tc", quiet = TRUE, cores = n_cores)
-
test_that("Different backends get consistent results for DFOP tc, dimethenamid data", {
skip_on_cran() # Time constraints
+ # mkin
+ dmta_dfop <- mmkin("DFOP", dmta_ds, quiet = TRUE, cores = n_cores)
+ dmta_dfop_tc <- mmkin("DFOP", dmta_ds, error_model = "tc", quiet = TRUE, cores = n_cores)
+
# nlme
expect_warning(
nlme_dfop_tc <- nlme(dmta_dfop_tc),
diff --git a/tests/testthat/test_mhmkin.R b/tests/testthat/test_mhmkin.R
index 93333ac1..da063326 100644
--- a/tests/testthat/test_mhmkin.R
+++ b/tests/testthat/test_mhmkin.R
@@ -3,8 +3,11 @@ context("Batch fitting and diagnosing hierarchical kinetic models")
test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", {
skip_on_cran()
- fits_synth_const <- suppressWarnings(
- mmkin(c("SFO", "FOMC"), ds_sfo[1:6], cores = n_cores, quiet = TRUE))
+ fits_synth_const <- mmkin(c("SFO", "FOMC"), ds_fomc[1:6], cores = n_cores, quiet = TRUE)
+
+ expect_known_output(
+ print(fits_synth_const),
+ "print_fits_synth_const.txt")
fits_synth_tc <- suppressWarnings(
update(fits_synth_const, error_model = "tc"))
@@ -19,8 +22,8 @@ test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", {
print(illparms(hfits)),
"illparms_hfits_synth.txt")
- expect_equal(which.min(AIC(hfits)), 3)
- expect_equal(which.min(BIC(hfits)), 3)
+ expect_equal(which.min(AIC(hfits)), 4)
+ expect_equal(which.min(BIC(hfits)), 4)
hfit_sfo_tc <- update(hfits[["SFO", "tc"]],
covariance.model = diag(c(0, 1)))
@@ -38,22 +41,19 @@ test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", {
expect_known_output(print(test_summary, digits = 1),
"summary_hfit_sfo_tc.txt")
- # It depends on the platform exactly which of the datasets fail to converge
- # with FOMC, because they were generated to be SFO
- skip_on_travis()
-
- expect_known_output(
- print(fits_synth_const),
- "print_fits_synth_const.txt")
-
- hfits_no_ranef_auto <- update(hfits, no_random_effect = "auto", auto_ranef_threshold = 2)
-
- expect_known_output(
- print(hfits_no_ranef_auto),
- "print_hfits_synth_no_ranef_auto.txt")
-
- expect_known_output(
- print(illparms(hfits_no_ranef_auto)),
- "illparms_hfits_synth_no_ranef_auto.txt")
-
+ hfits_sfo_reduced <- update(hfits,
+ no_random_effect = illparms(hfits))
+ expect_equal(
+ as.character(illparms(hfits_sfo_reduced)),
+ rep("", 4))
+
+ # We can also manually set up an object specifying random effects to be
+ # excluded. Entries in the inital list have to be by column
+ no_ranef <- list("parent_0", "log_beta", "parent_0", c("parent_0", "log_beta"))
+ dim(no_ranef) <- c(2, 2)
+
+ hfits_sfo_reduced_2 <- update(hfits,
+ no_random_effect = no_ranef)
+ expect_equivalent(round(anova(hfits_sfo_reduced), 0),
+ round(anova(hfits_sfo_reduced_2), 0))
})
diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R
index 646b6110..39a332f5 100644
--- a/tests/testthat/test_mixed.R
+++ b/tests/testthat/test_mixed.R
@@ -1,17 +1,24 @@
context("Nonlinear mixed-effects models")
+
# Round error model parameters as they are not rounded in print methods
dfop_nlme_1$modelStruct$varStruct$const <-
signif(dfop_nlme_1$modelStruct$varStruct$const, 3)
dfop_nlme_1$modelStruct$varStruct$prop <-
signif(dfop_nlme_1$modelStruct$varStruct$prop, 4)
+dfop_sfo_pop <- attr(ds_dfop_sfo, "pop")
+
test_that("Print methods work", {
expect_known_output(print(fits[, 2:3], digits = 2), "print_mmkin_parent.txt")
expect_known_output(print(mixed(mmkin_sfo_1), digits = 2), "print_mmkin_sfo_1_mixed.txt")
expect_known_output(print(dfop_nlme_1, digits = 1), "print_dfop_nlme_1.txt")
+ expect_known_output(print(sfo_saem_1_reduced, digits = 1), "print_sfo_saem_1_reduced.txt")
- expect_known_output(print(dfop_saemix_1, digits = 1), "print_dfop_saemix_1.txt")
+ skip_on_cran() # The following test is platform dependent and fails on
+ # win-builder with current (18 Nov 2022) R-devel, on the Linux R-devel CRAN check systems
+ # and also using R-devel locally
+ expect_known_output(print(dfop_saem_1, digits = 1), "print_dfop_saem_1.txt")
})
test_that("nlme results are reproducible to some degree", {
@@ -31,17 +38,19 @@ test_that("nlme results are reproducible to some degree", {
# k1 and k2 just fail the first test (lower bound of the ci), so we need to exclude it
dfop_no_k1_k2 <- c("parent_0", "k_m1", "f_parent_to_m1", "g")
dfop_sfo_pop_no_k1_k2 <- as.numeric(dfop_sfo_pop[dfop_no_k1_k2])
- dfop_sfo_pop <- as.numeric(dfop_sfo_pop) # to remove names
- ci_dfop_sfo_n <- summary(nlme_biphasic)$confint_back
+ ci_dfop_sfo_n <- summary(nlme_dfop_sfo)$confint_back
expect_true(all(ci_dfop_sfo_n[dfop_no_k1_k2, "lower"] < dfop_sfo_pop_no_k1_k2))
- expect_true(all(ci_dfop_sfo_n[, "upper"] > dfop_sfo_pop))
+ expect_true(all(ci_dfop_sfo_n[, "upper"] > as.numeric(dfop_sfo_pop)))
})
test_that("saemix results are reproducible for biphasic fits", {
- test_summary <- summary(saem_biphasic_s)
+ skip_on_cran()
+ saem_dfop_sfo_s <- saem(mmkin_dfop_sfo, transformations = "saemix", quiet = TRUE)
+
+ test_summary <- summary(saem_dfop_sfo_s)
test_summary$saemixversion <- "Dummy 0.0 for testing"
test_summary$mkinversion <- "Dummy 0.0 for testing"
test_summary$Rversion <- "Dummy R version for testing"
@@ -49,33 +58,28 @@ test_that("saemix results are reproducible for biphasic fits", {
test_summary$date.summary <- "Dummy date for testing"
test_summary$time <- c(elapsed = "test time 0")
- expect_known_output(print(test_summary, digits = 1), "summary_saem_biphasic_s.txt")
+ expect_known_output(print(test_summary, digits = 1), "summary_saem_dfop_sfo_s.txt")
dfop_sfo_pop <- as.numeric(dfop_sfo_pop)
no_k1 <- c(1, 2, 3, 5, 6)
no_k2 <- c(1, 2, 3, 4, 6)
no_k1_k2 <- c(1, 2, 3, 6)
- ci_dfop_sfo_s_s <- summary(saem_biphasic_s)$confint_back
+ ci_dfop_sfo_s_s <- summary(saem_dfop_sfo_s)$confint_back
expect_true(all(ci_dfop_sfo_s_s[, "lower"] < dfop_sfo_pop))
expect_true(all(ci_dfop_sfo_s_s[, "upper"] > dfop_sfo_pop))
- # k2 is not fitted well
- ci_dfop_sfo_s_m <- summary(saem_biphasic_m)$confint_back
- expect_true(all(ci_dfop_sfo_s_m[no_k2, "lower"] < dfop_sfo_pop[no_k2]))
- expect_true(all(ci_dfop_sfo_s_m[no_k1, "upper"] > dfop_sfo_pop[no_k1]))
-
# I tried to only do few iterations in routine tests as this is so slow
# but then deSolve fails at some point (presumably at the switch between
# the two types of iterations)
- #saem_biphasic_2 <- saem(mmkin_biphasic, solution_type = "deSolve",
+ #saem_dfop_sfo_2 <- saem(mmkin_biphasic, solution_type = "deSolve",
# control = list(nbiter.saemix = c(10, 5), nbiter.burn = 5), quiet = TRUE)
skip("Fitting with saemix takes around 10 minutes when using deSolve")
- saem_biphasic_2 <- saem(mmkin_biphasic, solution_type = "deSolve", quiet = TRUE)
+ saem_dfop_sfo_2 <- saem(mmkin_dfop_sfo, solution_type = "deSolve", quiet = TRUE)
# As with the analytical solution, k1 and k2 are not fitted well
- ci_dfop_sfo_s_d <- summary(saem_biphasic_2)$confint_back
+ ci_dfop_sfo_s_d <- summary(saem_dfop_sfo_2)$confint_back
expect_true(all(ci_dfop_sfo_s_d[no_k2, "lower"] < dfop_sfo_pop[no_k2]))
expect_true(all(ci_dfop_sfo_s_d[no_k1, "upper"] > dfop_sfo_pop[no_k1]))
})
diff --git a/tests/testthat/test_multistart.R b/tests/testthat/test_multistart.R
index c1a10d10..dda0ea23 100644
--- a/tests/testthat/test_multistart.R
+++ b/tests/testthat/test_multistart.R
@@ -1,41 +1,57 @@
context("Multistart method for saem.mmkin models")
test_that("multistart works for saem.mmkin models", {
+ skip_on_cran() # Save CRAN time
set.seed(123456)
- saem_sfo_s_multi <- multistart(sfo_saem_1_reduced, n = 8, cores = n_cores,
- no_random_effect = "parent_0")
+ saem_sfo_s_multi <- multistart(sfo_saem_1_reduced, n = 8, cores = n_cores)
+
anova_sfo <- anova(sfo_saem_1,
sfo_saem_1_reduced,
best(saem_sfo_s_multi),
test = TRUE
)
- expect_true(anova_sfo[3, "Pr(>Chisq)"] > 0.5)
+ expect_equal(round(anova_sfo, 1)["sfo_saem_1_reduced", "AIC"], 1302.2)
+ expect_equal(round(anova_sfo, 1)["best(saem_sfo_s_multi)", "AIC"], 1302.2)
+ expect_true(anova_sfo[3, "Pr(>Chisq)"] > 0.2) # Local: 1, win-builder: 0.4
+
+ saem_dfop_sfo_m <- saem(mmkin_dfop_sfo, transformations = "mkin", quiet = TRUE)
+ dfop_sfo_pop <- attr(ds_dfop_sfo, "pop")
+
+ # k2 is not fitted well (compare saem_dfop_sfo_s in test_mixed.R)
+ ci_dfop_sfo_s_m <- summary(saem_dfop_sfo_m)$confint_back
+ no_k1 <- c(1, 2, 3, 5, 6)
+ no_k2 <- c(1, 2, 3, 4, 6)
+ expect_true(all(ci_dfop_sfo_s_m[no_k2, "lower"] < dfop_sfo_pop[no_k2]))
+ expect_true(all(ci_dfop_sfo_s_m[no_k1, "upper"] > dfop_sfo_pop[no_k1]))
+
- skip_on_cran() # Save CRAN time
set.seed(123456)
- saem_biphasic_m_multi <- multistart(saem_biphasic_m, n = 8,
+ saem_dfop_sfo_m_multi <- multistart(saem_dfop_sfo_m, n = 8,
cores = n_cores)
- expect_known_output(print(saem_biphasic_m_multi),
- file = "print_multistart_biphasic.txt")
+ expect_known_output(print(saem_dfop_sfo_m_multi),
+ file = "print_multistart_dfop_sfo.txt")
- anova_biphasic <- anova(saem_biphasic_m,
- best(saem_biphasic_m_multi))
+ anova_dfop_sfo <- anova(saem_dfop_sfo_m,
+ best(saem_dfop_sfo_m_multi))
# With the new starting parameters we do not improve
# with multistart any more
- expect_equal(anova_biphasic[2, "AIC"], anova_biphasic[1, "AIC"],
+ expect_equal(anova_dfop_sfo[2, "AIC"], anova_dfop_sfo[1, "AIC"],
tolerance = 1e-4)
skip_on_travis() # Plots are platform dependent
+ plot_dfop_sfo_saem_m <- function() plot(saem_dfop_sfo_m)
+ vdiffr::expect_doppelganger("mixed model fit for saem object with mkin transformations", plot_dfop_sfo_saem_m)
+
llhist_sfo <- function() llhist(saem_sfo_s_multi)
parplot_sfo <- function() parplot(saem_sfo_s_multi, ylim = c(0.5, 2))
vdiffr::expect_doppelganger("llhist for sfo fit", llhist_sfo)
vdiffr::expect_doppelganger("parplot for sfo fit", parplot_sfo)
- llhist_biphasic <- function() llhist(saem_biphasic_m_multi)
- parplot_biphasic <- function() parplot(saem_biphasic_m_multi,
- ylim = c(0.5, 2))
+ llhist_dfop_sfo <- function() llhist(saem_dfop_sfo_m_multi)
+ parplot_dfop_sfo <- function() parplot(saem_dfop_sfo_m_multi,
+ ylim = c(0.5, 2), llquant = 0.5)
- vdiffr::expect_doppelganger("llhist for biphasic saemix fit", llhist_biphasic)
- vdiffr::expect_doppelganger("parplot for biphasic saemix fit", parplot_biphasic)
+ vdiffr::expect_doppelganger("llhist for dfop sfo fit", llhist_dfop_sfo)
+ vdiffr::expect_doppelganger("parplot for dfop sfo fit", parplot_dfop_sfo)
})
diff --git a/tests/testthat/test_nafta.R b/tests/testthat/test_nafta.R
index 8eb052c5..b89ea342 100644
--- a/tests/testthat/test_nafta.R
+++ b/tests/testthat/test_nafta.R
@@ -4,6 +4,7 @@ test_that("Data for more than one compound are rejected",
expect_error(nafta(FOCUS_2006_D, cores = 1)))
test_that("Test data from Appendix B are correctly evaluated", {
+ skip_on_cran()
expect_message(res <- nafta(NAFTA_SOP_Appendix_B, "aerobic aquatic", cores = 1))
# From Figure D.1
@@ -25,6 +26,7 @@ test_that("Test data from Appendix B are correctly evaluated", {
})
test_that("Test data from Appendix D are correctly evaluated", {
+ skip_on_cran()
# We are not interested in the warnings about non-normal residuals here
suppressWarnings(
res <- nafta(NAFTA_SOP_Appendix_D, "MRID 555555",
diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R
index 13058c00..f5da5982 100644
--- a/tests/testthat/test_plot.R
+++ b/tests/testthat/test_plot.R
@@ -41,27 +41,23 @@ test_that("Plotting mkinfit, mmkin and mixed model objects is reproducible", {
f_uba_mmkin <- mmkin(list("DFOP-SFO" = dfop_sfo_uba),
ds_uba, quiet = TRUE, cores = n_cores)
f_uba_dfop_sfo_mixed <- mixed(f_uba_mmkin["DFOP-SFO", ])
-
f_uba_dfop_sfo_saem <- saem(f_uba_mmkin["DFOP-SFO", ], quiet = TRUE, transformations = "saemix")
- plot_biphasic_mmkin <- function() plot(f_uba_dfop_sfo_mixed, pop_curve = TRUE)
- vdiffr::expect_doppelganger("mixed model fit for mmkin object", plot_biphasic_mmkin)
+ plot_dfop_sfo_mmkin <- function() plot(f_uba_dfop_sfo_mixed, pop_curve = TRUE)
+ vdiffr::expect_doppelganger("mixed model fit for mmkin object", plot_dfop_sfo_mmkin)
- plot_biphasic_saem_s <- function() plot(f_uba_dfop_sfo_saem)
- vdiffr::expect_doppelganger("mixed model fit for saem object with saemix transformations", plot_biphasic_saem_s)
+ plot_dfop_sfo_saem_s <- function() plot(f_uba_dfop_sfo_saem)
+ vdiffr::expect_doppelganger("mixed model fit for saem object with saemix transformations", plot_dfop_sfo_saem_s)
skip_on_travis()
- plot_biphasic_nlme <- function() plot(dfop_nlme_1)
- vdiffr::expect_doppelganger("mixed model fit for nlme object", plot_biphasic_nlme)
+ plot_dfop_sfo_nlme <- function() plot(dfop_nlme_1)
+ vdiffr::expect_doppelganger("mixed model fit for nlme object", plot_dfop_sfo_nlme)
- #plot_biphasic_mmkin <- function() plot(mixed(mmkin_biphasic))
+ #plot_dfop_sfo_mmkin <- function() plot(mixed(mmkin_dfop_sfo))
# Biphasic fits with lots of data and fits have lots of potential for differences
- plot_biphasic_nlme <- function() plot(nlme_biphasic)
- #plot_biphasic_saem_s <- function() plot(saem_biphasic_s)
- plot_biphasic_saem_m <- function() plot(saem_biphasic_m)
-
- vdiffr::expect_doppelganger("mixed model fit for saem object with mkin transformations", plot_biphasic_saem_m)
+ plot_dfop_sfo_nlme <- function() plot(nlme_dfop_sfo)
+ #plot_dfop_sfo_saem_s <- function() plot(saem_dfop_sfo_s)
# different results when working with eigenvalues
plot_errmod_fit_D_obs_eigen <- function() plot_err(fit_D_obs_eigen, sep_obs = FALSE)
diff --git a/tests/testthat/test_saemix_parent.R b/tests/testthat/test_saemix_parent.R
index 20889c6c..7fbecd0c 100644
--- a/tests/testthat/test_saemix_parent.R
+++ b/tests/testthat/test_saemix_parent.R
@@ -15,7 +15,7 @@ test_that("Parent fits using saemix are correctly implemented", {
expect_silent(print(illparms(sfo_saem_1_reduced)))
# We cannot currently do the fit with completely fixed initial values
- mmkin_sfo_2 <- update(mmkin_sfo_1, fixed_initials = c(parent = 100))
+ mmkin_sfo_2 <- update(mmkin_sfo_1, fixed_initials = c(parent = 100), cluster = NULL, cores = n_cores)
sfo_saem_3 <- expect_error(saem(mmkin_sfo_2, quiet = TRUE), "at least two parameters")
# We get an error if we do not supply a suitable model specification
@@ -38,11 +38,11 @@ test_that("Parent fits using saemix are correctly implemented", {
s_sfo_nlme_1 <- summary(sfo_nlme_1)
# Compare with input
- expect_equal(round(s_sfo_saem_1$confint_ranef["SD.k_parent", "est."], 1), 0.3)
- expect_equal(round(s_sfo_saem_1_mkin$confint_ranef["SD.log_k_parent", "est."], 1), 0.3)
+ expect_equal(round(s_sfo_saem_1$confint_ranef["SD.k_parent", "est."], 1), 0.3, tol = 0.1)
+ expect_equal(round(s_sfo_saem_1_mkin$confint_ranef["SD.log_k_parent", "est."], 1), 0.3, tol = 0.1)
# k_parent is a bit different from input 0.03 here
- expect_equal(round(s_sfo_saem_1$confint_back["k_parent", "est."], 3), 0.035)
- expect_equal(round(s_sfo_saem_1_mkin$confint_back["k_parent", "est."], 3), 0.035)
+ expect_equal(round(s_sfo_saem_1$confint_back["k_parent", "est."], 3), 0.033)
+ expect_equal(round(s_sfo_saem_1_mkin$confint_back["k_parent", "est."], 3), 0.033)
# But the result is pretty unanimous between methods
expect_equal(round(s_sfo_saem_1_reduced$confint_back["k_parent", "est."], 3),
@@ -74,7 +74,7 @@ test_that("Parent fits using saemix are correctly implemented", {
mmkin_fomc_1 <- mmkin("FOMC", ds_fomc, quiet = TRUE, error_model = "tc", cores = n_cores)
fomc_saem_1 <- saem(mmkin_fomc_1, quiet = TRUE, transformations = "saemix", no_random_effect = "parent_0")
- fomc_pop <- as.numeric(fomc_pop)
+ fomc_pop <- as.numeric(attr(ds_fomc, "pop"))
ci_fomc_s1 <- summary(fomc_saem_1)$confint_back
expect_true(all(ci_fomc_s1[, "lower"] < fomc_pop))
expect_true(all(ci_fomc_s1[, "upper"] > fomc_pop))
@@ -87,14 +87,14 @@ test_that("Parent fits using saemix are correctly implemented", {
expect_equal(endpoints(fomc_saem_1), endpoints(fomc_saem_2), tol = 0.01)
# DFOP
- dfop_saemix_2 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "saemix",
+ dfop_saem_2 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "saemix",
no_random_effect = "parent_0")
- s_dfop_s1 <- summary(dfop_saemix_1) # mkin transformations
- s_dfop_s2 <- summary(dfop_saemix_2) # saemix transformations
+ s_dfop_s1 <- summary(dfop_saem_1) # mkin transformations
+ s_dfop_s2 <- summary(dfop_saem_2) # saemix transformations
s_dfop_n <- summary(dfop_nlme_1)
- dfop_pop <- as.numeric(dfop_pop)
+ dfop_pop <- as.numeric(attr(ds_dfop, "pop"))
expect_true(all(s_dfop_s1$confint_back[, "lower"] < dfop_pop))
expect_true(all(s_dfop_s1$confint_back[, "upper"] > dfop_pop))
@@ -111,18 +111,18 @@ test_that("Parent fits using saemix are correctly implemented", {
# SFORB
mmkin_sforb_1 <- mmkin("SFORB", ds_dfop, quiet = TRUE, cores = n_cores)
- sforb_saemix_1 <- saem(mmkin_sforb_1, quiet = TRUE,
+ sforb_saem_1 <- saem(mmkin_sforb_1, quiet = TRUE,
no_random_effect = c("parent_free_0"),
transformations = "mkin")
- sforb_saemix_2 <- saem(mmkin_sforb_1, quiet = TRUE,
+ sforb_saem_2 <- saem(mmkin_sforb_1, quiet = TRUE,
no_random_effect = c("parent_free_0"),
transformations = "saemix")
expect_equal(
- log(endpoints(dfop_saemix_1)$distimes[1:2]),
- log(endpoints(sforb_saemix_1)$distimes[1:2]), tolerance = 0.01)
+ log(endpoints(dfop_saem_1)$distimes[1:2]),
+ log(endpoints(sforb_saem_1)$distimes[1:2]), tolerance = 0.01)
expect_equal(
- log(endpoints(sforb_saemix_1)$distimes[1:2]),
- log(endpoints(sforb_saemix_2)$distimes[1:2]), tolerance = 0.01)
+ log(endpoints(sforb_saem_1)$distimes[1:2]),
+ log(endpoints(sforb_saem_2)$distimes[1:2]), tolerance = 0.01)
mmkin_hs_1 <- mmkin("HS", ds_hs, quiet = TRUE, error_model = "const", cores = n_cores)
hs_saem_1 <- saem(mmkin_hs_1, quiet = TRUE, no_random_effect = "parent_0")
@@ -131,7 +131,7 @@ test_that("Parent fits using saemix are correctly implemented", {
expect_equal(endpoints(hs_saem_1), endpoints(hs_saem_2), tol = 0.01)
ci_hs_s1 <- summary(hs_saem_1)$confint_back
- hs_pop <- as.numeric(hs_pop)
+ hs_pop <- as.numeric(attr(ds_hs, "pop"))
#expect_true(all(ci_hs_s1[, "lower"] < hs_pop)) # k1 is overestimated
expect_true(all(ci_hs_s1[, "upper"] > hs_pop))
})
@@ -141,10 +141,10 @@ test_that("We can also use mkin solution methods for saem", {
"saemix transformations is only supported if an analytical solution is implemented"
)
skip("This still takes almost 2.5 minutes although we do not solve ODEs")
- dfop_saemix_3 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin",
- solution_type = "analytical", no_random_effect = "parent_0")
- distimes_dfop <- endpoints(dfop_saemix_1)$distimes
- distimes_dfop_analytical <- endpoints(dfop_saemix_3)$distimes
+ dfop_saem_3 <- saem(mmkin_dfop_1, quiet = TRUE, transformations = "mkin",
+ solution_type = "analytical", no_random_effect = c("parent_0", "g_qlogis"))
+ distimes_dfop <- endpoints(dfop_saem_1)$distimes
+ distimes_dfop_analytical <- endpoints(dfop_saem_3)$distimes
rel_diff <- abs(distimes_dfop_analytical - distimes_dfop) / distimes_dfop
expect_true(all(rel_diff < 0.01))
})

Contact - Imprint