<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>The Open Inference Lab</title>
<link>https://xynthiakavelaars.github.io/OpenInferenceLab/</link>
<atom:link href="https://xynthiakavelaars.github.io/OpenInferenceLab/index.xml" rel="self" type="application/rss+xml"/>
<description>Opening up (Bayesian) models, multivariate inference, statistical decision-making, and more</description>
<generator>quarto-1.9.37</generator>
<lastBuildDate>Tue, 26 May 2026 22:00:00 GMT</lastBuildDate>
<item>
  <title>Multiple outcomes, multiple choices: Understanding superiority in the multivariate context</title>
  <dc:creator>Xynthia Kavelaars</dc:creator>
  <link>https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/</link>
  <description><![CDATA[ 





<p>Imagine you’re evaluating a new cancer treatment. It reduces tumor size in most patients, but some experience severe side effects. How do you decide if the treatment is “better” than the standard?</p>
<p>This is the fundamental challenge of clinical trials with multiple outcomes. We rarely care about just one thing. We want efficacy <em>and</em> safety, symptom relief <em>and</em> quality of life. But how do we combine these into a single decision?</p>
<p>The traditional approaches — select a primary outcome or test each outcome separately — have problems. They ignore other information and they ignore the fact that outcomes are often correlated. If a treatment is more agressive, it might treat the disease better, but might result in more side effects as well. That is information you usually want to weigh in your decision to adopt a new treatment.</p>
<p>The most commonly used multivariate alternatives force an artificial choice: demand improvement on all outcomes or on any outcome. The former might be too strict for some situations, whereas the latter might be too lenient. We might be happy if the treatment is better in symptom reduction, as long as side effects are comparable or not too bad. Or if side effects are lower with similar effectivity. In those cases, we don’t need symptom reduction AND side effect reduction. Neither do we accept a small symptom reduction if side effects increase dramatically.</p>
<p>In recent years, attention has been paid to a principled alternative: more <strong>flexible decision rules</strong> that let us define what “success” actually means in our clinical context. Usually, these boil down to weighing outcomes. Several variations of such weighted (usually linear) combinations have been proposed. Under this blog, you can find several references. In the current blog, I will give an intuition of such weighted linear combinations without diving into the detailed differences between such methods. Below is also a Bayesian implementation in R for the situation with two binary outcome variables.</p>
<section id="four-decision-rules-visualized" class="level2">
<h2 class="anchored" data-anchor-id="four-decision-rules-visualized">Four decision rules visualized</h2>
<p>Let me show you the core insight using a simple two-outcome example. Imagine we’re testing a treatment that targets:</p>
<ul>
<li><strong>Cognitive function</strong> (outcome 1)</li>
<li><strong>Fatigue</strong> (outcome 2)</li>
</ul>
<p>Each outcome has a treatment effect: the difference in success probability between the new treatment and control, <img src="https://latex.codecogs.com/png.latex?%5Cdelta_1"> and <img src="https://latex.codecogs.com/png.latex?%5Cdelta_2">.</p>
<p>The four rules discussed here are:</p>
<p><strong>1. Single Rule: improvement on prespecified (“primary”) outcome</strong></p>
<ul>
<li>Tests if cognitive function improves: <img src="https://latex.codecogs.com/png.latex?%5Cdelta_1%20%3E%200"></li>
<li>Ignores fatigue completely, so fatigue can have any positive or negative effect</li>
<li><strong>When to use</strong>: When you have one clear primary outcome</li>
</ul>
<p><strong>2. Any Rule: improvement on one of the outcomes</strong></p>
<ul>
<li>Tests if <em>at least one</em> outcome improves: <img src="https://latex.codecogs.com/png.latex?%5Cdelta_1%20%3E%200"> OR <img src="https://latex.codecogs.com/png.latex?%5Cdelta_2%20%3E%200"></li>
<li>Consists of two decision regions</li>
<li>Most liberal: accepts marginal improvements, even when the other outcome has a large decline<br>
</li>
<li><strong>When to use</strong>: Rare, unless any improvement is clinically meaningful, regardless of decline on the other outcome</li>
</ul>
<p><strong>3. All Rule: improvement on all of the outcomes</strong></p>
<ul>
<li>Tests if <em>both</em> improve: <img src="https://latex.codecogs.com/png.latex?%5Cdelta_1%20%3E%200"> AND <img src="https://latex.codecogs.com/png.latex?%5Cdelta_2%20%3E%200"></li>
<li>Most conservative: requires improvement everywhere</li>
<li><strong>When to use</strong>: When improvement on all outcomes is truly necessary (safety + efficacy)</li>
</ul>
<p><strong>4. Compensatory Rule: improvement on a weighted combination of outcomes</strong></p>
<ul>
<li>Tests if weighted sum exceeds zero: <img src="https://latex.codecogs.com/png.latex?w_1%20%5Ccdot%20%5Cdelta_1%20+%20w_2%20%5Ccdot%20%5Cdelta_2%20%3E%200"></li>
<li>The diagonal dashed line shows the decision boundary and corresponds to weights of <img src="https://latex.codecogs.com/png.latex?0.5"> for each outcome (see below for other weight combinations)</li>
<li><strong>Allows tradeoffs</strong>: A strong gain in one outcome can compensate for a small loss in another</li>
<li><strong>Allows different importances</strong>: Outcomes are weighted by their importances</li>
<li><strong>When to use</strong>: When outcomes are both meaningful but have different importances; when a small decline can be compensated for by a larger improvement</li>
</ul>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/index_files/figure-html/unnamed-chunk-1-1.png" class="img-fluid figure-img" width="768"></p>
</figure>
</div>
</div>
</div>
<p>In these plots, bivariate (posterior) distributions of treatment differences are shown. The darker green parts of the distributions show the proportions of draw that fall in the region where superiority is concluded. The light green parts of the distribution falls outside of the superiority region. If a sufficiently large part of the posterior distribution (e.g., 95%) falls in the superiority region, superiority is concluded. Note that for the Any rule a multiple testing correction on the cutoff is needed.</p>
</section>
<section id="superiority-decisions-with-different-rules" class="level2">
<h2 class="anchored" data-anchor-id="superiority-decisions-with-different-rules">Superiority decisions with different rules</h2>
<p>As can be seen in the plots above as well, each of these rules results in different amounts of evidence of superiority. The posterior probabilities to conclude superiority for the visualized posterior distributions are the following:</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>Posterior Probabilities of Superiority for Four Decision Rules:</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>                              Rule Posterior_Probability
1                  Single (δ₁ &gt; 0)                 0.843
2           Any (δ₁ &gt; 0 OR δ₂ &gt; 0)                 0.992
3          All (δ₁ &gt; 0 AND δ₂ &gt; 0)                 0.666
4 Compensatory (0.5δ₁ + 0.5δ₂ &gt; 0)                 0.950</code></pre>
</div>
</div>
<p>From these posterior probabilities, it can be seen that the All rule is the most strict rule with the lowest posterior probability, while the Any rule is the most lenient rule. While this is generally the case, it is useful to note that the relation between decision rules and correlation is a bit more complicated. There will be a post on this topic later.</p>
</section>
<section id="weight-specifications-in-the-compensatory-decision-rule" class="level1">
<h1>Weight specifications in the compensatory decision rule</h1>
<p>As mentioned above, the compensatory rule can can deal with different importances.<br>
Therefore we must decide how much does each outcome contributes to the decision (i.e., conclusion regarding superiority in this case). This is where weights come in.</p>
<p>A <strong>weighted compensatory decision rule</strong> uses the formula:</p>
<p><img src="https://latex.codecogs.com/png.latex?w_1%20%5Ctimes%20%5Cdelta_1%20+%20w_2%20%5Ctimes%20%5Cdelta_2%20%3E%200"></p>
<p>where:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?w_1"> and <img src="https://latex.codecogs.com/png.latex?w_2"> are weights, typically summing to <img src="https://latex.codecogs.com/png.latex?1"></li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cdelta_1"> is the treatment effect on outcome 1</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cdelta_2"> is the treatment effect on outcome 2</li>
</ul>
<p>The weights quantify how much each outcome contributes to the overall treatment success decision. A higher weight means that the accomponying outcome is more critical to declaring the treatment a success.</p>
<p>Below, we showcase five different weight specifications in more detail.</p>
<hr>
<section id="weight-specification-1-fatigue-priority-0.25-0.75" class="level2">
<h2 class="anchored" data-anchor-id="weight-specification-1-fatigue-priority-0.25-0.75">Weight specification 1: Fatigue priority (0.25, 0.75)</h2>
<p><strong>Meaning:</strong> Fatigue reduction 3× more important than cognition<br>
<strong>Decision boundary slope:</strong> -0.33 (shallow)</p>
<section id="interpretation" class="level3">
<h3 class="anchored" data-anchor-id="interpretation">Interpretation</h3>
<ul>
<li>Fatigue effects are weighted 3 times more heavily</li>
<li>A 0.10-unit improvement in <em>fatigue</em> can offset a 0.30-unit decline in <em>cognitive function</em></li>
<li>This rule strongly favors treatments that reduce fatigue</li>
<li>Cognitive decline is more easily tolerated if fatigue improves substantially</li>
</ul>
</section>
<section id="real-world-example" class="level3">
<h3 class="anchored" data-anchor-id="real-world-example">Real-World example</h3>
<p>A condition where severe fatigue prevents basic activities but cognitive function is largely preserved. A treatment that substantially improves fatigue while causing mild cognitive effects might still be considered successful. The shallow decision boundary accommodates this flexibility.</p>
<hr>
</section>
</section>
<section id="weight-specification-2-equal-weights-0.50-0.50" class="level2">
<h2 class="anchored" data-anchor-id="weight-specification-2-equal-weights-0.50-0.50">Weight specification 2: Equal weights (0.50, 0.50)</h2>
<p><strong>Meaning:</strong> Both outcomes equally important<br>
<strong>Decision boundary slope:</strong> -1 (diagonal)</p>
<section id="interpretation-1" class="level3">
<h3 class="anchored" data-anchor-id="interpretation-1">Interpretation</h3>
<ul>
<li>A 0.10-unit improvement in <em>cognitive function</em> exactly offsets a 0.10-unit decline in <em>fatigue</em></li>
<li>50% of the decision weight comes from each outcome</li>
<li>This is the ‘neutral’ baseline when no clinical evidence supports prioritizing one outcome over another</li>
</ul>
</section>
<section id="real-world-example-1" class="level3">
<h3 class="anchored" data-anchor-id="real-world-example-1">Real-World example</h3>
<p>A condition affecting both cognition and energy equally. Without clinical evidence suggesting one symptom causes more suffering than the other, equal weights reflect equipoise.</p>
<hr>
</section>
</section>
<section id="weight-specification-3-moderate-cognitive-emphasis-0.60-0.40" class="level2">
<h2 class="anchored" data-anchor-id="weight-specification-3-moderate-cognitive-emphasis-0.60-0.40">Weight specification 3: Moderate cognitive emphasis (0.60, 0.40)</h2>
<p><strong>Meaning:</strong> <em>Cognitive function</em> moderately more important than <em>fatigue</em> (1.5× weight) <strong>Decision boundary slope:</strong> -1.5 (moderate slope)</p>
<section id="interpretation-2" class="level3">
<h3 class="anchored" data-anchor-id="interpretation-2">Interpretation</h3>
<ul>
<li>Balanced approach with mild emphasis on cognition</li>
<li>A 0.10-unit decline in <em>cognitive function</em> requires a 0.15-unit improvement in <em>fatigue</em> to compensate</li>
<li>More flexible than pure cognitive priority, but still favors cognition</li>
<li>Accommodates situations where both outcomes matter, with cognition slightly prioritized</li>
</ul>
</section>
<section id="real-world-example-2" class="level3">
<h3 class="anchored" data-anchor-id="real-world-example-2">Real-World example</h3>
<p>A condition with both cognitive impairment and severe fatigue. Clinically, restoration of cognitive function (memory, attention) might be slightly more important for resuming work, but fatigue reduction is also a critical target. This 60:40 weighting reflects the “cognition matters more, but fatigue really matters too” consensus.</p>
<hr>
</section>
</section>
<section id="weight-specification-4-cognitive-priority-0.75-0.25" class="level2">
<h2 class="anchored" data-anchor-id="weight-specification-4-cognitive-priority-0.75-0.25">Weight specification 4: Cognitive priority (0.75, 0.25)</h2>
<p><strong>Meaning:</strong> <em>cognitive function</em> 3× more important than <em>fatigue</em><br>
<strong>Decision boundary slope:</strong> -3</p>
<section id="interpretation-3" class="level3">
<h3 class="anchored" data-anchor-id="interpretation-3">Interpretation</h3>
<ul>
<li><em>Cognitive function</em> effects are weighted 3 times more heavily</li>
<li>A 0.10-unit decline in <em>cognitive function</em> requires a 0.30-unit improvement in <em>fatigue</em> to compensate. Or a 0.30 unit decline in <em>fatigue</em> is compensated by a 0.10-unit improvement in <em>cognitive function</em></li>
<li>This rule strongly favors treatments that improve cognition</li>
<li>Fatigue worsening is relatively tolerable if cognition improves substantially</li>
</ul>
</section>
<section id="real-world-example-3" class="level3">
<h3 class="anchored" data-anchor-id="real-world-example-3">Real-World example</h3>
<p>A condition where cognitive decline prevents working and living independently. Even if the treatment causes mild fatigue, restoring cognitive function might be worth it. The steep decision boundary reflects this harsh tradeoff.</p>
<hr>
</section>
</section>
<section id="weight-specification-5-cognitive-dominant-0.90-0.10" class="level2">
<h2 class="anchored" data-anchor-id="weight-specification-5-cognitive-dominant-0.90-0.10">Weight specification 5: Cognitive dominant (0.90, 0.10)</h2>
<p><strong>Meaning:</strong> <em>Cognitive function</em> 9× more important than <em>fatigue</em><br>
<strong>Decision boundary slope:</strong> -9 (very steep)</p>
<section id="interpretation-4" class="level3">
<h3 class="anchored" data-anchor-id="interpretation-4">Interpretation</h3>
<ul>
<li>Extreme weight on cognitive improvement</li>
<li>The decision is almost entirely driven by cognitive outcomes</li>
<li>Fatigue changes barely move the needle on overall treatment success</li>
<li>Without substantial cognitive benefits, the treatment will probably not be declared successful</li>
</ul>
</section>
<section id="real-world-example-4" class="level3">
<h3 class="anchored" data-anchor-id="real-world-example-4">Real-world example</h3>
<p>A condition where preserving cognitive function is the only meaningful therapeutic goal. Minimal fatigue improvements are irrelevant if cognition doesn’t improve. This extreme weighting makes sense only in narrowly defined contexts where one outcome truly dominates clinical significance, while excluding the other outcome in its entirety is not desirable.</p>
<hr>
</section>
</section>
<section id="visualization-of-the-pre-specified-scenarios" class="level2">
<h2 class="anchored" data-anchor-id="visualization-of-the-pre-specified-scenarios">Visualization of the pre-specified scenarios</h2>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/index_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>The plots above show how different weight specifications change the decision boundary:</p>
<ul>
<li><strong>Fatigue priority (0.25, 0.75):</strong> Shallow boundary, hard to compensate fatigue deficits</li>
<li><strong>Equal (0.50, 0.50):</strong> Diagonal boundary, symmetric tradeoffs</li>
<li><strong>Moderate cognitive emphasis (0.60, 0.40):</strong> Intermediate, slight asymmetry</li>
<li><strong>Cognitive priority (0.75, 0.25):</strong> Steep boundary, hard to compensate cognitive deficits</li>
<li><strong>Cognitive dominant (0.90, 0.10):</strong> Very steep, almost binary on cognitive outcome</li>
</ul>
<p>The decision boundary (the line separating success from non-success) has slope <img src="https://latex.codecogs.com/png.latex?-w_1/w_2">. A steeper slope means it’s harder to compensate poor performance on the high-weight outcome with improvements in the low-weight outcome. Notice how the colored region (treatment success) expands or contracts depending on which outcomes are prioritized. The weighting scheme directly shapes what outcomes “count” as success.</p>
</section>
</section>
<section id="posterior-probabilities-for-different-weight-specifications" class="level1">
<h1>Posterior probabilities for different weight specifications</h1>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>                    Specification Posterior_Probability
1   Fatigue priority (0.25, 0.75)                 0.908
2              Equal (0.50, 0.50)                 0.950
3 Moderate cognitive (0.60, 0.40)                 0.947
4 Cognitive priority (0.75, 0.25)                 0.920
5 Cognitive dominant (0.90, 0.10)                 0.873</code></pre>
</div>
</div>
<p>From the output above, it can be seen that different weight specifications result in different posterior probabilities of superiority. Hence, weights are not technical details. They formalize what the decision-makers value most. Choosing weights thoughtfully is essential for multi-outcome decision-making.</p>
<hr>
<section id="r-implementation-with-bmco-package" class="level2">
<h2 class="anchored" data-anchor-id="r-implementation-with-bmco-package">R Implementation with bmco Package</h2>
<p>The <code>bmco</code> package implements the computation of the posterior probability of superiority for binary outcome variables. Below is example code showing how to use <code>bmco</code> with binary outcome data:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Install bmco if needed</span></span>
<span id="cb4-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># install.packages("bmco")</span></span>
<span id="cb4-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(bmco)</span>
<span id="cb4-4"></span>
<span id="cb4-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Create example binary outcome trial data</span></span>
<span id="cb4-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># In practice, this would come from your actual trial</span></span>
<span id="cb4-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set.seed</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2024</span>)</span>
<span id="cb4-8">n_per_group <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span></span>
<span id="cb4-9"></span>
<span id="cb4-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Generate binary outcomes consistent with the posterior parameters</span></span>
<span id="cb4-11">trial_data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb4-12">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">treatment =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>, n_per_group), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>, n_per_group)),</span>
<span id="cb4-13">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cognitive_function =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb4-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rbinom</span>(n_per_group, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.40</span>),      <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Control: 40% success</span></span>
<span id="cb4-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rbinom</span>(n_per_group, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.65</span>)       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># New: 65% success (IMPROVED)</span></span>
<span id="cb4-16">  ),</span>
<span id="cb4-17">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fatigue_reduction =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb4-18">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rbinom</span>(n_per_group, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span>),      <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Control: 50% success</span></span>
<span id="cb4-19">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rbinom</span>(n_per_group, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.35</span>)       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># New: 35% success (WORSENED)</span></span>
<span id="cb4-20">  )</span>
<span id="cb4-21">)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>Success rates by group:

 COGNITIVE FUNCTION:
   Control:      0.425 
   New treatment:  0.61 
   Difference:   0.185 

 FATIGUE REDUCTION:
   Control:      0.575 
   New treatment:  0.345 
   Difference:   -0.23 </code></pre>
