aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-10-26 08:40:58 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2022-10-26 08:40:58 +0200
commit06df20703a9390692ab1ece3ae1702a71fff05ae (patch)
tree29b5adc2cc8dbb24ae70b5f2e0d95459dbc7497e /tests
parent36dd8f47c147ed64874c88c9914a1ab4850a72cc (diff)
Remove kernel density estimate from llhist
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg33
-rw-r--r--tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg65
-rw-r--r--tests/testthat/test_multistart.R5
3 files changed, 86 insertions, 17 deletions
diff --git a/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg b/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg
index 4767e229..fa92c92a 100644
--- a/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg
+++ b/tests/testthat/_snaps/multistart/llhist-for-biphasic-saemix-fit.svg
@@ -19,15 +19,17 @@
</defs>
<g clip-path='url(#cpMC4wMHw3MjAuMDB8MC4wMHw1NzYuMDA=)'>
<text transform='translate(12.96,280.80) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='148.77px' lengthAdjust='spacingAndGlyphs'>Frequency of log likelihoods</text>
-<line x1='147.59' y1='502.56' x2='598.15' y2='502.56' style='stroke-width: 0.75;' />
-<line x1='147.59' y1='502.56' x2='147.59' y2='509.76' style='stroke-width: 0.75;' />
-<line x1='297.78' y1='502.56' x2='297.78' y2='509.76' style='stroke-width: 0.75;' />
-<line x1='447.97' y1='502.56' x2='447.97' y2='509.76' style='stroke-width: 0.75;' />
-<line x1='598.15' y1='502.56' x2='598.15' y2='509.76' style='stroke-width: 0.75;' />
-<text x='147.59' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1190</text>
-<text x='297.78' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1180</text>
-<text x='447.97' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1170</text>
-<text x='598.15' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1160</text>
+<line x1='82.40' y1='502.56' x2='666.40' y2='502.56' style='stroke-width: 0.75;' />
+<line x1='82.40' y1='502.56' x2='82.40' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='228.40' y1='502.56' x2='228.40' y2='509.76' style='stroke-width: 0.75;' />
+<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='30.69px' lengthAdjust='spacingAndGlyphs'>-1185</text>
+<text x='228.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1180</text>
+<text x='374.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1175</text>
+<text x='520.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1170</text>
+<text x='666.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='30.69px' lengthAdjust='spacingAndGlyphs'>-1165</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;' />
@@ -44,14 +46,11 @@
</clipPath>
</defs>
<g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'>
-<rect x='222.68' y='349.24' width='75.09' height='136.89' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<rect x='297.78' y='75.47' width='75.09' height='410.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<rect x='372.87' y='212.36' width='75.09' height='273.78' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<rect x='447.97' y='212.36' width='75.09' height='273.78' style='stroke-width: 0.75; fill: #D3D3D3;' />
-<polyline points='82.40,486.11 83.86,486.10 85.32,486.10 86.78,486.10 88.24,486.09 89.70,486.09 91.16,486.08 92.62,486.07 94.08,486.07 95.54,486.06 97.00,486.05 98.46,486.04 99.92,486.03 101.38,486.02 102.84,486.01 104.30,486.00 105.76,485.98 107.22,485.97 108.68,485.95 110.14,485.93 111.60,485.91 113.06,485.89 114.52,485.86 115.98,485.82 117.44,485.77 118.90,485.74 120.36,485.70 121.82,485.66 123.28,485.61 124.74,485.56 126.20,485.50 127.66,485.44 129.12,485.38 130.58,485.31 132.04,485.21 133.50,485.11 134.96,485.00 136.42,484.89 137.88,484.78 139.34,484.66 140.80,484.53 142.26,484.38 143.72,484.23 145.18,484.06 146.64,483.89 148.10,483.69 149.56,483.49 151.02,483.27 152.48,483.03 153.94,482.77 155.40,482.50 156.86,482.21 158.32,481.90 159.78,481.56 161.24,481.20 162.70,480.82 164.16,480.41 165.62,479.98 167.08,479.52 168.54,479.03 170.00,478.51 171.46,477.95 172.92,477.36 174.38,476.74 175.84,476.07 177.30,475.37 178.76,474.63 180.22,473.85 181.68,473.02 183.14,472.15 184.60,471.22 186.06,470.25 187.52,469.23 188.98,468.15 190.44,467.02 191.90,465.83 193.36,464.59 194.82,463.28 196.28,461.91 197.74,460.44 199.20,458.94 200.66,457.37 202.12,455.72 203.58,454.01 205.04,452.22 206.50,450.35 207.96,448.41 209.42,446.39 210.88,444.29 212.34,442.11 213.80,439.85 215.26,437.50 216.72,435.07 218.18,432.55 219.64,429.94 221.10,427.25 222.56,424.47 224.02,421.60 225.48,418.64 226.94,415.59 228.40,412.46 229.86,409.23 231.32,405.92 232.78,402.52 234.24,399.00 235.70,395.42 237.16,391.76 238.62,388.01 240.08,384.17 241.54,380.26 243.00,376.27 244.46,372.20 245.92,368.05 247.38,363.83 248.84,359.54 250.30,355.19 251.76,350.74 253.22,346.26 254.68,341.72 256.14,337.13 257.60,332.46 259.06,327.77 260.52,323.03 261.98,318.26 263.44,313.46 264.90,308.64 266.36,303.78 267.82,298.92 269.28,294.04 270.74,289.15 272.20,284.26 273.66,279.38 275.12,274.51 276.58,269.65 278.04,264.82 279.50,260.01 280.96,255.24 282.42,250.51 283.88,245.82 285.34,241.18 286.80,236.60 288.26,232.08 289.72,227.63 291.18,223.26 292.64,218.96 294.10,214.75 295.56,210.62 297.02,206.59 298.48,202.66 299.94,198.84 301.40,195.12 302.86,191.51 304.32,188.01 305.78,184.64 307.24,181.39 308.70,178.26 310.16,175.26 311.62,172.39 313.08,169.65 314.54,167.04 316.00,164.57 317.46,162.23 318.92,160.03 320.38,157.97 321.84,156.04 323.30,154.24 324.76,152.58 326.22,151.05 327.68,149.65 329.14,148.38 330.60,147.23 332.06,146.21 333.52,145.31 334.98,144.53 336.44,143.86 337.90,143.30 339.36,142.84 340.82,142.49 342.28,142.23 343.74,142.06 345.20,141.98 346.66,141.99 348.12,142.06 349.58,142.21 351.04,142.42 352.50,142.70 353.96,143.02 355.42,143.39 356.88,143.81 358.34,144.26 359.80,144.75 361.26,145.26 362.72,145.79 364.18,146.34 365.64,146.89 367.10,147.46 368.56,148.02 370.02,148.58 371.48,149.13 372.94,149.68 374.40,150.20 375.86,150.71 377.32,151.20 378.78,151.67 380.24,152.11 381.70,152.52 383.16,152.90 384.62,153.26 386.08,153.58 387.54,153.87 389.00,154.14 390.46,154.37 391.92,154.57 393.38,154.74 394.84,154.89 396.30,155.01 397.76,155.11 399.22,155.19 400.68,155.26 402.14,155.31 403.60,155.35 405.06,155.38 406.52,155.42 407.98,155.45 409.44,155.49 410.90,155.55 412.36,155.62 413.82,155.72 415.28,155.84 416.74,156.00 418.20,156.19 419.66,156.43 421.12,156.72 422.58,157.06 424.04,157.47 425.50,157.94 426.96,158.48 428.42,159.10 429.88,159.80 431.34,160.58 432.80,161.46 434.26,162.43 435.72,163.51 437.18,164.69 438.64,165.97 440.10,167.37 441.56,168.88 443.02,170.51 444.48,172.26 445.94,174.13 447.40,176.13 448.86,178.25 450.32,180.50 451.78,182.87 453.24,185.37 454.70,188.00 456.16,190.76 457.62,193.64 459.08,196.65 460.54,199.78 462.00,203.03 463.46,206.40 464.92,209.88 466.38,213.48 467.84,217.19 469.30,221.00 470.76,224.92 472.22,228.94 473.68,233.04 475.14,237.24 476.60,241.52 478.06,245.87 479.52,250.30 480.98,254.80 482.44,259.36 483.90,263.97 485.36,268.63 486.82,273.34 488.28,278.08 489.74,282.86 491.20,287.65 492.66,292.49 494.12,297.32 495.58,302.16 497.04,306.99 498.50,311.82 499.96,316.64 501.42,321.44 502.88,326.21 504.34,330.96 505.80,335.68 507.26,340.35 508.72,344.98 510.18,349.56 511.64,354.09 513.10,358.57 514.56,362.98 516.02,367.32 517.48,371.59 518.94,375.80 520.40,379.92 521.86,383.97 523.32,387.93 524.78,391.82 526.24,395.62 527.70,399.34 529.16,402.96 530.62,406.48 532.08,409.91 533.54,413.25 535.00,416.50 536.46,419.65 537.92,422.70 539.38,425.66 540.84,428.53 542.30,431.32 543.76,434.01 545.22,436.61 546.68,439.10 548.14,441.50 549.60,443.81 551.06,446.03 552.52,448.16 553.98,450.21 555.44,452.17 556.90,454.05 558.36,455.85 559.82,457.57 561.28,459.21 562.74,460.78 564.20,462.28 565.66,463.70 567.12,465.06 568.58,466.35 570.04,467.57 571.50,468.74 572.96,469.84 574.42,470.88 575.88,471.87 577.34,472.81 578.80,473.69 580.26,474.52 581.72,475.31 583.18,476.05 584.64,476.75 586.10,477.41 587.56,478.02 589.02,478.60 590.48,479.15 591.94,479.65 593.40,480.13 594.86,480.58 596.32,480.99 597.78,481.38 599.24,481.75 600.70,482.09 602.16,482.40 603.62,482.70 605.08,482.97 606.54,483.22 608.00,483.48 609.46,483.70 610.92,483.90 612.38,484.08 613.84,484.25 615.30,484.41 616.76,484.56 618.22,484.69 619.68,484.82 621.14,484.93 622.60,485.04 624.06,485.14 625.52,485.22 626.98,485.31 628.44,485.38 629.90,485.45 631.36,485.51 632.82,485.57 634.28,485.62 635.74,485.67 637.20,485.72 638.66,485.76 640.12,485.79 641.58,485.83 643.04,485.86 644.50,485.91 645.96,485.93 647.42,485.95 648.88,485.97 650.34,485.98 651.80,486.00 653.26,486.01 654.72,486.03 656.18,486.04 657.64,486.05 659.10,486.06 660.56,486.07 662.02,486.10 663.48,486.10 664.94,486.10 666.40,486.11 ' style='stroke-width: 0.75;' />
+<rect x='82.40' y='349.24' width='146.00' height='136.89' 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='212.36' width='146.00' height='273.78' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='520.40' y='212.36' width='146.00' height='273.78' style='stroke-width: 0.75; fill: #D3D3D3;' />
<line x1='101.38' y1='95.62' x2='122.98' y2='95.62' style='stroke-width: 0.75; stroke: #DF536B;' />
-<line x1='101.38' y1='110.02' x2='122.98' y2='110.02' style='stroke-width: 0.75;' />
-<text x='133.78' y='99.75' style='font-size: 12.00px; font-family: sans;' textLength='111.40px' lengthAdjust='spacingAndGlyphs'>original log likelihood</text>
-<text x='133.78' y='114.15' style='font-size: 12.00px; font-family: sans;' textLength='122.75px' lengthAdjust='spacingAndGlyphs'>kernel density estimate</text>
+<text x='133.78' y='99.75' style='font-size: 12.00px; font-family: sans;' textLength='51.35px' lengthAdjust='spacingAndGlyphs'>original fit</text>
</g>
</svg>
diff --git a/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg b/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg
new file mode 100644
index 00000000..21fa8af8
--- /dev/null
+++ b/tests/testthat/_snaps/multistart/llhist-for-sfo-fit.svg
@@ -0,0 +1,65 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' class='svglite' data-engine-version='2.0' width='720.00pt' height='576.00pt' viewBox='0 0 720.00 576.00'>
+<defs>
+ <style type='text/css'><![CDATA[
+ .svglite line, .svglite polyline, .svglite polygon, .svglite path, .svglite rect, .svglite circle {
+ fill: none;
+ stroke: #000000;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ stroke-miterlimit: 10.00;
+ }
+ ]]></style>
+</defs>
+<rect width='100%' height='100%' style='stroke: none; fill: #FFFFFF;'/>
+<defs>
+ <clipPath id='cpMC4wMHw3MjAuMDB8MC4wMHw1NzYuMDA='>
+ <rect x='0.00' y='0.00' width='720.00' height='576.00' />
+ </clipPath>
+</defs>
+<g clip-path='url(#cpMC4wMHw3MjAuMDB8MC4wMHw1NzYuMDA=)'>
+<text transform='translate(12.96,280.80) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='148.77px' lengthAdjust='spacingAndGlyphs'>Frequency of log likelihoods</text>
+<line x1='666.40' y1='502.56' x2='82.40' y2='502.56' style='stroke-width: 0.75;' />
+<line x1='666.40' y1='502.56' x2='666.40' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='569.07' y1='502.56' x2='569.07' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='471.73' y1='502.56' x2='471.73' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='374.40' y1='502.56' x2='374.40' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='277.07' y1='502.56' x2='277.07' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='179.73' y1='502.56' x2='179.73' y2='509.76' style='stroke-width: 0.75;' />
+<line x1='82.40' y1='502.56' x2='82.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='34.03px' lengthAdjust='spacingAndGlyphs'>-644.0</text>
+<text x='179.73' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='34.03px' lengthAdjust='spacingAndGlyphs'>-644.5</text>
+<text x='277.07' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='34.03px' lengthAdjust='spacingAndGlyphs'>-645.0</text>
+<text x='374.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='34.03px' lengthAdjust='spacingAndGlyphs'>-645.5</text>
+<text x='471.73' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='34.03px' lengthAdjust='spacingAndGlyphs'>-646.0</text>
+<text x='569.07' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='34.03px' lengthAdjust='spacingAndGlyphs'>-646.5</text>
+<text x='666.40' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: sans;' textLength='34.03px' lengthAdjust='spacingAndGlyphs'>-647.0</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='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='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=='>
+ <rect x='59.04' y='59.04' width='630.72' height='443.52' />
+ </clipPath>
+</defs>
+<g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'>
+<rect x='1201.73' y='280.80' width='9.73' height='205.33' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='1192.00' y='75.47' width='9.73' height='410.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='1182.27' y='486.13' width='9.73' height='0.00' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='1172.53' y='383.47' width='9.73' height='102.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='1162.80' y='486.13' width='9.73' height='0.00' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<rect x='1153.07' y='383.47' width='9.73' height='102.67' style='stroke-width: 0.75; fill: #D3D3D3;' />
+<line x1='1231.05' y1='502.56' x2='1231.05' 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>
+</svg>
diff --git a/tests/testthat/test_multistart.R b/tests/testthat/test_multistart.R
index 2c7a2bc0..60fdefdc 100644
--- a/tests/testthat/test_multistart.R
+++ b/tests/testthat/test_multistart.R
@@ -1,6 +1,11 @@
context("Multistart method for saem.mmkin models")
test_that("multistart works for saem.mmkin models", {
+ saem_sfo_s_multi <- multistart(sfo_saem_1, n = 8, cores = n_cores)
+
+ llhist_sfo <- function() llhist(saem_sfo_s_multi, xlim = c(-644, -647))
+ vdiffr::expect_doppelganger("llhist for sfo fit", llhist_sfo)
+
set.seed(123456)
saem_biphasic_m_multi <- multistart(saem_biphasic_m, n = 8,
cores = n_cores)

Contact - Imprint