</div>
</div>
<p><strong><em>Interpretation</em></strong> The new treatment shows a tradeoff pattern:</p>
<ul>
<li>Cognitive function improves by 0.185.<br>
</li>
<li>Fatigue worsens by -0.23.</li>
</ul>
<p>This is a therapeutic scenario where treatment helps but has an adverse effect as well.</p>
</section>
<section id="different-decision-rules" class="level2">
<h2 class="anchored" data-anchor-id="different-decision-rules">Different decision rules</h2>
<p>If we analyze these data with different decision rules, we see the following results:</p>
<section id="single-rule" class="level3">
<h3 class="anchored" data-anchor-id="single-rule">1. Single rule</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">result_single <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb6-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb6-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb6-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb6-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb6-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb6-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,</span>
<span id="cb6-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Focus only on cognitive function</span></span>
<span id="cb6-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb6-10">)</span>
<span id="cb6-11"></span>
<span id="cb6-12">p_single <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> result_single<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> RESULT:
 P(Superiority) =  1 </code></pre>
</div>
</div>
<p><strong><em>Interpretation</em></strong> The Single rule declares the new treatment superior, because cognitive function improves, and the rule ignores the fatigue worsening. This might be problematic, since adverse effects often cannot be ignored in practice.</p>
</section>
<section id="all-rule" class="level3">
<h3 class="anchored" data-anchor-id="all-rule">2. All rule</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1">result_all <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb8-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb8-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb8-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb8-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb8-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb8-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"All"</span>,</span>
<span id="cb8-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb8-9">)</span>
<span id="cb8-10"></span>
<span id="cb8-11">p_all <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> result_all<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>RESULT:
 P(Superiority) =  0 </code></pre>
</div>
</div>
<p><strong><em>Interpretation</em></strong> The All rule declares the new treatment not superior, because fatigue worsens, violating the requirement thatboth outcomes must improve. This might be too conservative: A treatment that substantially helps cognition while causing moderate fatiguemight still be valuable to patients and clinicians.</p>
</section>
<section id="any-rule" class="level3">
<h3 class="anchored" data-anchor-id="any-rule">3. Any rule</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1">result_any <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb10-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb10-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb10-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb10-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb10-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb10-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Any"</span>,</span>
<span id="cb10-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb10-9">)</span>
<span id="cb10-10"></span>
<span id="cb10-11">p_any <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> result_any<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> RESULT:
 P(Superiority) =  1 </code></pre>
</div>
</div>
<p><strong><em>Interpretation</em></strong> The Any rule declares the new treatment superior, because cognitive function improves, satisfying the rule. This can be too permissive: It accepts marginal improvements on one outcome even if other outcomes worsen dramatically. The magnitude of the fatigue increase is not considered.</p>
</section>
<section id="compensatory-rule" class="level3">
<h3 class="anchored" data-anchor-id="compensatory-rule">4. Compensatory rule</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ===== Example 1: Fatigue Priority (0.25, 0.75) =====</span></span>
<span id="cb12-2">result_fatigue_priority <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb12-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb12-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb12-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb12-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb12-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb12-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,</span>
<span id="cb12-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.25</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span>),       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cognitive 25%, fatigue 75%</span></span>
<span id="cb12-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb12-11">)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> δ₁ (cognitive)  =  0.185 
 δ₂ (fatigue)    =  -0.23 
 Weighted delta:
 0.25·δ₁ + 0.75·δ₂ = 0.25· 0.185  + 0.75· -0.23  =  -0.126 

 Fatigue priority (0.25, 0.75): P(superiority) = 0 </code></pre>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ===== Example 2: Equal Weights (0.50, 0.50) =====</span></span>
<span id="cb14-2">result_equal <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb14-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb14-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb14-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb14-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb14-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb14-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,           <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use Compensatory</span></span>
<span id="cb14-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span>),       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Equal weights</span></span>
<span id="cb14-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb14-11">)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> Weighted delta:
 0.50·δ₁ + 0.50·δ₂ = 0.50· 0.185  + 0.50· -0.23  =  -0.022 

 Equal weights (0.50, 0.50): P(superiority) = 0.245 </code></pre>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb16" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ===== Example 3: Moderate Cognitive Emphasis (0.60, 0.40) =====</span></span>
<span id="cb16-2">result_moderate <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb16-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb16-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb16-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb16-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb16-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb16-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,</span>
<span id="cb16-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.60</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.40</span>),       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cognitive 60%, fatigue 40%</span></span>
<span id="cb16-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb16-11">)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> Weighted delta:
 0.60·δ₁ + 0.40·δ₂ = 0.60· 0.185  + 0.40· -0.23  =  0.019 

 Moderate cognitive emphasis (0.60, 0.40): P(superiority) = 0.716 </code></pre>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb18" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ===== Example 4: Cognitive Priority (0.75, 0.25) =====</span></span>
<span id="cb18-2">result_cog_priority <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb18-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb18-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb18-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb18-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb18-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb18-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,</span>
<span id="cb18-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.25</span>),       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cognitive 75%, fatigue 25%</span></span>
<span id="cb18-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb18-11">)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> Weighted delta:
 0.75·δ₁ + 0.25·δ₂ = 0.75· 0.185  + 0.25· -0.23  =  0.081 

 Cognitive priority (0.75, 0.25): P(superiority) = 0.982 </code></pre>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb20" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ===== Example 5: Cognitive Dominant (0.90, 0.10) =====</span></span>
<span id="cb20-2">result_cog_dominant <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb20-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb20-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb20-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"control"</span>,</span>
<span id="cb20-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new"</span>,</span>
<span id="cb20-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cognitive_function"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fatigue_reduction"</span>),</span>
<span id="cb20-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,</span>
<span id="cb20-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>),       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cognitive 90%, fatigue 10%</span></span>
<span id="cb20-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb20-11">)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> Weighted delta:
 0.90·δ₁ + 0.10·δ₂ = 0.90· 0.185  + 0.10· -0.23  =  0.144 

 Cognitive dominant (0.90, 0.10): P(superiority) = 0.998 </code></pre>
</div>
</div>
<p>Here is a summary comparison across all decision rules and weight specifications:</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>                                            Rule         Delta P_Superiority
1                                         Single 0.183, -0.227         1.000
2                                            All 0.183, -0.228         0.000
3                                            Any 0.183, -0.227         1.000
4   Compensatory - Fatigue priority (0.25, 0.75)        -0.126         0.000
5              Compensatory - Equal (0.50, 0.50)        -0.023         0.245
6 Compensatory - Moderate cognitive (0.60, 0.40)         0.019         0.716
7 Compensatory - Cognitive priority (0.75, 0.25)          0.08         0.982
8 Compensatory - Cognitive dominant (0.90, 0.10)         0.142         0.998</code></pre>
</div>
</div>
<p>As can be seen, in this dataset, the improvement on cognition outweighs the adverse effect on fatigue if we only look at cognition (Single rule), let the effects decide which outcome is decisive (Any rule) or when cognition is given substantially more weight (Cognitive priority and Cognitive dominant scenarios). Moderate cognitive emphasis does not suffice to declare the new treatment superior in this dataset. Of course, the posterior probability of superiority does not depend on the size of the treatment difference only, but also on the uncertainty around the treatment difference. Hence, other sample sizes or different prior distributions might result in different conclusions for some of these rules.</p>
<hr>
</section>
</section>
<section id="how-to-choose-weights-for-your-study" class="level2">
<h2 class="anchored" data-anchor-id="how-to-choose-weights-for-your-study">How to choose weights for your study</h2>
<p>A few suggestions to choose weights thoughtfully:</p>
<section id="stakeholder-input" class="level3">
<h3 class="anchored" data-anchor-id="stakeholder-input">1. <strong>Stakeholder Input</strong></h3>
<ul>
<li>Interview patients: Which symptom burdens them most?</li>
<li>Interview clinicians: What outcomes drive treatment decisions?</li>
<li>Engage with regulators: Do they have preferred weights?</li>
</ul>
</section>
<section id="clinical-literature-review" class="level3">
<h3 class="anchored" data-anchor-id="clinical-literature-review">2. <strong>Clinical Literature Review</strong></h3>
<ul>
<li>Do outcome severity/burden ratios support asymmetry?</li>
<li>Are there published preference scores or visual analog scales?</li>
<li>What do existing treatment guidelines suggest?</li>
</ul>
</section>
<section id="regulatory-guidance" class="level3">
<h3 class="anchored" data-anchor-id="regulatory-guidance">3. <strong>Regulatory Guidance</strong></h3>
<ul>
<li>FDA, EMA, and other agencies increasingly specify outcome priorities</li>
<li>Check public briefing documents and meeting minutes</li>
<li>Some diseases have established hierarchies</li>
</ul>
</section>
<section id="sensitivity-analysis" class="level3">
<h3 class="anchored" data-anchor-id="sensitivity-analysis">4. <strong>Sensitivity Analysis</strong></h3>
<ul>
<li>Pre-specify multiple weight scenarios (e.g., 50:50, 60:40, 75:25)</li>
<li>Run analyses under each scenario</li>
<li>Assess how robust conclusions are to different weights</li>
</ul>
</section>
<section id="transparency-pre-specification" class="level3">
<h3 class="anchored" data-anchor-id="transparency-pre-specification">5. <strong>Transparency &amp; Pre-specification</strong></h3>
<ul>
<li>Don’t choose weights post-hoc based on study results</li>
<li>Document your weighting rationale in the statistical analysis plan</li>
</ul>
</section>
</section>
</section>
<section id="takeaway" class="level1">
<h1>Takeaway</h1>
<p>The decision rule you choose shapes your entire trial:</p>
<ul>
<li><strong>Single</strong>: Use only for truly secondary outcomes</li>
<li><strong>Any</strong>: Too liberal for most clinical contexts</li>
<li><strong>All</strong>: Only if all outcomes are absolutely necessary</li>
<li><strong>Compensatory</strong>: The new default choice; lets you encode clinical judgment about tradeoffs</li>
</ul>
<p>The beauty of a multivariate framework with a weighted combination is that you can make your decision rule match your actual clinical question.</p>
<hr>
<p><strong>Further reading</strong>:</p>
<ul>
<li>Murray, T., Thall, P. &amp; Yuan, Y. (2016). Utility-based designs for randomized comparative trials with categorical outcomes. <i>Statistics in medicine</i>.</li>
<li>Kavelaars, X., Mulder, J. &amp; Kaptein, M. (2020). Decision-making with multiple correlated binary outcomes in clinical trials. <i>Statistical Methods in Medical Research</i>. <a href="https://doi.org/10.1177/0962280220922256" target="_blank">https://doi.org/10.1177/0962280220922256</a></li>
<li>Sozu, T., Sugimoto, T. &amp; Hamasaki, T. (2010). Sample size determination in clinical trials with multiple co-primary binary endpoints.. <i>Statistics in medicine</i>. <a href="https://doi.org/10.1002/sim.3972" target="_blank">https://doi.org/10.1002/sim.3972</a></li>
<li>Sozu, T., Sugimoto, T. &amp; Hamasaki, T. (2016). Reducing unnecessary measurements in clinical trials with multiple primary endpoints. <i>Journal of biopharmaceutical statistics</i>.</li>
<li>Su, T., Glimm, E., Whitehead, J. &amp; Branson, M. (2012). An evaluation of methods for testing hypotheses relating to two endpoints in a single clinical trial. <i>Pharmaceutical statistics</i>.</li>
</ul>
<p><strong>Questions? Any references that should be included as well? Found this useful? I’m on social media and happy to discuss!</strong></p>
<div style="display:flex; gap:20px;">
<a href="https://github.com/XynthiaKavelaars/bmco" target="_blank"> Github</a><a href="https://bsky.app/profile/xynthia-kavelaars.bsky.social" target="_blank"> BlueSky</a><a href="https://mastodon.social/@xynthiakavelaars" target="_blank"> Mastodon</a><a href="https://mastodon.social/@xynthiakavelaars" target="_blank"> Blog</a>
</div>


</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{kavelaars2026,
  author = {Kavelaars, Xynthia},
  title = {Multiple Outcomes, Multiple Choices: {Understanding}
    Superiority in the Multivariate Context},
  date = {2026-05-27},
  url = {https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-kavelaars2026" class="csl-entry quarto-appendix-citeas">
Kavelaars, Xynthia. 2026. <span>“Multiple Outcomes, Multiple Choices:
Understanding Superiority in the Multivariate Context.”</span> May 27.
<a href="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/">https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/</a>.
</div></div></section></div> ]]></description>
  <category>Bayesian analysis</category>
  <category>multivariate analysis</category>
  <category>decision rules</category>
  <category>bmco</category>
  <category>r</category>
  <guid>https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/</guid>
  <pubDate>Tue, 26 May 2026 22:00:00 GMT</pubDate>
  <media:content url="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p02/images/thumbnail_p2.png" medium="image" type="image/png" height="145" width="144"/>
</item>
<item>
  <title>When binary outcomes move together: A Bayesian approach to multivariate analysis</title>
  <dc:creator>Xynthia Kavelaars</dc:creator>
  <link>https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/</link>
  <description><![CDATA[ 





<style>
.description { display: none; }
</style>
<div class="alert alert-info border-0 rounded-3" style="background: #F5F5F5; color: #1a5d54; padding: 2rem; border-left: 5px solid #2B8A7A;">
<h3 style="margin-top: 0; color: #2B8A7A;" class="anchored">
<p>💊 What does “success” actually mean?</p>
</h3>
<p>
If you want to improve pain relief <em>and</em> quality of life, how do you know if your treatment really works? Discover how to analyze multiple outcomes together.
</p>
</div>
<p>Imagine you’re designing a study to test the effectiveness of a new treatment. Success isn’t just about symptom relief—you also care about quality of life (QoL). Or side effects. Or both.</p>
<p>So you measure <strong>two outcomes</strong>: symptom relief (yes/no) and quality of life improvement (yes/no). Now the question arises: <em>What does “success” mean?</em></p>
<ul>
<li>Must the treatment improve <strong>both</strong> outcomes? (All rule)</li>
<li>Or is improvement in <strong>just one</strong> enough? (Any rule)<br>
</li>
<li>Or can you <strong>weight</strong> them differently — maybe symptom relief matters 70%, QoL only 30%? Maybe a small negative effect on QoL is acceptable if symptom relief is large enough? (Compensatory rule)</li>
</ul>
<p>When you measure two outcomes together, you want your analysis to reflect that relationship in the decision regarding superiority.</p>
<section id="the-challenge-with-standard-approaches" class="level3">
<h3 class="anchored" data-anchor-id="the-challenge-with-standard-approaches">The challenge with standard approaches</h3>
<p>Testing outcomes separately (symptom relief indpendently from QoL) invites complications:</p>
<ul>
<li>Often outcomes are given a primary or secondary role in analysis and decision-making. But that is at least problematic when safety and effectivity are measured together. Safety is almost never of secondary concern, and neither is effectivity.</li>
<li>Decisions are often based on an ad hoc basis: Two decisions are combined into a single decision, without providing a probability statement on the combined decision, leaving the accuracy of the final decision less transparent.</li>
<li>Your two outcomes may be <em>correlated</em>: if the treatment relieves symptoms, it might as well improve quality of life too. Standard separate testing doesn’t easily account for this structure.</li>
</ul>
<p>These methods do not always answer the most relevant question. <strong>The real question</strong> people care about:</p>
<p><em>“What is the probability that this treatment improves BOTH outcomes?”</em></p>
<p>Or: <em>“At least one of the outcomes?”</em> Or: <em>“This weighted combination of outcomes?”</em></p>
<p>These are natural, practical questions, but they are not straightforward to answer with standard approaches - especially when outcomes differ in their relative contributions to success.</p>
<hr>
</section>
<section id="a-direct-approach-joint-modeling-of-binary-outcomes" class="level2">
<h2 class="anchored" data-anchor-id="a-direct-approach-joint-modeling-of-binary-outcomes">A direct approach: Joint modeling of binary outcomes</h2>
<p>Here’s an elegant solution: <strong>Model both outcomes together in a single framework</strong>, account for their natural correlation, and use the posterior distribution to answer your specific question.</p>
<p>The <code>bmco</code> package in R implements this. It’s built on the principle that when you have multiple binary outcomes, analyzing them jointly — rather than piecing together separate tests - gives you more coherence.</p>
<p>Let’s simulate trial data:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(bmco)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set.seed</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2026</span>)</span>
<span id="cb1-3"></span>
<span id="cb1-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Simulate a trial: 100 patients, 50 per arm</span></span>
<span id="cb1-5"></span>
<span id="cb1-6">outcome_data_placebo <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">t</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rmultinom</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span>)))  </span>
<span id="cb1-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Placebo: 40% pain relief, 50% mobility improvement, correlation 0.33</span></span>
<span id="cb1-8"></span>
<span id="cb1-9">outcome_data_drug <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">t</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rmultinom</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.55</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.15</span>)))   </span>
<span id="cb1-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Drug: 65% pain relief, 70% mobility improvement, correlation 0.30</span></span>
<span id="cb1-11"></span>
<span id="cb1-12">trial_data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb1-13">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">treatment =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">each =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>),</span>
<span id="cb1-14">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pain_relief =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb1-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rowSums</span>(outcome_data_placebo[,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)]), </span>
<span id="cb1-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rowSums</span>(outcome_data_drug[,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)])</span>
<span id="cb1-17">  ),</span>
<span id="cb1-18">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mobility_improved =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb1-19">     <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rowSums</span>(outcome_data_placebo[,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)]), </span>
<span id="cb1-20">     <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rowSums</span>(outcome_data_drug[,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)])</span>
<span id="cb1-21">  )</span>
<span id="cb1-22">)</span>
<span id="cb1-23"></span>
<span id="cb1-24"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">head</span>(trial_data)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  treatment pain_relief mobility_improved
1   placebo           1                 1
2   placebo           0                 0
3   placebo           0                 0
4   placebo           1                 1
5   placebo           0                 0
6   placebo           1                 1</code></pre>
</div>
</div>
<p>Now, here’s the key question for this trial: <em>What is the probability that the drug is better on a relevant combination of pain relief and mobility improvement?</em></p>
<p>With <code>bmco</code>, you get a direct answer:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">result <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb3-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb3-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb3-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>,</span>
<span id="cb3-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>,</span>
<span id="cb3-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>),</span>
<span id="cb3-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"All"</span>,  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Drug must improve BOTH outcomes</span></span>
<span id="cb3-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">test =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right_sided"</span>,</span>
<span id="cb3-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb3-10">)</span>
<span id="cb3-11"></span>
<span id="cb3-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(result)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Multivariate Bernoulli Analysis
=================================

   Group mean y1 mean y2
 placebo   0.442   0.443
    drug   0.596   0.865
  n(placebo) = 50    n(drug) = 50

Posterior probability P(drug &gt; placebo) [All rule]: 0.940

Use summary() for credible intervals and ESS.</code></pre>
</div>
</div>
<p>Output for decision-making:</p>
<pre><code>Posterior probability P(drug &gt; placebo on BOTH outcomes): 0.94</code></pre>
<p>If the standard superiority criterion of posterior probability &gt; 0.95 (one-sided testing) is used, you would conclude that the treatment is better on both outcomes.</p>
<p>Why is this nice? The analysis relies upon a multivariate distribution and naturally respects the correlation between your outcomes. If pain relief and mobility are related, the model captures that. And you get a probability statement that can be used for superiority and inferiority decision with control of false positives (i.e., Type I error). The latter is convenient: When an uninformative prior is used, the posterior probability has a direct relationship to the p-value.</p>
<section id="what-makes-this-approach-useful" class="level3">
<h3 class="anchored" data-anchor-id="what-makes-this-approach-useful">What makes this approach useful?</h3>
<p>Behind the scenes, <code>bmco</code> fits a <strong>Bayesian multivariate model</strong> that:</p>
<ol type="1">
<li><p><strong>Captures outcome correlations naturally</strong>: If pain relief and mobility improvement tend to go together (as they often do), the model learns this and uses that structure to give you more precise estimates.</p></li>
<li><p><strong>Returns the posterior distribution directly</strong>: You get samples from the posterior, so you can ask <em>any</em> follow-up question - either on a single outcome or on multiple outcomes: P(drug better on both)? P(drug better on at least one)? P(weighted improvement &gt; 0.10)? P(effect on pain &gt; 0.20)?</p></li>
<li><p><strong>Gives you the probability you actually care about</strong>: A direct posterior probability with a cutoff that corresponds to a prespecified Type I error rate available: “Given the data, what’s the probability of this scenario?”</p></li>
</ol>
<p>The whole framework respects the basic structure of the problem: multiple related outcomes, a coherent treatment comparison, and flexible success criteria.</p>
<hr>
</section>
</section>
<section id="three-decision-rules-compared" class="level2">
<h2 class="anchored" data-anchor-id="three-decision-rules-compared">Three decision rules compared</h2>
<p>Same data, different success criteria:</p>
<section id="all-rule-both-outcomes-must-improve" class="level3">
<h3 class="anchored" data-anchor-id="all-rule-both-outcomes-must-improve">1. All Rule (Both outcomes must improve)</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">result_all <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb6-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb6-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb6-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>,</span>
<span id="cb6-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>,</span>
<span id="cb6-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>),</span>
<span id="cb6-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"All"</span>,</span>
<span id="cb6-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span>,</span>
<span id="cb6-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">return_samples =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># For plot of sample</span></span>
<span id="cb6-10">)</span>
<span id="cb6-11"></span>
<span id="cb6-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"P(drug &gt; placebo on BOTH):"</span>, result_all<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>P(drug &gt; placebo on BOTH): 0.946</code></pre>
</div>
</div>
<p>The plot below visualizes this posterior probability relative to the All rule. A large part of the posterior draws (94.6)% falls in the superiority region (marked area) of the All rule, which is characterized by a treatment difference above zero on both outcomes.</p>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/index_files/figure-html/plot-all-1.png" class="img-fluid figure-img" width="432"></p>
</figure>
</div>
</div>
</div>
<p><strong>When to use</strong>: You need the treatment to be an all-rounder; no concessions permitted.</p>
</section>
<section id="any-rule-at-least-one-outcome-improves" class="level3">
<h3 class="anchored" data-anchor-id="any-rule-at-least-one-outcome-improves">2. Any Rule (At least one outcome improves)</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1">result_any <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb8-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb8-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb8-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>,</span>
<span id="cb8-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>,</span>
<span id="cb8-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>),</span>
<span id="cb8-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Any"</span>,</span>
<span id="cb8-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span>,</span>
<span id="cb8-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">return_samples =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span></span>
<span id="cb8-10">)</span>
<span id="cb8-11"></span>
<span id="cb8-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"P(drug &gt; placebo on AT LEAST ONE):"</span>, result_any<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>P(drug &gt; placebo on AT LEAST ONE): 1</code></pre>
</div>
</div>
<p>Below is another plot, this time to visualize the posterior probability relative to the Any rule. As indicated by the different directions of density lines, the rule is a combination of two superiority regions. Here all of the posterior draws (100%) fall in the superiority region.</p>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/index_files/figure-html/plot-any-1.png" class="img-fluid figure-img" width="432"></p>
</figure>
</div>
</div>
</div>
<p><strong>When to use</strong>: You’re okay with a partially effective treatment. Useful when outcomes are substitutable (e.g., different ways to measure quality of life).</p>
</section>
<section id="compensatory-rule-weighted-outcomes" class="level3">
<h3 class="anchored" data-anchor-id="compensatory-rule-weighted-outcomes">3. Compensatory Rule (Weighted outcomes)</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1">result_comp <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bmvb</span>(</span>
<span id="cb10-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data,</span>
<span id="cb10-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb10-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>,</span>
<span id="cb10-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>,</span>
<span id="cb10-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>),</span>
<span id="cb10-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Comp"</span>,</span>
<span id="cb10-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">w =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>),  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Pain relief is 70% of the story, mobility 30%</span></span>
<span id="cb10-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span>,</span>
<span id="cb10-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">return_samples =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span></span>
<span id="cb10-11">)</span>
<span id="cb10-12"></span>
<span id="cb10-13"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"P(weighted improvement):"</span>, result_comp<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>P(weighted improvement): 0.999</code></pre>
</div>
</div>
<p>In the next plot, the posterior probability relative to the Compensatory rule is shown. The marked area visualizes the superiority region for a Compensatory rule where the first outcome (pain relief) accounts for 70% of the decision and the other 30% is determined by the improvement in mobility. For this rule too, a large part of the posterior draws (99.9%) falls in the superiority region.</p>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/index_files/figure-html/plot-comp-1.png" class="img-fluid figure-img" width="432"></p>
</figure>
</div>
</div>
</div>
<p><strong>When to use</strong>: You have heterogeneous priorities. Pain relief matters most, but mobility counts too.</p>
<p><strong>The key insight</strong>: With these three function calls, you’ve answered three different questions. Each one respects the data and the correlation structure.</p>
<hr>
</section>
</section>
<section id="beyond-the-simple-case-subgroups-and-clustering" class="level2">
<h2 class="anchored" data-anchor-id="beyond-the-simple-case-subgroups-and-clustering">Beyond the simple case: subgroups and clustering</h2>
<p>Additional advantage comes when your data are more complex:</p>
<section id="when-treatments-vary-by-patient-type" class="level3">
<h3 class="anchored" data-anchor-id="when-treatments-vary-by-patient-type">When treatments vary by patient type</h3>
<p>Maybe your treatment works brilliantly in younger patients but poorly in elderly patients. The <code>bglm()</code> function extends the analysis to handle <strong>subgroup effects</strong>:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Add age data </span></span>
<span id="cb12-2">trial_data_with_age <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> trial_data</span>
<span id="cb12-3">trial_data_with_age<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>age <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rnorm</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">60</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>))</span>
<span id="cb12-4"></span>
<span id="cb12-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Does the drug improve BOTH outcomes in elderly patients (age 65+)?</span></span>
<span id="cb12-6">result_elderly <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bglm</span>(</span>
<span id="cb12-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data_with_age,</span>
<span id="cb12-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>,</span>
<span id="cb12-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>,</span>
<span id="cb12-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>,</span>
<span id="cb12-11">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x_var =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"age"</span>,</span>
<span id="cb12-12">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>),</span>
<span id="cb12-13">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x_method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Empirical"</span>,</span>
<span id="cb12-14">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x_def =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">Inf</span>),  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Elderly patients</span></span>
<span id="cb12-15">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"All"</span>,</span>
<span id="cb12-16">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span></span>
<span id="cb12-17">)</span>
<span id="cb12-18"></span>
<span id="cb12-19"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"P(drug &gt; placebo on BOTH | age 65+):"</span>, result_elderly<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>P(drug &gt; placebo on BOTH | age 65+): 0.635</code></pre>
</div>
</div>
<p>While <code>bmvb()</code> relies on a <strong>multivariate Bernoulli distribution</strong>, subgroup analysis uses <strong>multivariate logistic regression</strong> under the hood to answer your multivariate question directly: What’s the posterior probability of superiority in the elderly subgroup?</p>
</section>
<section id="when-data-are-clustered" class="level3">
<h3 class="anchored" data-anchor-id="when-data-are-clustered">When data are clustered</h3>
<p>If you ran this trial across 20 hospitals (cluster-randomized), observations within hospitals aren’t independent. The <code>bglmm()</code> function handles random intercepts and slopes:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use in-built multilevel data </span></span>
<span id="cb14-2">trial_data_with_hospitals <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> bglmm_data</span>
<span id="cb14-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colnames</span>(trial_data_with_hospitals) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"hospital"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"age"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>)</span>
<span id="cb14-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">head</span>(trial_data_with_hospitals)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  hospital treatment      age pain_relief mobility_improved
1        1   placebo 41.27538           0                 1
2        1   placebo 49.95309           1                 1
3        1   placebo 54.95375           1                 1
4        1   placebo 69.72819           1                 1
5        1   placebo 38.03138           1                 0
6        1   placebo 51.30438           1                 0</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb16" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1">result_clustered <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bglmm</span>(</span>
<span id="cb16-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> trial_data_with_hospitals,</span>
<span id="cb16-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treatment"</span>, </span>
<span id="cb16-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_a =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"placebo"</span>,</span>
<span id="cb16-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grp_b =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drug"</span>,</span>
<span id="cb16-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">id_var =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"hospital"</span>,  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Hospital as a random effect</span></span>
<span id="cb16-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x_var =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"age"</span>,</span>
<span id="cb16-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y_vars =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pain_relief"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mobility_improved"</span>),</span>
<span id="cb16-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rule =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"All"</span>,</span>
<span id="cb16-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_burn =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10000</span>,</span>
<span id="cb16-11">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n_it =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20000</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Takes some time; large number of iterations needed</span></span>
<span id="cb16-12">)</span>
<span id="cb16-13"></span>
<span id="cb16-14"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"P(drug &gt; placebo on BOTH | accounting for hospitals):"</span>, result_clustered<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>pop)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>P(drug &gt; placebo on BOTH | accounting for hospitals): 0.969</code></pre>
</div>
</div>
<p>Same multivariate logic; now it’s robust to the clustered structure.</p>
<hr>
</section>
</section>
<section id="when-this-approach-is-useful" class="level2">
<h2 class="anchored" data-anchor-id="when-this-approach-is-useful">When this approach is useful</h2>
<p>In applied research, several things are typically true:</p>
<ol type="1">
<li><p><strong>You care about multiple outcomes.</strong> The treatment affects different aspects of patient well-being, educational progress, quality of life — or any outcome your domain measures.</p></li>
<li><p><strong>Those outcomes are often correlated.</strong> A good treatment usually helps on multiple fronts; a poor one hurts on multiple fronts.</p></li>
<li><p><strong>You want a clear decision rule.</strong> Does this treatment meet our success criteria? And how confident are we?</p></li>
</ol>
<p>The joint modeling approach handles all three naturally:</p>
<ul>
<li><strong>Flexible decision rules</strong>: All (conjunctive), Any (disjunctive), or Compensatory (weighted): Three different ways to capture relative importance of outcomes and to define “success” according to your contextual needs.</li>
<li><strong>Efficient use of data</strong>: The correlation structure gets learned and used. You don’t lose information to assuming independence and may sometimes even end up with a lower sample size.</li>
<li><strong>Interpretable results</strong>: Posterior probabilities statements produce coherent decisions with Type I error control.</li>
</ul>
<hr>
</section>
<section id="getting-started" class="level2">
<h2 class="anchored" data-anchor-id="getting-started">Getting Started</h2>
<p>Install from CRAN:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb18" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">install.packages</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bmco"</span>)</span></code></pre></div></div>
</div>
<p>Then load the package and explore the vignettes. Here, more details on MCMC settings, prior choices, and other options are given.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb19" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(bmco)</span>
<span id="cb19-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vignette</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Introduction to bmco"</span>)</span>
<span id="cb19-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vignette</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Subgroup Analysis with Multivariate Binary Outcomes"</span>)</span>
<span id="cb19-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vignette</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Subgroup Analysis with Multivariate Binary Outcomes in Multilevel Data"</span>)</span></code></pre></div></div>
</div>
<p>Each vignette walks through realistic examples with full reproducible code.</p>
<p>Power analysis is available in the <a href="https://xynthia-kavelaars.shinyapps.io/bmco-pwr/">bmco-pwr Shiny app</a> for basic multivariate Bernoulli analysis using <code>bmvb()</code> and subgroup analysis via <code>bglm()</code>.</p>
<hr>
</section>
<section id="quick-reference" class="level2">
<h2 class="anchored" data-anchor-id="quick-reference">Quick Reference</h2>
<table class="caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>Analysis</th>
<th>Scenario</th>
<th>Function</th>
<th>When to Use</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Basic multivariate Bernoulli</td>
<td>Simple comparison, no covariates</td>
<td><code>bmvb()</code></td>
<td>Randomized trial, full sample analysis</td>
</tr>
<tr class="even">
<td>Subgroup analysis</td>
<td>Treatment varies by patient type</td>
<td><code>bglm()</code></td>
<td>Age-stratified, severity-based, or other subgroup effects</td>
</tr>
<tr class="odd">
<td>Multilevel models</td>
<td>Clustered data (hospitals, schools)</td>
<td><code>bglmm()</code></td>
<td>Cluster-randomized trials or observational data with nesting</td>
</tr>
</tbody>
</table>
<hr>
</section>
<section id="references" class="level2">
<h2 class="anchored" data-anchor-id="references">References</h2>
<p>The methods are published in peer-reviewed journals:</p>
<ul>
<li><strong>Basic multivariate Bernoulli</strong>: Kavelaars, X., Mulder, J. &amp; Kaptein, M. (2020). Decision-making with multiple correlated binary outcomes in clinical trials. <i>Statistical Methods in Medical Research</i>. <a href="https://doi.org/10.1177/0962280220922256" target="_blank">https://doi.org/10.1177/0962280220922256</a></li>
<li><strong>Subgroup analysis</strong>: Kavelaars, X., Mulder, J. &amp; Kaptein, M. (2024). Bayesian Multivariate Logistic Regression for Superiority and Inferiority Decision-Making under Observable Treatment Heterogeneity. <i>Multivariate Behavioral Research</i>. <a href="https://doi.org/10.1080/00273171.2024.2337340" target="_blank">https://doi.org/10.1080/00273171.2024.2337340</a></li>
<li><strong>Multilevel models</strong>: Kavelaars, X., Mulder, J. &amp; Kaptein, M. (2023). Bayesian multilevel multivariate logistic regression for superiority decision-making under observable treatment heterogeneity. <i>BMC Medical Research Methodology</i>. <a href="https://doi.org/10.1186/s12874-023-02034-z" target="_blank">https://doi.org/10.1186/s12874-023-02034-z</a></li>
</ul>
<hr>
<p><strong>Questions? Found this useful? I’m on social media and happy to discuss!</strong></p>
<div style="display:flex; gap:20px;">
<a href="https://github.com/XynthiaKavelaars/bmco" target="_blank"> Github</a><a href="https://bsky.app/profile/xynthia-kavelaars.bsky.social" target="_blank"> BlueSky</a><a href="https://mastodon.social/@xynthiakavelaars" target="_blank"> Mastodon</a><a href="www.linkedin.com/in/xynthia-kavelaars-7a0377129" target="_blank"> LinkedIn</a><a href="https://orcid.org/0000-0003-1600-3153" target="_blank"> ORCID</a>
</div>


</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{kavelaars2026,
  author = {Kavelaars, Xynthia},
  title = {When Binary Outcomes Move Together: {A} {Bayesian} Approach
    to Multivariate Analysis},
  date = {2026-04-29},
  url = {https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-kavelaars2026" class="csl-entry quarto-appendix-citeas">
Kavelaars, Xynthia. 2026. <span>“When Binary Outcomes Move Together: A
Bayesian Approach to Multivariate Analysis.”</span> April 29. <a href="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/">https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/</a>.
</div></div></section></div> ]]></description>
  <category>Bayesian analysis</category>
  <category>multivariate analysis</category>
  <category>decision rules</category>
  <category>subgroup analysis</category>
  <category>multilevel analysis</category>
  <category>bmco</category>
  <category>r</category>
  <guid>https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/</guid>
  <pubDate>Tue, 28 Apr 2026 22:00:00 GMT</pubDate>
  <media:content url="https://xynthiakavelaars.github.io/OpenInferenceLab/posts/p01/images/thumbnail_p1.png" medium="image" type="image/png" height="144" width="144"/>
</item>
</channel>
</rss>
